feat: initial gifbox integration

This commit is contained in:
ThatOneCalculator 2023-01-04 09:53:44 -08:00
parent 0fc8638eb5
commit e7de8c154a
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
11 changed files with 64 additions and 0 deletions

View File

@ -185,6 +185,10 @@ id: 'aid'
# connnectOverProxy: false # connnectOverProxy: false
# setPublicReadOnUpload: true # setPublicReadOnUpload: true
# s3ForcePathStyle: true # s3ForcePathStyle: true
#gifbox:
# managed: true
# authKey: ''
#
# !!!!!!!!!! # !!!!!!!!!!
# >>>>>> AGAIN, NORMAL SELF-HOSTERS, STAY AWAY! <<<<<< # >>>>>> AGAIN, NORMAL SELF-HOSTERS, STAY AWAY! <<<<<<

View File

@ -45,6 +45,7 @@
"calckey-js": "^0.0.20", "calckey-js": "^0.0.20",
"eslint": "^8.31.0", "eslint": "^8.31.0",
"execa": "5.1.1", "execa": "5.1.1",
"gifbox.js": "^0.9.0",
"gulp": "4.0.2", "gulp": "4.0.2",
"gulp-cssnano": "2.1.3", "gulp-cssnano": "2.1.3",
"gulp-rename": "2.0.0", "gulp-rename": "2.0.0",

View File

@ -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"`);
}
}

View File

@ -97,6 +97,10 @@ export type Source = {
setPublicReadOnUpload?: boolean; setPublicReadOnUpload?: boolean;
s3ForcePathStyle?: boolean; s3ForcePathStyle?: boolean;
}; };
gifbox: {
managed?: boolean;
authKey?: string;
};
summalyProxyUrl?: string; summalyProxyUrl?: string;
}; };

View File

