Make every URL the console page uses page-relative, guarded by a source test

AI Assisted
This commit is contained in:
Seth committed 2026-12-05 00:10:44 -08:00
1 parent 4ced32be5c
commit 1d007737b1
47 files changed
+401 -202

No files matched your search

+10 -10
View File
@@ -387,7 +387,7 @@ function maybeWake() {
page.wake = { cards: false, entered: false, typed: 0, timers: [], abort: new AbortController() };
wakeHoldsChime = !matchMedia("(prefers-reduced-motion: reduce)").matches;
if (wakeHoldsChime && soundOn("snore")) {
snore = new Audio("/sleeping.mp3");
snore = new Audio("sleeping.mp3");
snore.loop = true;
snore.play().catch(() => {});
}
@@ -709,7 +709,7 @@ async function pickUpHandoff(h) {
page.launchScoping = true;
await hooks.syncWorkspaceScope(h.spec || "");
try {
const res = await fetch("/submit", {
const res = await fetch("submit", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ actions: [pickupAction(h)], reply: pickupReply(h) }),
@@ -741,7 +741,7 @@ async function readHandoff(h) {
body.replaceChildren(el("p", "md-p", "Reading…"));
$("handoff-modal").showModal();
try {
const res = await fetch("/handoff?id=" + encodeURIComponent(h.id), { cache: "no-store" });
const res = await fetch("handoff?id=" + encodeURIComponent(h.id), { cache: "no-store" });
if (res.status !== 200) throw new Error(String(res.status));
mdInto(body, await res.text());
} catch {
@@ -836,14 +836,14 @@ export function pendingNotePick(entry) {
// grayed, so each must be read). Read only: GET /notepad never writes.
async function readNoteTabs(state) {
try {
const res = await fetch("/notepad", { cache: "no-store" });
const res = await fetch("notepad", { cache: "no-store" });
if (!res.ok) throw new Error(String(res.status));
const body = await res.json();
const tabs = Array.isArray(body.tabs) ? body.tabs : [];
const read = await Promise.all(
tabs.map(async (t) => {
try {
const r = await fetch("/notepad?tab=" + encodeURIComponent(t.id), { cache: "no-store" });
const r = await fetch("notepad?tab=" + encodeURIComponent(t.id), { cache: "no-store" });
if (!r.ok) return null;
const b = await r.json();
return b && b.tab ? { text: typeof b.tab.text === "string" ? b.tab.text : "", images: Array.isArray(b.tab.images) ? b.tab.images : [] } : null;
@@ -1243,7 +1243,7 @@ export async function launchSkill(entry) {
page.launchScoping = true;
await hooks.syncWorkspaceScope(target ? target.dir : "");
try {
const res = await fetch("/submit", {
const res = await fetch("submit", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
@@ -1390,7 +1390,7 @@ async function sendDeleteHandoff(h) {
const go = $("delete-go");
go.disabled = true;
try {
const res = await fetch("/submit", {
const res = await fetch("submit", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ actions: [deleteHandoffAction(h)], reply: deleteHandoffReply(h) }),
@@ -1422,7 +1422,7 @@ async function sendDelete(spec) {
const go = $("delete-go");
go.disabled = true;
try {
const res = await fetch("/submit", {
const res = await fetch("submit", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ actions: [deleteAction(spec)], reply: deleteReply(spec) }),
@@ -1512,7 +1512,7 @@ function learningBanner(sc) {
// quiet: the nudge simply stays, as it did before.
async function quietTidyNudge() {
try {
await postJson("/learning/tidy-quiet", {});
await postJson("learning/tidy-quiet", {});
} catch {}
redraw();
}
@@ -1582,7 +1582,7 @@ export async function sendLearning(what) {
if (what === "review" || what === "tidy") watchLearningBusy(busy);
}
try {
const res = await fetch("/submit", {
const res = await fetch("submit", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ actions: [learningAction(what)], reply: learningReply(what) }),