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

+1
View File
@@ -26,6 +26,7 @@ PUBLISH_PUSH=0 node server/publish.mjs # เขียน+commit แต่ไ
6. **ปุ่ม/ลิงก์ต้องมีพื้นที่กด ≥ 44×44px** และมี `aria-label` เมื่อเป็นไอคอนเดี่ยว
7. **แก้ `sw.js` หรือรายการ `PRECACHE` → bump เวอร์ชันด้วย `npm run version`** (แก้ `VERSION` ใน `sw.js` + `<meta name="app-version">` ใน `index.html` พร้อมกัน) · `npm run check` มี `bump-version.mjs --check` ตรวจว่าไม่หลุดกัน · แก้ HTML/CSS/JS/JSON เนื้อหาอย่างเดียวไม่ต้อง bump (network-first จัดการ)
8. **PWA boot บน plain HTTP ไม่ได้** — ต้อง HTTPS หรือ localhost
· เกณฑ์ติดตั้งของ Chrome/Android: manifest parse ผ่าน + ไอคอน PNG 192/512(+maskable) + `screenshots` + service worker คุมหน้า + cert ถูกต้อง — ตรวจด้วย CDP `Page.getInstallabilityErrors` ต้องได้ `[]`
9. การเปลี่ยนคำ/ค่าออกแบบ → อัปเดต `DESIGN.md` และ `README.md` (เครดิต) ด้วยในคอมมิตเดียวกัน
## แผนที่ไฟล์
+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` → ผู้ใช้ไม่ต้องล้างแคชเอง
Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 KiB

+1 -1
View File
@@ -22,7 +22,7 @@
content="รายชื่อโปรเจคอดิเรกของเรา เลือกโปรเจคที่อยากดูได้เลย"
/>
<meta name="theme-color" content="#8A4722" />
<meta name="app-version" content="2026.11.24.2" />
<meta name="app-version" content="2026.11.24.4" />
<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" />
+33 -2
View File
@@ -5,14 +5,15 @@
"description": "รายชื่อโปรเจคอดิเรกของเรา เลือกโปรเจคที่อยากดูได้เลย",
"lang": "th",
"dir": "ltr",
"start_url": "./",
"scope": "./",
"start_url": "/",
"scope": "/",
"display": "standalone",
"display_override": ["standalone", "minimal-ui"],
"orientation": "any",
"theme_color": "#8A4722",
"background_color": "#FFFFFF",
"categories": ["productivity", "entertainment"],
"prefer_related_applications": false,
"icons": [
{
"src": "icons/icon-192.png",
@@ -32,5 +33,35 @@
"type": "image/png",
"purpose": "maskable"
}
],
"screenshots": [
{
"src": "icons/screenshot-mobile.png",
"sizes": "1080x1920",
"type": "image/png",
"form_factor": "narrow",
"label": "หน้ารายชื่อโปรเจค พร้อมช่องค้นหา"
},
{
"src": "icons/screenshot-wide.png",
"sizes": "1920x1080",
"type": "image/png",
"form_factor": "wide",
"label": "หน้ารายชื่อโปรเจคบนจอกว้าง"
}
],
"shortcuts": [
{
"name": "หน้าแรก",
"short_name": "หน้าแรก",
"url": "/#/",
"description": "กลับไปหน้ารายชื่อโปรเจค"
},
{
"name": "แก้ไขรายการ",
"short_name": "แก้ไข",
"url": "/#/admin",
"description": "เปิดหน้าหลังบ้าน"
}
]
}
+1 -1
View File
@@ -2,7 +2,7 @@
กติกา: bump VERSION เฉพาะเมื่อแก้ไฟล์นี้หรือรายการ PRECACHE
เนื้อหา (HTML/CSS/JS/JSON) ใช้ network-first จึงไม่ต้อง bump */
const VERSION = "2026.11.24.2";
const VERSION = "2026.11.24.4";
const CACHE = `hobbypj-${VERSION}`;
const PRECACHE = [