feat(admin): gate the backoffice behind a name and password

- ui/auth.js: name/password check, session kept in sessionStorage (new tab asks again),
  5 wrong attempts lock the form for 30s
- admin view renders a login card until authenticated; adds an explicit logout button
- SW precache includes auth.js, version bumped to 2026.11.19.3 (meta + sw.js in sync)
- docs: AGENTS.md notes the gate is client-side; real protection is the server ADMIN_TOKEN
This commit is contained in:
Bkk1234 committed 2026-11-19 11:28:20 +07:00
1 parent 79b147d38f
commit cd5cb5dd08
6 files changed
+208 -3

No files matched your search

+2 -1
View File
@@ -2,7 +2,7 @@
กติกา: bump VERSION เฉพาะเมื่อแก้ไฟล์นี้หรือรายการ PRECACHE
เนื้อหา (HTML/CSS/JS/JSON) ใช้ network-first จึงไม่ต้อง bump */
const VERSION = "2026.11.19.2";
const VERSION = "2026.11.19.3";
const CACHE = `hobbypj-${VERSION}`;
const PRECACHE = [
@@ -17,6 +17,7 @@ const PRECACHE = [
"./ui/router.js",
"./ui/ui.js",
"./ui/data.js",
"./ui/auth.js",
"./ui/pwa.js",
"./ui/motion.js",
"./ui/views/home.js",