Spaces:
Running
Running
Commit History
-
Fix UTF-8 PDF download filenames Running
th6e47fe8 -
feat: upgrade deps + security hardening (v2.0.0)β
Deps: fastapi 0.115.5->0.137.1, uvicorn 0.32.1->0.49.0, pydantic 2.10.3->2.13.4, playwright 1.48.0->1.60.0 (Chromium 148); drop unused python-multipart. Dockerfile: add libatspi2.0-0/libdrm2/ libxkbcommon0/libxshmfence1 for the newer Chromium. Hardening (app.py): - API_KEY now required; service refuses to start without it (removed the insecure default "sisi_default_key_change_me"); constant-time compare - Shared Chromium launched once via lifespan + per-request context, capped by a semaphore (PDF_MAX_CONCURRENCY, default 4) instead of launching a browser per request - HTML payload size limit (MAX_HTML_BYTES, default 2MB) -> 413 - Content-Disposition filename sanitized (no header injection) - SSRF guard: block renderer sub-requests to private/loopback/link-local hosts and non-http(s) schemes; data:/blob: (embedded logos) still allowed - CORS origins env-configurable (ALLOWED_ORIGINS), default permissive Verified locally: docker build OK (Chromium 148 headless-shell), refuse-toβ¦f61f44d -
Improve PDF rendering and document integration
thbebd683
-
π Add API Key authentication to prevent abuseβ
SisiTheFox- Add API_KEY environment variable check - Protect /generate-pdf endpoint with API key - Protect /generate-pdf-base64 endpoint with API key - Keep /health endpoint public for monitoring - Return 403 error for unauthorized requests This protects the PDF generation API from being abused. π¦ Created by SisiTheFox97018c0
-
π¦ Initial commit: Sisi PDF API with Playwrightβ
thβ¨ Features: - Perfect Chinese support (Simplified & Traditional) - Colorful emoji rendering π¦πβ¨ - 100% accurate SVG graphics - Modern CSS3 support (Flexbox, Grid, Gradients) - Async/concurrent PDF generation - Two endpoints: binary PDF & base64 JSON ποΈ Tech Stack: - FastAPI + Playwright + Chromium - Docker optimized for HF Spaces - Fonts: Noto CJK + Noto Color Emoji π Performance: - 2-5 seconds per PDF - 5-10 concurrent requests - Perfect for production use π― Use Cases: - Birth chart reports (Sisi Astrology) - Bazi readings (Astrology Bazi) - Healing reports (SisiTheFox) - Any document with Chinese/Emoji/SVGe72cddb