add: DeepLX-JS support

Closes #324
This commit is contained in:
Marie 2024-01-26 21:29:38 +01:00
parent e5c060eecf
commit c6e3ec07d1
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
7 changed files with 103 additions and 14 deletions

View file

@ -19,6 +19,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="deeplIsPro">
<template #label>Pro account</template>
</MkSwitch>
<MkSwitch v-model="deeplFreeMode">
<template #label>Use DeepLX-JS (No Auth Key)</template>
</MkSwitch>
<MkInput v-if="deeplFreeMode" v-model="deeplFreeInstance" :placeholder="'example.com/translate'">
<template #prefix>https://</template>
<template #label>DeepLX-JS URL</template>
</MkInput>
</div>
</FormSection>
</FormSuspense>
@ -49,17 +56,23 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
const deeplAuthKey = ref<string>('');
const deeplIsPro = ref<boolean>(false);
const deeplFreeMode = ref<boolean>(false);
const deeplFreeInstance = ref<string>('');
async function init() {
const meta = await misskeyApi('admin/meta');
deeplAuthKey.value = meta.deeplAuthKey;
deeplIsPro.value = meta.deeplIsPro;
deeplFreeMode.value = meta.deeplFreeMode;
deeplFreeInstance.value = meta.deeplFreeInstance;
}
function save() {
os.apiWithDialog('admin/update-meta', {
deeplAuthKey: deeplAuthKey.value,
deeplIsPro: deeplIsPro.value,
deeplFreeMode: deeplFreeMode.value,
deeplFreeInstance: deeplFreeInstance.value,
}).then(() => {
fetchInstance();
});