Files
hobbypj-contents/index.html
T
Bkk1234 634dc3ae3c feat(pwa): harden the auto-update chain and add a version tool
- ui/pwa.js: register with updateViaCache:'none', check for updates on load, every
  30 min, on tab focus and on 'online'; controllerchange reloads the page itself but
  waits while the user is typing in a form (admin edits survive), retrying on blur/hide
- sw.js: precache the maskable icon; bump VERSION -> 2026.11.24.2
- scripts/bump-version.mjs: bump sw.js VERSION + <meta app-version> together, --check
  fails on drift; wired into
> [email protected] check
> node --check ui/app.js && node --check ui/data.js && node --check ui/router.js && node --check ui/ui.js && node --check ui/pwa.js && node --check ui/views/home.js && node --check ui/views/admin.js && node --check sw.js && node --check server/publish.mjs && node --check server/db.mjs && node --check scripts/bump-version.mjs && node scripts/bump-version.mjs --check

[version] ตรงกันที่ 2026.11.24.2, exposed as
> [email protected] version
> node scripts/bump-version.mjs

[version] ตั้งเป็น 2026.11.24.3 แล้ว (sw.js + index.html)
- README/AGENTS: document the PWA behaviour and the bump workflow

Verified in Chrome: SPA route changes keep timeOrigin and navigation count at 1 (no
reload), a simulated deploy (version bump -> reg.update) replaced the cache from
hobbypj-2026.11.24.1 to .2 with the old cache deleted and the page reloading by
itself, Page.getAppManifest errors: [], and with the network emulated offline the
shell + 6 cards still render while an uncached file fails.
2026-11-24 14:52:50 +07:00

84 lines
4.0 KiB
HTML

<!doctype html>
<html lang="th">
<head>
<meta charset="utf-8" />
<script>
/* ใส่คลาส fx-motion ก่อนวาดเฟรมแรก เพื่อไม่ให้เนื้อหากะพริบ
(JS ปิด หรือผู้ใช้ตั้ง reduced-motion → ไม่ใส่คลาส → เนื้อหาเห็นปกติทันที) */
(function () {
try {
if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
document.documentElement.classList.add("fx-motion");
}
} catch (e) {
/* ถ้า matchMedia ใช้ไม่ได้ ก็ไม่ต้องมีอนิเมชัน */
}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>โปรเจคอดิเรกของเรา</title>
<meta
name="description"
content="รายชื่อโปรเจคอดิเรกของเรา เลือกโปรเจคที่อยากดูได้เลย"
/>
<meta name="theme-color" content="#8A4722" />
<meta name="app-version" content="2026.11.24.2" />
<link rel="manifest" href="manifest.json" />
<link rel="icon" type="image/png" sizes="192x192" href="icons/icon-192.png" />
<link rel="icon" type="image/png" sizes="64x64" href="icons/favicon-64.png" />
<link rel="apple-touch-icon" href="icons/icon-180.png" />
<link rel="preload" href="fonts/k2d-400-thai.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="fonts/k2d-700-thai.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="assets/css/theme.css" />
<link rel="stylesheet" href="assets/css/home.css" />
<link rel="stylesheet" href="assets/css/admin.css" />
<link rel="stylesheet" href="assets/css/motion.css" />
<script type="module" src="ui/app.js"></script>
</head>
<body>
<div class="scroll-progress" aria-hidden="true"><span class="scroll-progress__bar"></span></div>
<a class="skip-link" href="#main">ข้ามไปที่เนื้อหาหลัก</a>
<header class="site-header">
<div class="wrap site-header__inner">
<a class="brand" href="#/" aria-label="กลับไปหน้ารายชื่อโปรเจค">
<span class="brand__mark" aria-hidden="true">
<svg viewBox="0 0 32 32" width="32" height="32" focusable="false">
<rect width="32" height="32" rx="9" fill="currentColor" />
<rect x="8" y="8" width="6.5" height="6.5" rx="1.8" fill="#FFFFFF" />
<rect x="17.5" y="8" width="6.5" height="6.5" rx="1.8" fill="#FFFFFF" opacity=".55" />
<rect x="8" y="17.5" width="6.5" height="6.5" rx="1.8" fill="#FFFFFF" opacity=".55" />
<rect x="17.5" y="17.5" width="6.5" height="6.5" rx="1.8" fill="#FFFFFF" />
</svg>
</span>
<span class="brand__text">
<strong>โปรเจคอดิเรก</strong>
<small>hobbypj.com</small>
</span>
</a>
<nav class="site-nav" aria-label="เมนูหลัก">
<a class="btn btn--primary btn--sm" href="#/admin" data-nav="admin-cta">
<span data-icon="settings"></span>
<span>แก้ไขรายการ</span>
</a>
</nav>
</div>
</header>
<main id="main" class="site-main" tabindex="-1"></main>
<footer class="site-footer">
<div class="wrap site-footer__inner">
<p class="site-footer__copyright">© hobbypj 2026</p>
</div>
</footer>
<div class="toast-stack" id="toast-stack" role="status" aria-live="polite"></div>
<noscript>
<div class="wrap noscript">หน้านี้ต้องเปิดใช้งาน JavaScript เพื่อแสดงรายชื่อโปรเจค</div>
</noscript>
</body>
</html>