From 5f9fe07317d63da6feb449a02c78acd7e7485bd0 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Tue, 2 Sep 2025 17:17:07 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Alpine.js=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20PDF=20?= =?UTF-8?q?=EB=AF=B8=EB=A6=AC=EB=B3=B4=EA=B8=B0=20=EA=B0=84=EC=86=8C?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ› Alpine.js ์˜ค๋ฅ˜ ์ˆ˜์ •: - PDF ๊ด€๋ จ ๋ณ€์ˆ˜๋“ค (pdfZoom, pdfLoading, pdfCurrentPage ๋“ฑ) ์ œ๊ฑฐ - HTML ๋ทฐ์–ด ๋ณ€์ˆ˜๋“ค ์œ ์ง€ (htmlLoading, htmlRawMode, htmlSourceCode) - ์ค‘๋ณต ๋ณ€์ˆ˜ ์ •์˜ ์ œ๊ฑฐ ๐Ÿ“ฑ PDF ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๊ฐ„์†Œํ™”: - PDF.js Canvas ๋ Œ๋”๋ง โ†’ iframe ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝ - ๋ณต์žกํ•œ ์คŒ/ํŽ˜์ด์ง€ ๋„ค๋น„๊ฒŒ์ด์…˜ ์ œ๊ฑฐ - ๋ธŒ๋ผ์šฐ์ € ๋‚ด์žฅ PDF ๋ทฐ์–ด ํ™œ์šฉ - 401 Unauthorized ์˜ค๋ฅ˜ ํ•ด๊ฒฐ์„ ์œ„ํ•œ ํ† ํฐ ์ฒ˜๋ฆฌ ๐ŸŽฏ ์„ฑ๋Šฅ ๋ฐ ์•ˆ์ •์„ฑ ๊ฐœ์„ : - PDF.js ์›Œ์ปค ์„ค์ •์„ HTML์—์„œ ์ „์—ญ์œผ๋กœ ์ฒ˜๋ฆฌ - ๋ถˆํ•„์š”ํ•œ JavaScript ํ•จ์ˆ˜๋“ค ์ œ๊ฑฐ - ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜ ๋ฐฉ์ง€๋ฅผ ์œ„ํ•œ ๋ฆฌ์†Œ์Šค ์ •๋ฆฌ - ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๊ฐ„์†Œํ™” โœจ ์‚ฌ์šฉ์ž ๊ฒฝํ—˜: - ๋” ๋น ๋ฅธ PDF ๋กœ๋”ฉ - ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ณธ PDF ์ปจํŠธ๋กค ์‚ฌ์šฉ ๊ฐ€๋Šฅ - Alpine.js ๊ฒฝ๊ณ  ๋ฉ”์‹œ์ง€ ์ œ๊ฑฐ - ์•ˆ์ •์ ์ธ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋™์ž‘ --- backend/src/api/routes/documents.py | 1 + frontend/search.html | 77 ++++---------- frontend/static/js/search.js | 151 +--------------------------- 3 files changed, 24 insertions(+), 205 deletions(-) diff --git a/backend/src/api/routes/documents.py b/backend/src/api/routes/documents.py index 5c597e8..0654d06 100644 --- a/backend/src/api/routes/documents.py +++ b/backend/src/api/routes/documents.py @@ -510,6 +510,7 @@ async def get_document_content( @router.get("/{document_id}/pdf") async def get_document_pdf( document_id: str, + token: Optional[str] = Query(None), current_user: User = Depends(get_current_active_user), db: AsyncSession = Depends(get_db) ): diff --git a/frontend/search.html b/frontend/search.html index c7c7006..2a0d325 100644 --- a/frontend/search.html +++ b/frontend/search.html @@ -10,6 +10,12 @@ +