docs: ปรับเอกสารให้ตรงสถานะปัจจุบัน (motion, parity, SEO, push)
- README: เพิ่มบรรทัด "หน้าตาเท่ากันทุกเอนจิน" + อธิบายการ gate อนิเมชันแบบสองชั้น - docs/api.md: content store มี forCinemas/forFilmLovers · loader คืน origin/siteUrl/shareOrigin · sitemap/robots เป็น Nitro route - docs/architecture.html: แก้ robots ไม่ใช่ static, 7 แท็บ, เพิ่ม ShareOriginProvider/MotionBootstrap, parity layer, แก้คำผิด "블록" - docs/push-to-gitea.md: เขียนใหม่ให้ตรงจริง (repo web-alterflixhub, ต้อง -c http.version=HTTP/1.1, ลำดับก่อน push, วิธีตรวจว่า push ขึ้น)
This commit is contained in:
1 parent
cfb24b8138
commit
e6e935762e
4 files changed
+59
-40
No files matched your search
@@ -40,7 +40,8 @@ pnpm dev # http://localhost:8080
|
||||
- **หาโรงใกล้ฉัน** — `navigator.geolocation` + ระยะเส้นตรง และระยะตามถนน (OSRM)
|
||||
- **แชร์** — `navigator.share` → clipboard → fallback `<textarea>` · ลิงก์ย่อ `/c/<slug>` บนโดเมนจริงของ request · บอกผลด้วย `aria-live`
|
||||
- **PWA** — manifest + service worker (navigate network-first, asset cache-first) + `/offline.html` · ติดตั้งลงจอโฮมได้
|
||||
- **แอนิเมชันเบา** — reveal ตอนเลื่อน/โหลด ใช้เฉพาะ `transform`/`opacity` · ปิดอัตโนมัติเมื่อตั้ง `prefers-reduced-motion`
|
||||
- **แอนิเมชันเบา** — reveal ตอนเลื่อน/โหลด ใช้เฉพาะ `transform`/`opacity` · ตัวอนิเมชันผูกกับ media query `prefers-reduced-motion` (ไม่ผูกคลาสที่ hydration ลบได้) · ผู้ใช้ที่ขอ reduced motion เห็นเนื้อหานิ่งครบทันที
|
||||
- **หน้าตาเท่ากันทุกเอนจิน** — Chromium / Firefox / Safari: สกรอลบาร์ (`::-webkit-scrollbar` + `scrollbar-width`), `color-scheme: dark`, `::selection`, ฟอร์ม ≥16px บนมือถือ (iOS ไม่ซูมเอง), `tap-highlight` · ข้อยกเว้นที่ตั้งใจปล่อยไว้ (สกรอลบาร์ hover, ปุ่ม X ของ FF, install prompt, ฟอนต์ไทย) จดไว้ใน [DESIGN.md](DESIGN.md) หัวข้อ "Cross-engine parity"
|
||||
- **SEO + กัน AI** — canonical/OG/Twitter/JSON-LD (`WebSite`, `Organization`, `BreadcrumbList`, `MovieTheater`, `Article`), `sitemap.xml` จากข้อมูลจริง, `robots.txt` บล็อก AI crawler 21 ตัว, `ai.txt`
|
||||
- **สถิติ** — event `search` / `cinema_select` / `cinema_view` / `near_me` · หมวด "ยอดนิยม" เริ่มจัดอันดับจริงเมื่อข้อมูลครบ 6 เดือน
|
||||
|
||||
|
||||
+7
-4
@@ -18,8 +18,8 @@
|
||||
| POST | `/api/admin/login` | `{ username, password }` | ตรวจรหัส → ออกคุกกี้ HttpOnly เซ็น HMAC (8 ชั่วโมง) |
|
||||
| POST | `/api/admin/logout` | — | ลบคุกกี้ session |
|
||||
| GET | `/api/admin/session` | — | ตรวจว่ายังล็อกอินอยู่ |
|
||||
| GET | `/api/admin/content` | — | อ่าน `ContentStore` ทั้งก้อน (`cinemas`, `site`, `about`) |
|
||||
| PUT | `/api/admin/content` | `{ cinemas?, site?, about? }` | บันทึกเฉพาะส่วนที่ส่งมา — ผ่าน `sanitizeCinemas` / `sanitizeSite` / `sanitizeAbout` แล้วเขียนไฟล์แบบ atomic |
|
||||
| GET | `/api/admin/content` | — | อ่าน `ContentStore` ทั้งก้อน (`cinemas`, `site`, `about`, `forCinemas`, `forFilmLovers`) |
|
||||
| PUT | `/api/admin/content` | `{ cinemas?, site?, about?, forCinemas?, forFilmLovers? }` | บันทึกเฉพาะส่วนที่ส่งมา — ผ่าน `sanitizeCinemas` / `sanitizeSite` / `sanitizeAbout` / `sanitizeForCinemas` / `sanitizeForFilmLovers` แล้วเขียนไฟล์แบบ atomic |
|
||||
| POST | `/api/admin/cinemas/import` | `{ cinemas: Cinema[] }` หรือรายการเดียว | นำเข้าโรงหนังโดยใช้ slug เป็นกุญแจ (มีอยู่ = ทับ) |
|
||||
| GET | `/api/admin/analytics` | `?days=1\|7\|30\|90` | สรุปสถิติ (`summarize()`) — คำค้นยอดนิยม, คำค้นไม่พบผล, CTR, โรงที่ถูกเปิด/คลิก |
|
||||
|
||||
@@ -27,8 +27,11 @@
|
||||
|
||||
| Route | ค่าที่ส่งมา |
|
||||
|---|---|
|
||||
| `/` (root loader) | `content` (cinemas/site/about) + `localeFromUrl` |
|
||||
| `/` (`_index` loader) | `popularity` (สถานะ/อันดับ "ยอดนิยม" จาก `computePopularity()`, memo 5 นาที) + `orderKey` (วันที่ UTC ใช้สลับลำดับการ์ดรายวันผ่าน `dailyOrder()`) |
|
||||
| `/` (root loader) | `content` (cinemas/site/about/forCinemas/forFilmLovers) + `localeFromUrl` + **`siteUrl`** และ **`shareOrigin`** (origin ของ request ใช้ทำ canonical/OG/ลิงก์แชร์ — ไม่ฝังโดเมน) |
|
||||
| `/` (`_index` loader) | `popularity` + `orderKey` (สลับลำดับการ์ดรายวัน) + `origin` |
|
||||
| `/cinema/:slug` | ฟิลด์ SEO ของโรง (`name`, `description`, `locationLabel`, `coordinates`, `mapUrl`, `photo`) + `origin` แล้วนำไปสร้าง meta/JSON-LD |
|
||||
| `/about` · `/for-cinemas` · `/for-film-lovers` · `/admin` · `/admin/login` | `{ origin }` — `meta()` ของ React Router ไม่มี access ต่อ request จึงต้องส่งมาจาก loader |
|
||||
| `/sitemap.xml` · `/robots.txt` | ไม่ใช่ loader ของ React — เป็น Nitro route (`server/routes/`) อ่าน origin จาก header เอง |
|
||||
|
||||
## ตัวอย่างเรียก
|
||||
|
||||
|
||||
+16
-4
@@ -459,7 +459,7 @@
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name"><code>/for-cinemas</code></span>
|
||||
<span class="desc">บทความ 블록 (ย่อหน้า/รูป) จาก data/content · ธีมเดียวกับ /about</span>
|
||||
<span class="desc">บทความแบบบล็อก (ย่อหน้า/รูป) จาก data/content · ธีมเดียวกับ /about</span>
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name"><code>/for-film-lovers</code></span>
|
||||
@@ -471,7 +471,7 @@
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name"><code>/sitemap.xml</code> · <code>/robots.txt</code> · <code>/ai.txt</code></span>
|
||||
<span class="desc">ไฟล์สำหรับ crawler — sitemap สร้างจากข้อมูลจริง (Nitro route), robots/ai เป็น static ใน public/</span>
|
||||
<span class="desc">sitemap + robots สร้างสดที่ Nitro route (โดเมนจาก request, robots บล็อก AI 21 ตัว) · ai.txt เป็นไฟล์ static</span>
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name"><code>/admin</code></span>
|
||||
@@ -499,6 +499,14 @@
|
||||
<span class="name">LocaleProvider</span>
|
||||
<span class="desc">?lang → localStorage → cookie → ไทย</span>
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name">ShareOriginProvider</span>
|
||||
<span class="desc">origin ของ request (จาก root loader) → ปุ่มแชร์สร้างลิงก์ย่อ /c/<slug> โดยไม่ฝังโดเมน</span>
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name">MotionBootstrap · ServiceWorkerSetup</span>
|
||||
<span class="desc">เติมคลาส fx-motion ซ้ำหลัง hydration (กันคลาสหลุด) · ลงทะเบียน service worker</span>
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name">NearMeProvider</span>
|
||||
<span class="desc">Geolocation API → ระยะทางต่อ slug</span>
|
||||
@@ -547,7 +555,11 @@
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name">motion.ts · pwa.ts</span>
|
||||
<span class="desc">เปิดใช้แอนิเมชันก่อน paint (เคารพ reduced-motion) · ลงทะเบียน service worker</span>
|
||||
<span class="desc">สคริปต์ใส่คลาส fx-motion ก่อน paint (เคารพ reduced-motion) · ตัวอนิเมชันผูกกับ @media ไม่ผูกคลาส · ลงทะเบียน service worker</span>
|
||||
</div>
|
||||
<div class="node f">
|
||||
<span class="name">global.css — parity layer</span>
|
||||
<span class="desc">@layer base: color-scheme, scrollbar-width (Firefox), tap-highlight/iOS 16px forms (Safari), ::selection, -*-focus-inner · ข้อยกเว้นต่อเบราว์เซอร์อยู่ใน DESIGN.md</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -786,7 +798,7 @@
|
||||
</div>
|
||||
|
||||
<div class="flow">
|
||||
<h4>6 · แก้ข้อมูลผ่านหลังบ้าน (5 แท็บ · ฟอร์มเป็นหมวดพับ)</h4>
|
||||
<h4>6 · แก้ข้อมูลผ่านหลังบ้าน (7 แท็บ · ฟอร์มเป็นหมวดพับ)</h4>
|
||||
<ol>
|
||||
<li><span class="n">1</span><b>เลือกโรงจากรายการซ้าย</b><em>เรียง ก-ฮ หรือลากสลับลำดับ</em></li>
|
||||
<li><span class="n">2</span><b>กางหมวดที่ต้องการ</b><em>AdminSection (details/summary)</em></li>
|
||||
|
||||
+34
-31
@@ -1,45 +1,48 @@
|
||||
# push ขึ้น Gitea
|
||||
|
||||
repo นี้ commit ไว้ในเครื่องแล้ว แต่ **ยังไม่ขึ้น Gitea** เพราะเครื่องนี้รัน git แบบไม่มี GUI
|
||||
ทำให้ Git Credential Manager เรียกขอรหัสไม่ได้ (push จะค้าง) — ต้องให้สิทธิ์ก่อนหนึ่งครั้ง
|
||||
repo นี้ผูก remote ไว้แล้วและ **push ได้แบบไม่ต้องล็อกอินซ้ำ** ในเครื่องนี้ (credential ถูกเก็บไว้แล้ว)
|
||||
|
||||
Gitea: `http://103.107.52.82:3004` · org: `alterflixhub` · repo ที่มีอยู่: `web-alterflixhub`
|
||||
|
||||
## วิธีที่ 1 — ล็อกอินผ่าน Git Credential Manager (ง่ายสุด)
|
||||
|
||||
เปิด terminal ปกติของ Windows (ไม่ใช่ผ่าน agent) แล้วรัน:
|
||||
|
||||
```bash
|
||||
cd D:/Git/workspace/alterflixhub-reboot
|
||||
git push -u origin main
|
||||
```
|
||||
remote : http://103.107.52.82:3004/alterflixhub/web-alterflixhub.git
|
||||
branch : main
|
||||
```
|
||||
|
||||
หน้าต่างล็อกอินจะเด้ง → ใส่ user/รหัส Gitea หนึ่งครั้ง หลังจากนั้น push ได้ตลอด
|
||||
## คำสั่งที่ใช้จริง
|
||||
|
||||
## วิธีที่ 2 — ใช้ access token (ไม่ต้องมี GUI)
|
||||
```bash
|
||||
cd D:/Git/workspace/web-alterflixhub
|
||||
git -c http.version=HTTP/1.1 push origin main
|
||||
```
|
||||
|
||||
**ต้องใส่ `-c http.version=HTTP/1.1` เสมอ** — Gitea ตัวนี้ปิด HTTP/2 ไว้ ทำให้ push แบบ HTTP/2 ค้าง/หลุดกลางทาง
|
||||
|
||||
## ลำดับก่อน push (ทำทุกครั้ง)
|
||||
|
||||
```bash
|
||||
pnpm typecheck # ต้องผ่าน
|
||||
npx vitest --run app/lib # unit tests (16 ไฟล์ / 135+ ตัว)
|
||||
git add -A
|
||||
git commit -m "..." # ข้อความสั้น บอกสิ่งที่เปลี่ยน
|
||||
git -c http.version=HTTP/1.1 push origin main
|
||||
```
|
||||
|
||||
ถ้าแก้ `public/sw.js` ต้อง bump `VERSION` ในไฟล์นั้นก่อน commit (ขั้น activate จะเก็บกวาดแคชเก่าให้เอง)
|
||||
|
||||
## ถ้า credential หมดอายุ / ขึ้น 401
|
||||
|
||||
สร้าง token ที่ Gitea → Settings → Applications → Generate New Token (สิทธิ์ `write:repository`)
|
||||
แล้วรัน (แทน `<TOKEN>` ด้วยค่าจริง — อย่าเก็บไว้ในไฟล์ที่ commit):
|
||||
แล้วตั้ง remote ใหม่ (แทน `<TOKEN>` ด้วยค่าจริง — **ห้ามเก็บลงไฟล์ที่ commit**):
|
||||
|
||||
```bash
|
||||
cd D:/Git/workspace/alterflixhub-reboot
|
||||
git remote set-url origin "http://Bkk1234:<TOKEN>@103.107.52.82:3004/alterflixhub/alterflixhub-reboot.git"
|
||||
git -c http.version=HTTP/1.1 push -u origin main
|
||||
git remote set-url origin "http://Bkk1234:<TOKEN>@103.107.52.82:3004/alterflixhub/web-alterflixhub.git"
|
||||
```
|
||||
|
||||
## เลือกปลายทาง
|
||||
หรือล็อกอินผ่าน Git Credential Manager จาก terminal ปกติของ Windows (ไม่ผ่าน agent) แล้ว `git push` หนึ่งครั้ง
|
||||
|
||||
| ต้องการ | สิ่งที่ต้องทำ |
|
||||
|---|---|
|
||||
| repo ใหม่ `alterflixhub/alterflixhub-reboot` | สร้าง repo บน Gitea (private) แล้วตั้ง remote ตามด้านบน |
|
||||
| branch ใหม่ใน repo เดิม | `git remote set-url origin "http://[email protected]:3004/alterflixhub/web-alterflixhub.git"` แล้ว `git -c http.version=HTTP/1.1 push -u origin main:reboot` |
|
||||
| แทนที่ main ของ repo เดิม | เหมือนข้อบน แต่ push `main:main` (ทับของเดิม — ระวัง) |
|
||||
## ตรวจว่าขึ้นจริง
|
||||
|
||||
## หมายเหตุ
|
||||
|
||||
- `data/` ถูก `.gitignore` ไว้ → **ข้อมูลโรงหนัง/คำศัพท์ไม่อยู่ใน git** (โคลนใหม่จะได้ seed จาก `app/lib/cinemas.ts`)
|
||||
- `.env` ก็ไม่ถูก commit · ต้องสร้างจาก `.env.example` บนเครื่องใหม่
|
||||
- ถ้าต้องการให้ content.json อยู่ใน git ด้วย ให้เพิ่มข้อยกเว้นใน `.gitignore`:
|
||||
```
|
||||
!data/content/content.json
|
||||
```
|
||||
```bash
|
||||
git log --oneline -1 origin/main # ต้องเห็น commit ล่าสุด
|
||||
git status -sb # ต้องไม่มี ahead
|
||||
git ls-remote origin main # hash ต้องตรงกับ HEAD
|
||||
```
|
||||
Reference in new issue
Block a user