Fix proxy settings modal never saving — wrong third arg to Nova.modal

Nova.modal(title, bodyHtml, footerHtml) expects footerHtml as an HTML
string, but an async callback was passed instead. The function got
stringified as garbage text in the footer with no save button, so
nothing ever saved regardless of mode chosen.

Replaced with proper footer HTML (Cancel + Save buttons) and wired the
save logic as an event listener on the save button.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 11:12:29 +00:00
parent 98f6a0700c
commit db1f6b8bb8
+9 -2
View File
@@ -3054,7 +3054,13 @@ window.proxySettings = async () => {
<span id="ps-test-result" style="margin-left:0.75rem;font-size:0.85rem"></span> <span id="ps-test-result" style="margin-left:0.75rem;font-size:0.85rem"></span>
</div> </div>
</div> </div>
`, async () => { `,
`<button class="btn btn-ghost" onclick="this.closest('.modal-overlay').remove()">Cancel</button>
<button class="btn btn-primary" id="ps-save-btn">Save Settings</button>`
);
ov.querySelector('#ps-save-btn').addEventListener('click', async () => {
const btn = ov.querySelector('#ps-save-btn');
btn.disabled = true; btn.textContent = 'Saving…';
const mode = document.getElementById('ps-mode')?.value; const mode = document.getElementById('ps-mode')?.value;
const pass = document.getElementById('ps-pass')?.value; const pass = document.getElementById('ps-pass')?.value;
const body = { const body = {
@@ -3066,7 +3072,8 @@ window.proxySettings = async () => {
}; };
const r = await Nova.api('proxy', 'settings', { method: 'POST', body }); const r = await Nova.api('proxy', 'settings', { method: 'POST', body });
Nova.toast(r?.success ? 'Settings saved' : (r?.message || 'Failed'), r?.success ? 'success' : 'error'); Nova.toast(r?.success ? 'Settings saved' : (r?.message || 'Failed'), r?.success ? 'success' : 'error');
if (r?.success) Nova.loadPage('nginx-proxy', window._novaPages); if (r?.success) { ov.remove(); Nova.loadPage('nginx-proxy', window._novaPages); }
else { btn.disabled = false; btn.textContent = 'Save Settings'; }
}); });
}; };