feat(note): mock e-Court login form on dev page
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 4s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 1m16s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 4s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 1s
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 4s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 1m16s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 4s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 1s
เพิ่มฟอร์ม "จำลอง e-Court — ขอ token ด้วย API key" บนหน้า /note/dev (components/MockEcourtForm): ใส่ DOCVER_API_KEY + userid/username + เลือกไฟล์ตัวอย่าง → ยิง POST /api/note/auth/token (ทางเข้าเดียวกับที่ e-Court ใช้จริง) แล้ว redirect เข้า /note?fileUrl=…&t=… ให้ NoteHome แลกเป็น session 8 ชม. ต่อ — ใช้ได้ทั้ง dev และ production และไม่เป็นประตูหลัง (ต้องถือ API key ที่ถูกต้อง) พร้อมกันนี้เปลี่ยนเกณฑ์เปิดหน้า dev เป็น env ตัวเดียว (คำขอผู้ใช้ 2026-11-02): - devMintEnabled: ตัดเงื่อนไข NODE_ENV≠production ออก เหลือ NOTE_SSO_DEV_MINT === "1" อย่างเดียว — ตั้งไว้บน production (เครื่องทดสอบ) ก็ใช้ได้ - หน้า /note/dev: 0/ไม่ตั้ง = 404 ทั้งหน้า (notFound) — เดิมเป็น public ตลอดเหลือแต่ข้อความแนะนำ - dev-link (GET/POST) เปิด/ปิดตามเกณฑ์เดียวกันโดยอัตโนมัติ - sync CLAUDE.md + ปรับ unit test ให้ตรงเกณฑ์ใหม่ Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
83a2cc3e5e
commit
f7e84e3ee7
6 changed files with 160 additions and 23 deletions
|
|
@ -184,14 +184,15 @@ describe("parseDevLinkBody / devMintEnabled (dev-link)", () => {
|
|||
expect(parseDevLinkBody({ userid: "u", username: "n", fid: "F", oops: 1 }).ok).toBe(false);
|
||||
});
|
||||
|
||||
it("devMintEnabled: ต้องเป็น 1 เป๊ะและไม่ใช่ production — ค่าอื่น/production = false", () => {
|
||||
it("devMintEnabled: ต้องเป็น 1 เป๊ะ — ค่าอื่น = false · ใช้ได้ทุก NODE_ENV (2026-11-02)", () => {
|
||||
const orig = process.env.NODE_ENV;
|
||||
const writable = process.env as Record<string, string | undefined>;
|
||||
process.env.NOTE_SSO_DEV_MINT = "1";
|
||||
writable.NODE_ENV = "development";
|
||||
expect(devMintEnabled()).toBe(true);
|
||||
// production ที่ตั้ง env ไว้ก็เปิด (เครื่องทดสอบ) — gate เหลือ env ตัวเดียว
|
||||
writable.NODE_ENV = "production";
|
||||
expect(devMintEnabled()).toBe(false);
|
||||
expect(devMintEnabled()).toBe(true);
|
||||
writable.NODE_ENV = orig ?? "test";
|
||||
for (const value of [undefined, "", "0", "true", " yes "]) {
|
||||
if (value === undefined) delete process.env.NOTE_SSO_DEV_MINT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue