feat: ✨ initial gifbox integration
This commit is contained in:
parent
0fc8638eb5
commit
e7de8c154a
|
@ -185,6 +185,10 @@ id: 'aid'
|
|||
# connnectOverProxy: false
|
||||
# setPublicReadOnUpload: true
|
||||
# s3ForcePathStyle: true
|
||||
#gifbox:
|
||||
# managed: true
|
||||
# authKey: ''
|
||||
#
|
||||
|
||||
# !!!!!!!!!!
|
||||
# >>>>>> AGAIN, NORMAL SELF-HOSTERS, STAY AWAY! <<<<<<
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
"calckey-js": "^0.0.20",
|
||||
"eslint": "^8.31.0",
|
||||
"execa": "5.1.1",
|
||||
"gifbox.js": "^0.9.0",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-cssnano": "2.1.3",
|
||||
"gulp-rename": "2.0.0",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
export class gifboxIntegration1672854439804 {
|
||||
constructor() {
|
||||
this.name = 'gifboxIntegration1672854439804';
|
||||
}
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" ADD "deeplAuthKey" character varying(128)`);
|
||||
}
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "deeplAuthKey"`);
|
||||
}
|
||||
}
|
|
@ -97,6 +97,10 @@ export type Source = {
|
|||
setPublicReadOnUpload?: boolean;
|
||||
s3ForcePathStyle?: boolean;
|
||||
};
|
||||
gifbox: {
|
||||
managed?: boolean;
|
||||
authKey?: string;
|
||||
};
|
||||
summalyProxyUrl?: string;
|
||||
};
|
||||
|
||||
|
|
|
@ -381,6 +381,12 @@ export class Meta {
|
|||
})
|
||||
public deeplIsPro: boolean;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
})
|
||||
public gifboxAuthKey: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
|
|
|
@ -91,6 +91,9 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
if (config.summalyProxyUrl !== undefined) {
|
||||
set.summalyProxy = config.summalyProxyUrl;
|
||||
}
|
||||
if (config.gifbox.managed != null && config.gifbox.managed === true) {
|
||||
set.gifboxAuthKey = config.gifbox.authKey;
|
||||
}
|
||||
await db.transaction(async transactionalEntityManager => {
|
||||
const metas = await transactionalEntityManager.find(Meta, {
|
||||
order: {
|
||||
|
|
|
@ -422,6 +422,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
enableDiscordIntegration: instance.enableDiscordIntegration,
|
||||
enableServiceWorker: instance.enableServiceWorker,
|
||||
translatorAvailable: instance.deeplAuthKey != null,
|
||||
gifboxAvailable: instance.gifboxAuthKey != null,
|
||||
pinnedPages: instance.pinnedPages,
|
||||
pinnedClipId: instance.pinnedClipId,
|
||||
cacheRemoteFiles: instance.cacheRemoteFiles,
|
||||
|
@ -471,6 +472,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
objectStorageS3ForcePathStyle: instance.objectStorageS3ForcePathStyle,
|
||||
deeplAuthKey: instance.deeplAuthKey,
|
||||
deeplIsPro: instance.deeplIsPro,
|
||||
gifboxAuthKey: instance.gifboxAuthKey,
|
||||
enableIpLogging: instance.enableIpLogging,
|
||||
enableActiveEmailValidation: instance.enableActiveEmailValidation,
|
||||
};
|
||||
|
|
|
@ -80,6 +80,7 @@ export const paramDef = {
|
|||
summalyProxy: { type: 'string', nullable: true },
|
||||
deeplAuthKey: { type: 'string', nullable: true },
|
||||
deeplIsPro: { type: 'boolean' },
|
||||
gifboxAuthKey: { type: 'string', nullable: true },
|
||||
enableTwitterIntegration: { type: 'boolean' },
|
||||
twitterConsumerKey: { type: 'string', nullable: true },
|
||||
twitterConsumerSecret: { type: 'string', nullable: true },
|
||||
|
@ -465,6 +466,14 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
set.deeplIsPro = ps.deeplIsPro;
|
||||
}
|
||||
|
||||
if (ps.gifboxAuthKey !== undefined) {
|
||||
if (ps.gifboxAuthKey === '') {
|
||||
set.gifboxAuthKey = null;
|
||||
} else {
|
||||
set.gifboxAuthKey = ps.gifboxAuthKey;
|
||||
}
|
||||
}
|
||||
|
||||
if (ps.enableIpLogging !== undefined) {
|
||||
set.enableIpLogging = ps.enableIpLogging;
|
||||
}
|
||||
|
|
|
@ -401,6 +401,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
enableServiceWorker: instance.enableServiceWorker,
|
||||
|
||||
translatorAvailable: instance.deeplAuthKey != null,
|
||||
gifboxAvailable: instance.gifboxAuthKey != null,
|
||||
|
||||
...(ps.detail ? {
|
||||
pinnedPages: instance.privateMode && !me ? [] : instance.pinnedPages,
|
||||
|
|
|
@ -167,6 +167,15 @@
|
|||
<template #label>Pro account</template>
|
||||
</FormSwitch>
|
||||
</FormSection>
|
||||
|
||||
<FormSection>
|
||||
<template #label>GifBox integration</template>
|
||||
|
||||
<FormInput v-model="gifboxAuthKey" class="_formBlock">
|
||||
<template #prefix><i class="ph-key-bold ph-lg"></i></template>
|
||||
<template #label>GifBox Auth Key</template>
|
||||
</FormInput>
|
||||
</FormSection>
|
||||
</div>
|
||||
</FormSuspense>
|
||||
</MkSpacer>
|
||||
|
@ -217,6 +226,7 @@ let swPublicKey: any = $ref(null);
|
|||
let swPrivateKey: any = $ref(null);
|
||||
let deeplAuthKey: string = $ref('');
|
||||
let deeplIsPro: boolean = $ref(false);
|
||||
let gifboxAuthKey: string = $ref('');
|
||||
|
||||
async function init() {
|
||||
const meta = await os.api('admin/meta');
|
||||
|
@ -249,6 +259,7 @@ async function init() {
|
|||
swPrivateKey = meta.swPrivateKey;
|
||||
deeplAuthKey = meta.deeplAuthKey;
|
||||
deeplIsPro = meta.deeplIsPro;
|
||||
gifboxAuthKey = meta.gifboxAuthKey;
|
||||
}
|
||||
|
||||
function save() {
|
||||
|
@ -282,6 +293,7 @@ function save() {
|
|||
swPrivateKey,
|
||||
deeplAuthKey,
|
||||
deeplIsPro,
|
||||
gifboxAuthKey,
|
||||
}).then(() => {
|
||||
fetchInstance();
|
||||
});
|
||||
|
|
11
yarn.lock
11
yarn.lock
|
@ -3840,6 +3840,7 @@ __metadata:
|
|||
cypress: 10.11.0
|
||||
eslint: ^8.31.0
|
||||
execa: 5.1.1
|
||||
gifbox.js: ^0.9.0
|
||||
gulp: 4.0.2
|
||||
gulp-cssnano: 2.1.3
|
||||
gulp-rename: 2.0.0
|
||||
|
@ -7395,6 +7396,16 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"gifbox.js@npm:^0.9.0":
|
||||
version: 0.9.0
|
||||
resolution: "gifbox.js@npm:0.9.0"
|
||||
dependencies:
|
||||
axios: ^0.24.0
|
||||
form-data: ^4.0.0
|
||||
checksum: 0e13566249c1f3ee366ca32e451c7926b50658190da3f15f5e0dc7e094167bc1c43621142245b1dbf16b5008a26996bc36799d3c81f78c5418541fe9eaa24892
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"github-from-package@npm:0.0.0":
|
||||
version: 0.0.0
|
||||
resolution: "github-from-package@npm:0.0.0"
|
||||
|
|
Loading…
Reference in New Issue