fix: translator settings on admin/meta endpoint

This commit is contained in:
Johann150 2022-11-20 10:37:50 +01:00
parent cfe0f3ca67
commit aefb11959f
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -1,5 +1,6 @@
import config from '@/config/index.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { TranslationService } from '@/models/entities/meta.js';
import { translatorAvailable } from '../../common/translator.js';
import define from '../../define.js';
@ -270,6 +271,27 @@ export const meta = {
type: 'boolean',
optional: true, nullable: false,
},
translatorService: {
type: 'string',
enum: [null, ...Object.values(TranslationService)],
optional: false, nullable: true,
},
deeplAuthKey: {
type: 'string',
optional: true, nullable: true,
},
deeplIsPro: {
type: 'boolean',
optional: true, nullable: false,
},
libreTranslateEndpoint: {
type: 'string',
optional: true, nullable: true,
},
libreTranslateAuthKey: {
type: 'string',
optional: true, nullable: true,
},
},
},
} as const;
@ -318,7 +340,6 @@ export default define(meta, paramDef, async (ps, me) => {
enableGithubIntegration: instance.enableGithubIntegration,
enableDiscordIntegration: instance.enableDiscordIntegration,
enableServiceWorker: instance.enableServiceWorker,
translatorAvailable: translatorAvailable(instance),
pinnedPages: instance.pinnedPages,
pinnedClipId: instance.pinnedClipId,
cacheRemoteFiles: instance.cacheRemoteFiles,
@ -357,7 +378,12 @@ export default define(meta, paramDef, async (ps, me) => {
objectStorageUseProxy: instance.objectStorageUseProxy,
objectStorageSetPublicRead: instance.objectStorageSetPublicRead,
objectStorageS3ForcePathStyle: instance.objectStorageS3ForcePathStyle,
translatorAvailable: translatorAvailable(instance),
translationService: instance.translationService,
deeplAuthKey: instance.deeplAuthKey,
deeplIsPro: instance.deeplIsPro,
libreTranslateEndpoint: instance.libreTranslateEndpoint,
libreTranslateAuthKey: instance.libreTranslateAuthKey,
};
});