ecourt+groups: N8 เปิดเอกสารจากลิงก์ ?fileUrl=&fileId=&typeId= (metadata-only + allowlist + ดึงไฟล์สด + login วนกลับ + การ์ดจำลองลิงก์ + path dev /samples) + N9 กลุ่มเอกสารตาม typeId — หน้ารายการจัด section ต่อกลุ่ม + "ไม่มีกลุ่ม" ท้ายสุด + หน้า /groups/[typeId] พร้อมหมายเหตุ "อาจไม่ครบทุกฉบับ" + docs sync ครบ (2026-09-23)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-09-23 10:44:14 +07:00
parent 0aef3ff028
commit 329ae8e956
31 changed files with 2766 additions and 155 deletions

View file

@ -119,6 +119,7 @@ import {
MAX_BOOKMARK_TITLE_CHARS,
} from "@/utils/bookmark-limits";
import { fileKindFromUrl, imageFormatFromUrl } from "@/utils/file-kind";
import { isHttpUrl } from "@/utils/external-file";
import { withBasePath } from "@/utils/base-path";
import { formatThaiDate } from "@/utils/date-format";
import { decodeTiffPages } from "@/utils/tiff-client";
@ -1559,7 +1560,11 @@ export default function PDFViewer({
setTool((prev) => (prev === "highlight" ? "select" : prev));
const objectUrls: string[] = [];
// URL จริงที่ browser ใช้โหลดไฟล์ (fetch/img.src ตรง — ต้องเติม basePath เอง)
const fileUrl = withBasePath(file.pdfUrl);
// N8: รูปรีโมต (ลิงก์ e-Court) โหลดผ่าน /api/pdf ของเราแทนทางตรง — กัน CORS
// ของปลายทาง + ผ่าน allowlist/จำกัดขนาดเดียวกับ PDF (route คืน bytes รูป + content-type)
const fileUrl = isHttpUrl(file.pdfUrl)
? withBasePath(`/api/pdf?fileId=${file.id}`)
: withBasePath(file.pdfUrl);
(async () => {
let pages: { src: string | null; width: number; height: number }[];
if (imageFormatFromUrl(file.pdfUrl) === "tiff") {