diff --git a/app.js b/app.js index 5ddc802..ac39536 100644 --- a/app.js +++ b/app.js @@ -41,6 +41,9 @@ import { createProcessesView } from './ui/processes.js' import { createDataManager } from './ui/data-manager.js' import { formatMib, formatKilobitsPerSec } from './shared/format.js' import { chartOptionLabel } from './shared/container-names.js' +import { initConfirmModal, appConfirm } from './ui/confirm-modal.js' + +initConfirmModal() const $ = (id) => document.getElementById(id) @@ -924,7 +927,15 @@ function loadFleetView() { }, onForget: async (peer) => { const label = peer.alias || peer.id.slice(0, 12) - if (!confirm(`Forget ${label}?`)) return + const ok = await appConfirm({ + title: 'Forget agent', + message: `Remove “${label}” from saved agents?`, + detail: 'You can reconnect later with an invite or public key.', + confirmLabel: 'Forget', + danger: true, + icon: '⊘', + }) + if (!ok) return removeBookmark(peer.publicKeyHex) await manager.disconnect(peer.publicKeyHex).catch(() => {}) log(`Forgot ${label}`) @@ -1601,7 +1612,15 @@ els.settingQvacIdle?.addEventListener('change', () => { els.btnQvacOpen?.addEventListener('click', () => showView('qvac')) els.btnResetPeers?.addEventListener('click', async () => { - if (!confirm('Forget all saved agents and disconnect?')) return + const ok = await appConfirm({ + title: 'Forget all agents', + message: 'Disconnect and clear every saved agent from this device?', + detail: 'Bookmarks, peer cache, and active sessions will be removed. Invites will be required to reconnect.', + confirmLabel: 'Forget all', + danger: true, + icon: '⊘', + }) + if (!ok) return await manager.disconnectAll({ forget: true }) const { savePeers } = await import('./client/peerCache.js') savePeers({}, { activePeerId: null, force: true }) diff --git a/index.html b/index.html index 75eb815..c0d0262 100644 --- a/index.html +++ b/index.html @@ -21,6 +21,7 @@ +