Files
ferrum/docs/demo/theme-init.js
T
Anand 4ae41a6f1d Add public docs/demo site, fix logout getting stuck on loading
- docs/: GitHub Pages site (landing page, docs, live click-through demo)
  served straight from /docs, no build step.
- web-demo/: source for the demo (a copy of web/ with its API layer mocked
  in-memory) — see web-demo/README.md to rebuild docs/demo after a change.
- web/src/lib/auth.tsx: signOut() no longer clears the whole query cache;
  wiping ["auth","setup-status"] forced it to refetch and re-armed
  `loading`, stranding the user on a loading/failed screen instead of the
  Login page. Only non-auth queries are dropped now.
- .gitignore: exclude web-demo/node_modules and web-demo/dist (build output,
  already published as docs/demo).
- Drop PRODUCT.md (internal planning brief, not meant for the public repo).
- README: link the new docs/demo site.
2026-09-12 15:22:55 +05:30

18 lines
899 B
JavaScript

// Runs before first paint so returning dark-mode users never see a light
// flash. Kept as an external file so the CSP (script-src 'self') stays
// free of inline-script allowances.
(function () {
try {
var stored = localStorage.getItem("ferrum-theme");
var dark = stored === "dark" || (stored !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);
if (dark) document.documentElement.classList.add("dark");
var look = localStorage.getItem("ferrum-look");
var knownLooks = ["proxmox", "terminal", "glassFlightDeck", "midnight", "paper"];
if (knownLooks.indexOf(look) !== -1) document.documentElement.dataset.look = look;
var meta = document.querySelector('meta[name="theme-color"]');
if (meta) meta.setAttribute("content", dark ? "#121417" : "#ffffff");
} catch {
/* no storage / no matchMedia — default light theme applies */
}
})();