Update index.js

This commit is contained in:
berbant 2024-02-22 23:49:47 +04:00 committed by GitHub
parent c9f0d61f19
commit eb89337f51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -598,13 +598,18 @@ jQuery(() => {
'deeplx': 'http://127.0.0.1:1188/translate',
};
const popupText = `<h3>${optionText} API URL</h3><i>Example: <tt>${String(exampleURLs[extension_settings.translate.provider])}</tt></i>`;
const url = await callPopup(popupText, 'input');
const provider_name = extension_settings.translate.provider + '_url'
const saved_url = ( Boolean(secret_state[provider_name]) ) ? await findSecret(provider_name) : '';
const url = await callPopup(popupText, 'input', saved_url);
if (url == false) {
return;
}
await writeSecret(provider_name, url);
await writeSecret(extension_settings.translate.provider + '_url', url);
toastr.success('API URL saved');
$('#translate_url_button').addClass('success');
});