Commit graph

2 commits

Author SHA1 Message Date
Your Name
b41816e2b6 feat(template): add restrict-edit protection script
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 53s
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
สคริปต์ทดลอง make-protected.mjs ตามแนวทาง Token-Based ใน note.md:
- เปิด documentProtection readOnly + enforcement ใน settings.xml
- ครอบ Content Control ทุกช่องด้วย permStart/permEnd (edGrp=everyone)
  ให้แก้ได้เฉพาะในช่อง + เติม w:lock=sdtLocked กันลบช่อง
- ฝัง custom properties (token/primary-key/owner) ที่ docProps/custom.xml
  พร้อมแก้ [Content_Types].xml และ _rels/.rels ให้ครบ
- verify อ่านไฟล์กลับทุกครั้งหลังเขียน (exit 1 ถ้าไม่ผ่าน)
- บันทึกบทเรียน/ผลทดสอบ Word จริง รอบ 1-2 ใน note.md
  พร้อม T3.docx/output-T3.docx อัปเดตตามผลรัน

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-07 16:55:30 +07:00
Your Name
073f72db7d feat(api): add swagger ui and docx template api
เพิ่มกลุ่ม API docx template สำหรับ wordaddin (WIP):
- POST /api/template/extract ดึงค่า Content Control ทั้งหมดจาก .docx
- POST /api/template/render แทนค่า JSON ลง template คืน .docx ใหม่
- GET /api/template/test ตรวจว่า service มีชีวิต
logic แชร์ที่ app/api/template/lib-tmpl.ts (pizzip+xpath) ไม่แตะ DB

เพิ่มหน้า Swagger UI ที่ GET /api/swagger — spec inline จาก
lib/openapi.ts ครอบ API ทุกกลุ่ม (template + N10), asset self-host
ที่ public/note/swagger-ui/ จาก postinstall scripts/copy-swagger-ui.mjs
(intranet ไม่ใช้ CDN — หาไฟล์ไม่เจอหลังอัปเกรด = exit 1 เหมือน
patch-pdf-worker, Docker build รัน script นี้ด้วยผ่าน web.Dockerfile)

middleware เปิดกว้างให้ api/template, api/swagger, note/swagger-ui

จาก code review: จำกัดไฟล์แนบ 100MB ทั้ง extract/render ก่อนอ่าน
เข้าหน่วยความจำกัน DoS, คืน 400 แทน 500 เมื่อ JSON ผิด format,
sync คำอธิบาย BadRequest ใน openapi spec ให้ตรง behavior ใหม่

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-07 10:16:12 +07:00