Add modal support to plugin add dialog (#7432)

Enhanced the addPluginDlg function to use showModal when available, improving compatibility with different UI templates. Falls back to setDialogMode for environments without showModal.
This commit is contained in:
TheDevRyan
2025-11-17 10:34:15 +00:00
committed by GitHub
parent dd010f03e5
commit 208ddddf53

View File

@@ -115,8 +115,15 @@ module.exports.pluginHandler = function (parent) {
meshserver.send({ action: 'addplugin', url: Q('pluginurlinput').value}); meshserver.send({ action: 'addplugin', url: Q('pluginurlinput').value});
}; };
obj.addPluginDlg = function() { obj.addPluginDlg = function() {
if (typeof showModal === 'function') {
setDialogMode(2, "Plugin Download URL", 3, obj.addPluginEx, '<p><b>WARNING:</b> Downloading plugins may compromise server security. Only download from trusted sources.</p><input type=text id=pluginurlinput style=width:100% placeholder="https://" />');
showModal('xxAddAgentModal', 'idx_dlgOkButton', obj.addPluginEx);
focusTextBox('pluginurlinput');
} else {
// Fallback to setDialogMode for default.handlebars
setDialogMode(2, "Plugin Download URL", 3, obj.addPluginEx, '<p><b>WARNING:</b> Downloading plugins may compromise server security. Only download from trusted sources.</p><input type=text id=pluginurlinput style=width:100% placeholder="https://" />'); setDialogMode(2, "Plugin Download URL", 3, obj.addPluginEx, '<p><b>WARNING:</b> Downloading plugins may compromise server security. Only download from trusted sources.</p><input type=text id=pluginurlinput style=width:100% placeholder="https://" />');
focusTextBox('pluginurlinput'); focusTextBox('pluginurlinput');
}
}; };
obj.refreshPluginHandler = function() { obj.refreshPluginHandler = function() {
let st = document.createElement('script'); let st = document.createElement('script');