diff --git a/public/scripts/extensions/assets/confirm.html b/public/scripts/extensions/assets/confirm.html deleted file mode 100644 index 1dd52f26c..000000000 --- a/public/scripts/extensions/assets/confirm.html +++ /dev/null @@ -1,9 +0,0 @@ -
- Are you sure you want to connect to '{{url}}'? -
-
- -
diff --git a/public/scripts/extensions/assets/index.js b/public/scripts/extensions/assets/index.js index b266f5a8f..fd38c4264 100644 --- a/public/scripts/extensions/assets/index.js +++ b/public/scripts/extensions/assets/index.js @@ -5,7 +5,7 @@ TODO: import { getRequestHeaders, callPopup, processDroppedFiles, eventSource, event_types } from '../../../script.js'; import { deleteExtension, extensionNames, getContext, installExtension, renderExtensionTemplateAsync } from '../../extensions.js'; -import { POPUP_TYPE, callGenericPopup } from '../../popup.js'; +import { POPUP_TYPE, Popup, callGenericPopup } from '../../popup.js'; import { executeSlashCommands } from '../../slash-commands.js'; import { flashHighlight, getStringHash, isValidUrl } from '../../utils.js'; export { MODULE_NAME }; @@ -424,16 +424,18 @@ jQuery(async () => { const rememberKey = `Assets_SkipConfirm_${getStringHash(url)}`; const skipConfirm = localStorage.getItem(rememberKey) === 'true'; - const template = await renderExtensionTemplateAsync(MODULE_NAME, 'confirm', { url }); - const confirmation = skipConfirm || await callPopup(template, 'confirm'); + const confirmation = skipConfirm || await Popup.show.confirm('Loading Asset List', `Are you sure you want to connect to the following url?${url}`, { + customInputs: [{ id: 'assets-remember', label: 'Don\'t ask again for this URL' }], + onClose: popup => { + if (popup.result) { + const rememberValue = popup.inputResults.get('assets-remember'); + localStorage.setItem(rememberKey, String(rememberValue)); + } + }, + }); if (confirmation) { try { - if (!skipConfirm) { - const rememberValue = Boolean($('#assets-remember').prop('checked')); - localStorage.setItem(rememberKey, String(rememberValue)); - } - console.debug(DEBUG_PREFIX, 'Confimation, loading assets...'); downloadAssetsList(url); connectButton.removeClass('fa-plug-circle-exclamation');