add configurable timeout for note translations
This commit is contained in:
parent
00cfeca3d7
commit
e7ee2cc398
9 changed files with 66 additions and 3 deletions
|
|
@ -8,6 +8,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div class="_spacer" style="--MI_SPACER-w: 700px; --MI_SPACER-min: 16px; --MI_SPACER-max: 32px;">
|
||||
<FormSuspense :p="init">
|
||||
<div class="_gaps_m">
|
||||
<MkInput v-model="translationTimeout" type="number" debounce>
|
||||
<template #label>{{ i18n.ts.translationTimeoutLabel }}</template>
|
||||
<template #caption>{{ i18n.ts.translationTimeoutCaption }}</template>
|
||||
</MkInput>
|
||||
|
||||
<MkFolder>
|
||||
<template #label>DeepL Translation</template>
|
||||
|
||||
|
|
@ -57,7 +62,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
|
|
@ -69,6 +74,7 @@ import { i18n } from '@/i18n.js';
|
|||
import { definePage } from '@/page.js';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
|
||||
const translationTimeout = ref(0);
|
||||
const deeplAuthKey = ref<string | null>('');
|
||||
const deeplIsPro = ref<boolean>(false);
|
||||
const deeplFreeMode = ref<boolean>(false);
|
||||
|
|
@ -78,12 +84,20 @@ const libreTranslateKey = ref<string | null>('');
|
|||
|
||||
async function init() {
|
||||
const meta = await misskeyApi('admin/meta');
|
||||
translationTimeout.value = meta.translationTimeout;
|
||||
deeplAuthKey.value = meta.deeplAuthKey;
|
||||
deeplIsPro.value = meta.deeplIsPro;
|
||||
deeplFreeMode.value = meta.deeplFreeMode;
|
||||
deeplFreeInstance.value = meta.deeplFreeInstance;
|
||||
libreTranslateURL.value = meta.libreTranslateURL;
|
||||
libreTranslateKey.value = meta.libreTranslateKey;
|
||||
|
||||
watch(translationTimeout, async newValue => {
|
||||
await os.apiWithDialog('admin/update-meta', {
|
||||
translationTimeout: newValue,
|
||||
});
|
||||
await os.promiseDialog(fetchInstance(true));
|
||||
});
|
||||
}
|
||||
|
||||
function save_deepl() {
|
||||
|
|
@ -93,7 +107,7 @@ function save_deepl() {
|
|||
deeplFreeMode: deeplFreeMode.value,
|
||||
deeplFreeInstance: deeplFreeInstance.value,
|
||||
}).then(() => {
|
||||
fetchInstance(true);
|
||||
os.promiseDialog(fetchInstance(true));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +116,7 @@ function save_libre() {
|
|||
libreTranslateURL: libreTranslateURL.value,
|
||||
libreTranslateKey: libreTranslateKey.value,
|
||||
}).then(() => {
|
||||
fetchInstance(true);
|
||||
os.promiseDialog(fetchInstance(true));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue