Ask in the page's own dialog, not confirm(), which the iOS app answered Cancel (#462)

Deleting a downloaded file from the iOS app did nothing: no DELETE reached ipx-web or ipx.
WKWebView answers confirm() Cancel without showing it unless the app implements the panel,
which 614f270 does (#453), but only once the app is rebuilt. ask() is a <dialog> of the
page's own, in the top layer, so it opens over a dialog already up (the file menu, Settings)
and leaves it as it was, and Escape answers it alone. Every confirm() in the page and the
admin page goes through it; the tests answer it rather than the browser's dialog, and the
warning before sharing a feed with its key in the address, untested before, now is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 23:32:15 +00:00
parent d1ba83bb7a
commit eda77e87c7
9 changed files with 77 additions and 36 deletions

View File

@@ -191,7 +191,7 @@ async function drawDirectoryAdmin(){
try{
if(b.dataset.a === 'drop'){
const name = row!.dataset.name!;
if(!confirm(`Drop ${name}'s feeds and counts from the directory? They come back the next time ${name} shares.`)) return;
if(!await ask(`Drop ${name}'s feeds and counts from the directory? They come back the next time ${name} shares.`, 'Drop')) return;
await api(`/api/directory-instances/${encodeURIComponent(name)}`, {method: 'DELETE'});
toast(`Dropped ${name}'s snapshot`);
}else if(b.dataset.a === 'unblock'){
@@ -235,8 +235,8 @@ async function drawAccounts(){
const u = users.find(x => String(x.id) === row.dataset.id)!;
$('[data-a="admin"]', row).onchange = (e: Event) =>
change(u, {method: 'PATCH', body: JSON.stringify({admin: (e.target as HTMLInputElement).checked})});
$('[data-a="rm"]', row).onclick = () => {
if(confirm(`Remove ${u.name}? Their subscriptions and read state go with them. Downloaded files stay.`))
$('[data-a="rm"]', row).onclick = async () => {
if(await ask(`Remove ${u.name}? Their subscriptions and read state go with them. Downloaded files stay.`, 'Remove'))
change(u, {method: 'DELETE'});
};
}