feat(pwa): pass Samsung Internet install criteria

- index.html: legacy metas Samsung Internet/older Android require to treat the page as
  installable (mobile-web-app-capable, apple-mobile-web-app-*, application-name)
- manifest.json: icons at 48/72/96/144/192/512 plus maskable 192/512 (every file's real
  pixel size matches the declared sizes), related_applications: []
- icons: derived the new sizes from the existing artwork (PIL, LANCZOS)
- README: document the Samsung-specific requirement
- VERSION bumped to 2026.11.24.5

Verified with CDP (Chrome + SamsungBrowser UA, 360x800): installabilityErrors [],
all 8 icons load with matching dimensions, screenshots served as image/png, no
horizontal overflow, service worker controlling the page.
This commit is contained in:
Bkk1234 committed 2026-11-24 15:06:32 +07:00
1 parent 084eb7dd8e
commit ddec75b99e
9 files changed
+41 -3

No files matched your search

+2 -1
View File
@@ -67,7 +67,8 @@ repo นี้ deploy เป็น **Compose application** บน Dokploy (serve
- **หน้าเดียว**: hash router (`#/`, `#/admin`) — เปลี่ยนหน้าไม่โหลดใหม่ (`performance.navigation` ไม่เพิ่ม, `timeOrigin` เดิม) - **หน้าเดียว**: hash router (`#/`, `#/admin`) — เปลี่ยนหน้าไม่โหลดใหม่ (`performance.navigation` ไม่เพิ่ม, `timeOrigin` เดิม)
- **ติดตั้งได้**: `manifest.json` (`display: standalone`, `start_url`/`scope` = `/`, `id` = `/`, ไอคอน 192/512 + maskable, `screenshots` แนวตั้ง/แนวนอน, `shortcuts`) ลิงก์ใน `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) - ต้องมีครบตามที่ Chrome/Samsung ตรวจ: HTTPS ที่ certificate ถูกต้อง · manifest ที่ parse ผ่าน (`Page.getAppManifest` → `errors: []`) · `Page.getInstallabilityErrors` → `[]` · service worker คุมหน้าอยู่ · ไอคอนเป็น PNG จริง (ไม่ใช่ SVG) และ **ขนาดจริงต้องตรงกับ `sizes` ที่ประกาศ** (48/72/96/144/192/512 + maskable 192/512)
- **Samsung Internet ใช้ `<meta name="mobile-web-app-capable" content="yes">` + `application-name`** ประกอบการตัดสิน — ถ้าลบ meta พวกนี้จะขึ้น “ไม่ผ่านข้อกำหนด” ทั้งที่ manifest ครบ
- **ออฟไลน์ได้**: `sw.js` precache shell ไว้ครบ เปิดแบบไม่มีเน็ตยังเห็นรายการ (ข้อมูลจากสำเนา JSON/localStorage) - **ออฟไลน์ได้**: `sw.js` precache shell ไว้ครบ เปิดแบบไม่มีเน็ตยังเห็นรายการ (ข้อมูลจากสำเนา JSON/localStorage)
- **อัปเดตเอง**: `ui/pwa.js` ลงทะเบียนด้วย `updateViaCache: "none"` แล้ว `update()` ตอนเปิดหน้า / ทุก 30 นาที / กลับมาโฟกัสแท็บ / ต่อเน็ตใหม่ · `sw.js` ใช้ `skipWaiting()` + `clients.claim()` → `controllerchange` สั่ง reload หน้าเอง (ชะงักเฉพาะตอนกำลังพิมพ์ในฟอร์ม แล้วทำต่อเมื่อเลิกพิมพ์) - **อัปเดตเอง**: `ui/pwa.js` ลงทะเบียนด้วย `updateViaCache: "none"` แล้ว `update()` ตอนเปิดหน้า / ทุก 30 นาที / กลับมาโฟกัสแท็บ / ต่อเน็ตใหม่ · `sw.js` ใช้ `skipWaiting()` + `clients.claim()` → `controllerchange` สั่ง reload หน้าเอง (ชะงักเฉพาะตอนกำลังพิมพ์ในฟอร์ม แล้วทำต่อเมื่อเลิกพิมพ์)
- cache เวอร์ชันเก่าถูกลบใน `activate` → ผู้ใช้ไม่ต้องล้างแคชเอง - cache เวอร์ชันเก่าถูกลบใน `activate` → ผู้ใช้ไม่ต้องล้างแคชเอง
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

+7 -1
View File
@@ -22,7 +22,13 @@
content="รายชื่อโปรเจคอดิเรกของเรา เลือกโปรเจคที่อยากดูได้เลย" content="รายชื่อโปรเจคอดิเรกของเรา เลือกโปรเจคที่อยากดูได้เลย"
/> />
<meta name="theme-color" content="#8A4722" /> <meta name="theme-color" content="#8A4722" />
<meta name="app-version" content="2026.11.24.4" /> <!-- Samsung Internet / เบราว์เซอร์รุ่นเก่าใช้ meta เหล่านี้ตัดสินว่า "ติดตั้งได้" -->
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="apple-mobile-web-app-title" content="โปรเจคอดิเรก" />
<meta name="application-name" content="โปรเจคอดิเรก" />
<meta name="app-version" content="2026.11.24.5" />
<link rel="manifest" href="manifest.json" /> <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="192x192" href="icons/icon-192.png" />
<link rel="icon" type="image/png" sizes="64x64" href="icons/favicon-64.png" /> <link rel="icon" type="image/png" sizes="64x64" href="icons/favicon-64.png" />
+31
View File
@@ -14,7 +14,32 @@
"background_color": "#FFFFFF", "background_color": "#FFFFFF",
"categories": ["productivity", "entertainment"], "categories": ["productivity", "entertainment"],
"prefer_related_applications": false, "prefer_related_applications": false,
"related_applications": [],
"icons": [ "icons": [
{
"src": "icons/icon-48.png",
"sizes": "48x48",
"type": "image/png",
"purpose": "any"
},
{
"src": "icons/icon-72.png",
"sizes": "72x72",
"type": "image/png",
"purpose": "any"
},
{
"src": "icons/icon-96.png",
"sizes": "96x96",
"type": "image/png",
"purpose": "any"
},
{
"src": "icons/icon-144.png",
"sizes": "144x144",
"type": "image/png",
"purpose": "any"
},
{ {
"src": "icons/icon-192.png", "src": "icons/icon-192.png",
"sizes": "192x192", "sizes": "192x192",
@@ -27,6 +52,12 @@
"type": "image/png", "type": "image/png",
"purpose": "any" "purpose": "any"
}, },
{
"src": "icons/icon-192-maskable.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{ {
"src": "icons/icon-512-maskable.png", "src": "icons/icon-512-maskable.png",
"sizes": "512x512", "sizes": "512x512",
+1 -1
View File
@@ -2,7 +2,7 @@
กติกา: bump VERSION เฉพาะเมื่อแก้ไฟล์นี้หรือรายการ PRECACHE กติกา: bump VERSION เฉพาะเมื่อแก้ไฟล์นี้หรือรายการ PRECACHE
เนื้อหา (HTML/CSS/JS/JSON) ใช้ network-first จึงไม่ต้อง bump */ เนื้อหา (HTML/CSS/JS/JSON) ใช้ network-first จึงไม่ต้อง bump */
const VERSION = "2026.11.24.4"; const VERSION = "2026.11.24.5";
const CACHE = `hobbypj-${VERSION}`; const CACHE = `hobbypj-${VERSION}`;
const PRECACHE = [ const PRECACHE = [