Phase 1 of AGENTS.md §11: the app runs on .13 in its own container on port 8792, behind Caddy at school.lab.audasmedia.com.au, with its own session login and GET /health. - Go service (Go 1.25, modernc SQLite, no cgo) with its own image. - SQLite schema per AGENTS.md §7: children, items, scans, notifications, session (internal/store/migrations/001_init.sql). - Separate session login (signed cookie, CSRF double-submit), not SSO. - HTMX server-rendered shell using the Family Home Lab tokens.css: canvas #f6f5f4, action blue #0075de, Inter, 8px grid, hairline borders, pill CTAs, dark mode, phone-friendly. - Fail loudly (FR-12): a missing or failed scan shows as an explicit warning or error banner, never as an empty day. - Dockerfile + docker-compose.yml (own container, own port 8792; uses network_mode bridge because .13 has no free default Docker address pool). - Caddy snippet for .35 in deploy/caddy/, deployment notes, and deploy/verify-phase1.sh. No school scan in this phase; the Compass login and fetch are Phase 2. Co-Authored-By: Paperclip <noreply@paperclip.ing>
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
// Theme controller. The design tokens ship both palettes; nothing switches
|
|
// between them unless this runs. It follows the OS preference by default and
|
|
// remembers an explicit choice. Loaded with defer from /static/, so it is
|
|
// allowed by the page's `script-src 'self'` policy (no inline script).
|
|
(function () {
|
|
"use strict";
|
|
var KEY = "webrestrict.theme";
|
|
var root = document.documentElement;
|
|
var media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
var stored = null;
|
|
try {
|
|
stored = window.localStorage.getItem(KEY);
|
|
} catch (e) {
|
|
stored = null;
|
|
}
|
|
|
|
function apply() {
|
|
var theme = stored || (media.matches ? "dark" : "light");
|
|
root.setAttribute("data-theme", theme);
|
|
var buttons = document.querySelectorAll("[data-theme-toggle]");
|
|
for (var i = 0; i < buttons.length; i++) {
|
|
buttons[i].textContent = theme === "dark" ? "Light" : "Dark";
|
|
buttons[i].setAttribute(
|
|
"aria-label",
|
|
"Switch to " + (theme === "dark" ? "light" : "dark") + " theme"
|
|
);
|
|
}
|
|
}
|
|
|
|
document.addEventListener("click", function (event) {
|
|
var target = event.target && event.target.closest
|
|
? event.target.closest("[data-theme-toggle]")
|
|
: null;
|
|
if (!target) {
|
|
return;
|
|
}
|
|
stored = root.getAttribute("data-theme") === "dark" ? "light" : "dark";
|
|
try {
|
|
window.localStorage.setItem(KEY, stored);
|
|
} catch (e) {
|
|
/* private mode: the choice just does not persist */
|
|
}
|
|
apply();
|
|
});
|
|
|
|
if (media.addEventListener) {
|
|
media.addEventListener("change", function () {
|
|
if (!stored) {
|
|
apply();
|
|
}
|
|
});
|
|
}
|
|
|
|
apply();
|
|
})();
|