Compare commits

...

4 Commits

Author SHA1 Message Date
ThatOneCalculator 1a6266a7b0
Merge branch 'develop' into feature/gifbox 2023-01-12 21:13:29 -08:00
ThatOneCalculator 85140d8a97
gifbox migration 2023-01-08 11:34:37 -08:00
ThatOneCalculator 7ccab999a4
start on endpoints 2023-01-04 10:36:51 -08:00
ThatOneCalculator e7de8c154a
feat: initial gifbox integration 2023-01-04 09:53:44 -08:00
14 changed files with 93 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

@ -41,6 +41,7 @@
"@tensorflow/tfjs": "^3.21.0", "@tensorflow/tfjs": "^3.21.0",
"calckey-js": "^0.0.20", "calckey-js": "^0.0.20",
"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 "gifboxAuthKey" character varying(128)`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "gifboxAuthKey"`);
}
}

View File

@ -60,6 +60,7 @@
"feed": "4.2.2", "feed": "4.2.2",
"file-type": "17.1.6", "file-type": "17.1.6",
"fluent-ffmpeg": "2.1.2", "fluent-ffmpeg": "2.1.2",
"gifbox.js": "^0.9.0",
"got": "12.5.3", "got": "12.5.3",
"hpagent": "0.1.2", "hpagent": "0.1.2",
"ioredis": "5.2.4", "ioredis": "5.2.4",

View File

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

View File

@ -386,6 +386,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

@ -96,6 +96,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

@ -508,6 +508,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,
@ -559,6 +560,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

@ -124,6 +124,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 },
@ -511,6 +512,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

@ -0,0 +1,26 @@
import { Client } from 'gifbox.js';
import config from '@/config/index.js';
import define from '../../define.js';
const gbClient = new Client();
export const meta = {
tags: ['gifbox'],
requireCredential: false,
requireCredentialPrivateMode: false,
errors: {
noSuchNote: {
message: 'Problem with GifBox.',
code: 'GIFBOX_ERROR',
id: 'bea9b03f-36e0-49c5-a4db-638a029f8971',
},
},
} as const;
export const paramDef = {
type: 'object',
properties: {},
required: [],
} as const;

View File

@ -479,6 +479,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,
defaultReaction: instance.defaultReaction, defaultReaction: instance.defaultReaction,
...(ps.detail ...(ps.detail

View File

@ -185,6 +185,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>
@ -236,6 +245,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('');
let defaultReaction: string = $ref(''); let defaultReaction: string = $ref('');
let defaultReactionCustom: string = $ref(''); let defaultReactionCustom: string = $ref('');
@ -270,6 +280,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;
defaultReaction = ['⭐', '👍', '❤️'].includes(meta.defaultReaction) ? meta.defaultReaction : 'custom'; defaultReaction = ['⭐', '👍', '❤️'].includes(meta.defaultReaction) ? meta.defaultReaction : 'custom';
defaultReactionCustom = ['⭐', '👍', '❤️'].includes(meta.defaultReaction) ? '' : meta.defaultReaction; defaultReactionCustom = ['⭐', '👍', '❤️'].includes(meta.defaultReaction) ? '' : meta.defaultReaction;
} }
@ -308,6 +319,7 @@ function save() {
swPrivateKey, swPrivateKey,
deeplAuthKey, deeplAuthKey,
deeplIsPro, deeplIsPro,
gifboxAuthKey,
defaultReaction, defaultReaction,
}).then(() => { }).then(() => {
fetchInstance(); fetchInstance();

View File

@ -17,6 +17,7 @@ importers:
cross-env: 7.0.3 cross-env: 7.0.3
cypress: 10.11.0 cypress: 10.11.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
@ -36,6 +37,7 @@ importers:
'@tensorflow/tfjs': 3.21.0_seedrandom@3.0.5 '@tensorflow/tfjs': 3.21.0_seedrandom@3.0.5
calckey-js: 0.0.20 calckey-js: 0.0.20
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
@ -142,6 +144,7 @@ importers:
feed: 4.2.2 feed: 4.2.2
file-type: 17.1.6 file-type: 17.1.6
fluent-ffmpeg: 2.1.2 fluent-ffmpeg: 2.1.2
gifbox.js: ^0.9.0
got: 12.5.3 got: 12.5.3
hpagent: 0.1.2 hpagent: 0.1.2
ioredis: 5.2.4 ioredis: 5.2.4
@ -257,6 +260,7 @@ importers:
feed: 4.2.2 feed: 4.2.2
file-type: 17.1.6 file-type: 17.1.6
fluent-ffmpeg: 2.1.2 fluent-ffmpeg: 2.1.2
gifbox.js: 0.9.0
got: 12.5.3 got: 12.5.3
hpagent: 0.1.2 hpagent: 0.1.2
ioredis: 5.2.4 ioredis: 5.2.4
@ -6679,6 +6683,15 @@ packages:
readable-stream: 1.1.14 readable-stream: 1.1.14
dev: false dev: false
/gifbox.js/0.9.0:
resolution: {integrity: sha512-OrsEga4yXQ/eZE+XZGPproj8vYoAi5+hLjCZqM0uawy6Sk7zC31dzhAY8PgmuPl4sIz5IuyTxgYZXIpUKhK7nQ==}
dependencies:
axios: 0.24.0
form-data: 4.0.0
transitivePeerDependencies:
- debug
dev: false
/github-from-package/0.0.0: /github-from-package/0.0.0:
resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==}
dev: false dev: false