@ -381,6 +381,12 @@ export class Meta {
}) })
public deeplIsPro: boolean; public deeplIsPro: boolean;
@Column('varchar', {
length: 128,
nullable: true,
})
public gifboxAuthKey: string | null;
@Column('varchar', { @Column('varchar', {
length: 512, length: 512,
nullable: true, nullable: true,

View File

@ -91,6 +91,9 @@ export default define(meta, paramDef, async (ps, me) => {
if (config.summalyProxyUrl !== undefined) { if (config.summalyProxyUrl !== undefined) {
set.summalyProxy = config.summalyProxyUrl; set.summalyProxy = config.summalyProxyUrl;
} }
if (config.gifbox.managed != null && config.gifbox.managed === true) {
set.gifboxAuthKey = config.gifbox.authKey;
}
await db.transaction(async transactionalEntityManager => { await db.transaction(async transactionalEntityManager => {
const metas = await transactionalEntityManager.find(Meta, { const metas = await transactionalEntityManager.find(Meta, {
order: { order: {

View File

@ -422,6 +422,7 @@ export default define(meta, paramDef, async (ps, me) => {
enableDiscordIntegration: instance.enableDiscordIntegration, enableDiscordIntegration: instance.enableDiscordIntegration,
enableServiceWorker: instance.enableServiceWorker, enableServiceWorker: instance.enableServiceWorker,
translatorAvailable: instance.deeplAuthKey != null, translatorAvailable: instance.deeplAuthKey != null,
gifboxAvailable: instance.gifboxAuthKey != null,
pinnedPages: instance.pinnedPages, pinnedPages: instance.pinnedPages,
pinnedClipId: instance.pinnedClipId, pinnedClipId: instance.pinnedClipId,
cacheRemoteFiles: instance.cacheRemoteFiles, cacheRemoteFiles: instance.cacheRemoteFiles,
@ -471,6 +472,7 @@ export default define(meta, paramDef, async (ps, me) => {
objectStorageS3ForcePathStyle: instance.objectStorageS3ForcePathStyle, objectStorageS3ForcePathStyle: instance.objectStorageS3ForcePathStyle,
deeplAuthKey: instance.deeplAuthKey, deeplAuthKey: instance.deeplAuthKey,
deeplIsPro: instance.deeplIsPro, deeplIsPro: instance.deeplIsPro,
gifboxAuthKey: instance.gifboxAuthKey,
enableIpLogging: instance.enableIpLogging, enableIpLogging: instance.enableIpLogging,
enableActiveEmailValidation: instance.enableActiveEmailValidation, enableActiveEmailValidation: instance.enableActiveEmailValidation,
}; };

View File

@ -80,6 +80,7 @@ export const paramDef = {
summalyProxy: { type: 'string', nullable: true }, summalyProxy: { type: 'string', nullable: true },
deeplAuthKey: { type: 'string', nullable: true }, deeplAuthKey: { type: 'string', nullable: true },
deeplIsPro: { type: 'boolean' }, deeplIsPro: { type: 'boolean' },
gifboxAuthKey: { type: 'string', nullable: true },
enableTwitterIntegration: { type: 'boolean' }, enableTwitterIntegration: { type: 'boolean' },
twitterConsumerKey: { type: 'string', nullable: true }, twitterConsumerKey: { type: 'string', nullable: true },
twitterConsumerSecret: { 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; set.deeplIsPro = ps.deeplIsPro;
} }
if (ps.gifboxAuthKey !== undefined) {
if (ps.gifboxAuthKey === '') {
set.gifboxAuthKey = null;
} else {
set.gifboxAuthKey = ps.gifboxAuthKey;
}
}
if (ps.enableIpLogging !== undefined) { if (ps.enableIpLogging !== undefined) {
set.enableIpLogging = ps.enableIpLogging; set.enableIpLogging = ps.enableIpLogging;
} }

View File

@ -401,6 +401,7 @@ export default define(meta, paramDef, async (ps, me) => {
enableServiceWorker: instance.enableServiceWorker, enableServiceWorker: instance.enableServiceWorker,
translatorAvailable: instance.deeplAuthKey != null, translatorAvailable: instance.deeplAuthKey != null,
gifboxAvailable: instance.gifboxAuthKey != null,
...(ps.detail ? { ...(ps.detail ? {
pinnedPages: instance.privateMode && !me ? [] : instance.pinnedPages, pinnedPages: instance.privateMode && !me ? [] : instance.pinnedPages,

View File

@ -167,6 +167,15 @@
<template #label>Pro account</template> <template #label>Pro account</template>
</FormSwitch> </FormSwitch>
</FormSection> </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> </div>
</FormSuspense> </FormSuspense>
</MkSpacer> </MkSpacer>
@ -217,6 +226,7 @@ let swPublicKey: any = $ref(null);
let swPrivateKey: any = $ref(null); let swPrivateKey: any = $ref(null);
let deeplAuthKey: string = $ref(''); let deeplAuthKey: string = $ref('');
let deeplIsPro: boolean = $ref(false); let deeplIsPro: boolean = $ref(false);
let gifboxAuthKey: string = $ref('');
async function init() { async function init() {
const meta = await os.api('admin/meta'); const meta = await os.api('admin/meta');
@ -249,6 +259,7 @@ async function init() {
swPrivateKey = meta.swPrivateKey; swPrivateKey = meta.swPrivateKey;
deeplAuthKey = meta.deeplAuthKey; deeplAuthKey = meta.deeplAuthKey;
deeplIsPro = meta.deeplIsPro; deeplIsPro = meta.deeplIsPro;
gifboxAuthKey = meta.gifboxAuthKey;
} }
function save() { function save() {
@ -282,6 +293,7 @@ function save() {
swPrivateKey, swPrivateKey,
deeplAuthKey, deeplAuthKey,
deeplIsPro, deeplIsPro,
gifboxAuthKey,
}).then(() => { }).then(() => {
fetchInstance(); fetchInstance();
}); });

View File

@ -3840,6 +3840,7 @@ __metadata:
cypress: 10.11.0 cypress: 10.11.0
eslint: ^8.31.0 eslint: ^8.31.0
execa: 5.1.1 execa: 5.1.1
gifbox.js: ^0.9.0
gulp: 4.0.2 gulp: 4.0.2
gulp-cssnano: 2.1.3 gulp-cssnano: 2.1.3
gulp-rename: 2.0.0 gulp-rename: 2.0.0
@ -7395,6 +7396,16 @@ __metadata:
languageName: node languageName: node
linkType: hard 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": "github-from-package@npm:0.0.0":
version: 0.0.0 version: 0.0.0
resolution: "github-from-package@npm:0.0.0" resolution: "github-from-package@npm:0.0.0"