feat(pwa): meet Android install-quality criteria (screenshots, absolute scope)

Samsung/Chrome on Android 16 refused to offer installation. manifest.json now has
absolute start_url/scope ('/'), prefer_related_applications:false, two screenshots
(narrow 1080x1920 + wide 1920x1080 captured from production) and app shortcuts.

Verified with CDP: Page.getInstallabilityErrors -> [], Page.getAppManifest ->
errors [] with 2 screenshots / 2 shortcuts, screenshots served as image/png, service
worker controlling the page. VERSION bumped to 2026.11.24.4.
This commit is contained in:
Bkk1234 committed 2026-11-24 15:03:47 +07:00
1 parent 634dc3ae3c
commit 084eb7dd8e
7 files changed
+38 -5

No files matched your search

+2 -1
View File
@@ -66,7 +66,8 @@ repo นี้ deploy เป็น **Compose application** บน Dokploy (serve
## PWA: ติดตั้งได้ + อัปเดตแคชเอง (ไม่มี reload ตอนเปลี่ยนหน้า)
- **หน้าเดียว**: hash router (`#/`, `#/admin`) — เปลี่ยนหน้าไม่โหลดใหม่ (`performance.navigation` ไม่เพิ่ม, `timeOrigin` เดิม)
- **ติดตั้งได้**: `manifest.json` (`display: standalone`, ไอคอน 192/512 + maskable) ลิงก์ใน `index.html`
- **ติดตั้งได้**: `manifest.json` (`display: standalone`, `start_url`/`scope` = `/`, `id` = `/`, ไอคอน 192/512 + maskable, `screenshots` แนวตั้ง/แนวนอน, `shortcuts`) ลิงก์ใน `index.html`
- ต้องมีครบตามที่ Chrome/Samsung ตรวจ: HTTPS ที่ certificate ถูกต้อง · manifest ที่ parse ผ่าน (`Page.getAppManifest` → `errors: []`) · `Page.getInstallabilityErrors` → `[]` · service worker คุมหน้าอยู่ · ไอคอนเป็น PNG จริง (ไม่ใช่ SVG)
- **ออฟไลน์ได้**: `sw.js` precache shell ไว้ครบ เปิดแบบไม่มีเน็ตยังเห็นรายการ (ข้อมูลจากสำเนา JSON/localStorage)
- **อัปเดตเอง**: `ui/pwa.js` ลงทะเบียนด้วย `updateViaCache: "none"` แล้ว `update()` ตอนเปิดหน้า / ทุก 30 นาที / กลับมาโฟกัสแท็บ / ต่อเน็ตใหม่ · `sw.js` ใช้ `skipWaiting()` + `clients.claim()` → `controllerchange` สั่ง reload หน้าเอง (ชะงักเฉพาะตอนกำลังพิมพ์ในฟอร์ม แล้วทำต่อเมื่อเลิกพิมพ์)
- cache เวอร์ชันเก่าถูกลบใน `activate` → ผู้ใช้ไม่ต้องล้างแคชเอง