mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 08:15:41 -08:00
Make every URL the console page uses page-relative, guarded by a source test
AI Assisted
This commit is contained in:
1 parent
4ced32be5c
commit
1d007737b1
47 files changed
+401
-202
No files matched your search
@@ -342,7 +342,7 @@ export function specFileTabs() {
|
||||
|
||||
async function fetchSpecFile(spec, kind) {
|
||||
try {
|
||||
const res = await fetch("/overview?spec=" + encodeURIComponent(spec) + "&file=" + kind, { cache: "no-store" });
|
||||
const res = await fetch("overview?spec=" + encodeURIComponent(spec) + "&file=" + kind, { cache: "no-store" });
|
||||
if (res.status !== 200) return null;
|
||||
const file = decodeURIComponent(res.headers.get("x-spec-file") || "") || kind;
|
||||
return { file, text: await res.text() };
|
||||
@@ -382,7 +382,7 @@ export const prototypesTabShown = () => page.prototypes.key === overviewSpec() &
|
||||
|
||||
async function fetchPrototypeList(spec) {
|
||||
try {
|
||||
const res = await fetch("/prototypes?spec=" + encodeURIComponent(spec), { cache: "no-store" });
|
||||
const res = await fetch("prototypes?spec=" + encodeURIComponent(spec), { cache: "no-store" });
|
||||
if (res.status !== 200) return [];
|
||||
const body = await res.json();
|
||||
return Array.isArray(body.files) ? body.files : [];
|
||||
@@ -393,7 +393,7 @@ async function fetchPrototypeList(spec) {
|
||||
|
||||
async function fetchPrototypeDoc(spec, name) {
|
||||
try {
|
||||
const res = await fetch("/prototype?spec=" + encodeURIComponent(spec) + "&name=" + encodeURIComponent(name), { cache: "no-store" });
|
||||
const res = await fetch("prototype?spec=" + encodeURIComponent(spec) + "&name=" + encodeURIComponent(name), { cache: "no-store" });
|
||||
return res.status === 200 ? await res.text() : null;
|
||||
} catch {
|
||||
return null;
|
||||
@@ -437,7 +437,7 @@ export async function loadSpecCarry() {
|
||||
if (specCarryAsked || !isDashboard() || !scan() || page.local.specSel !== undefined) return;
|
||||
specCarryAsked = true;
|
||||
try {
|
||||
const res = await fetch("/spec-carry", { method: "POST", cache: "no-store" });
|
||||
const res = await fetch("spec-carry", { method: "POST", cache: "no-store" });
|
||||
const { spec } = res.status === 200 ? await res.json() : {};
|
||||
if (!spec || page.local.specSel !== undefined || !specList().some((s) => s.dir === spec)) return;
|
||||
page.local.specSel = spec;
|
||||
@@ -458,7 +458,7 @@ export const agentsTabShown = () => isDashboard() && typeof page.agentsDoc.texts
|
||||
// keep its text; null when it is not there. Off the dashboard nothing is read.
|
||||
async function fetchAgentsDoc(rel) {
|
||||
try {
|
||||
const res = await fetch("/agents-doc?file=" + encodeURIComponent(rel), { cache: "no-store" });
|
||||
const res = await fetch("agents-doc?file=" + encodeURIComponent(rel), { cache: "no-store" });
|
||||
return res.status === 200 ? await res.text() : null;
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user