diff --git a/js-dialog.html b/js-dialog.html index c85d6dd2..beb6d700 100644 --- a/js-dialog.html +++ b/js-dialog.html @@ -1,86 +1,121 @@ - - - - -Dialog - - - - - - + + + + +Dialog + + + + + + diff --git a/main.js b/main.js index c7b574bf..b9ecc095 100644 --- a/main.js +++ b/main.js @@ -4407,9 +4407,15 @@ function jsDialogWho(sender, tab) { } } catch {} } - if (tab && (tab.settings || (tab.prov && tab.prov.kind === "home"))) return { label: "Theseus", kind: "app" }; - // file: outside a tab is one of Theseus's own views; inside a tab it is a local file the user opened. - if (/^file:/i.test(u)) return tab ? { label: "This page", kind: "site" } : { label: "Theseus", kind: "app" }; + // Theseus's own pages: every non-tab view, and the tabs that show our own + // files (home, settings). Decided from the URL — a tab's prov lags a + // navigation, so a tab that just left the home page would still read as + // "home". Any other file: in a tab is a local file the user opened. + if (/^file:/i.test(u)) { + if (!tab) return { label: "Theseus", kind: "app" }; + const own = (() => { try { return u.startsWith(url.pathToFileURL(__dirname).href); } catch { return false; } })(); + return own || tab.settings ? { label: "Theseus", kind: "app" } : { label: "This page", kind: "site" }; + } try { const p = new URL(u.replace(/^bns:\/\//i, "https://")); if (p.host) return { label: p.host, kind: "site" }; } catch {} return { label: "This page", kind: "site" }; }