diff --git a/AGENTS.md b/AGENTS.md index 2975893..07e2955 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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` + `` ใน `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` (เครดิต) ด้วยในคอมมิตเดียวกัน ## แผนที่ไฟล์ diff --git a/README.md b/README.md index 70aca65..70ea088 100644 --- a/README.md +++ b/README.md @@ -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` → ผู้ใช้ไม่ต้องล้างแคชเอง diff --git a/icons/screenshot-mobile.png b/icons/screenshot-mobile.png new file mode 100644 index 0000000..9547a0e Binary files /dev/null and b/icons/screenshot-mobile.png differ diff --git a/icons/screenshot-wide.png b/icons/screenshot-wide.png new file mode 100644 index 0000000..4f51183 Binary files /dev/null and b/icons/screenshot-wide.png differ diff --git a/index.html b/index.html index e6d47bb..c13fe95 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ content="รายชื่อโปรเจคอดิเรกของเรา เลือกโปรเจคที่อยากดูได้เลย" /> - + diff --git a/manifest.json b/manifest.json index dceadfb..68f59d3 100644 --- a/manifest.json +++ b/manifest.json @@ -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": "เปิดหน้าหลังบ้าน" + } ] } diff --git a/sw.js b/sw.js index dcc5c20..6c61c40 100644 --- a/sw.js +++ b/sw.js @@ -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 = [