mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add buttons to remove SD/translate secrets
This commit is contained in:
@ -10,7 +10,7 @@ import {
|
||||
updateMessageBlock,
|
||||
} from '../../../script.js';
|
||||
import { extension_settings, getContext, renderExtensionTemplateAsync } from '../../extensions.js';
|
||||
import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||
import { POPUP_RESULT, POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||
import { findSecret, secret_state, writeSecret } from '../../secrets.js';
|
||||
import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||
@ -621,7 +621,18 @@ jQuery(async () => {
|
||||
const secretKey = extension_settings.translate.provider + '_url';
|
||||
const savedUrl = secret_state[secretKey] ? await findSecret(secretKey) : '';
|
||||
|
||||
const url = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedUrl);
|
||||
const url = await callGenericPopup(popupText, POPUP_TYPE.INPUT, savedUrl,{
|
||||
customButtons: [{
|
||||
text: 'Remove URL',
|
||||
appendAtEnd: true,
|
||||
result: POPUP_RESULT.NEGATIVE,
|
||||
action: async () => {
|
||||
await writeSecret(secretKey, '');
|
||||
toastr.success('API URL removed');
|
||||
$('#translate_url_button').toggleClass('success', !!secret_state[secretKey]);
|
||||
},
|
||||
}],
|
||||
});
|
||||
|
||||
if (url == false || url == '') {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user