update lots of reader fixes

This commit is contained in:
2026-07-23 00:15:21 -07:00
parent 88aaab2e00
commit c6b95e23c7
10 changed files with 510 additions and 150 deletions
+16 -8
View File
@@ -133,18 +133,26 @@
: undefined;
}
async function fetchJson(path) {
async function fetchJson(path, { timeoutMs = 30000 } = {}) {
if (!path) {
throw new Error("API connection is not configured.");
}
const response = await fetch(path, {
headers: buildRequestHeaders()
});
if (!response.ok) {
throw new Error(`Failed to load ${path} (${response.status})`);
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
try {
const response = await fetch(path, {
headers: buildRequestHeaders(),
signal: controller.signal
});
if (!response.ok) {
throw new Error(`Failed to load ${path} (${response.status})`);
}
return response.json();
} finally {
clearTimeout(timeoutId);
}
return response.json();
}
function buildObjectPath(target, pathParts, value) {
@@ -240,7 +248,7 @@
}
const activeSection = String(window.TarotSectionStateUi?.getActiveSection?.() || "home").trim();
return activeSection === "home";
return activeSection === "home" || activeSection === "sky";
}
function toApiAssetUrl(assetPath) {