Commit Graph

19 Commits

Author SHA1 Message Date
7d4c7eea95 feat: add /api/files static serving and HTML iframe preview 2026-08-01 19:26:26 +08:00
c8a27888f6 fix: remove lru_cache from meilisearch SDK factory to avoid stale client 2026-08-01 19:04:17 +08:00
08a1211341 feat: favicon, sidebar tooltip, fix Meilisearch auth and test warnings
- Add SVG favicon using pine/paper design tokens; wire into index.html
- Add SidebarLabel component with ResizeObserver overflow detection and
  CSS-only tooltip (pine-deep bg, IBM Plex Mono, 0.08s fade, no delay)
- Fix Meilisearch invalid_api_key: default api key to None instead of ''
  so no Authorization header is sent when auth is disabled
- Stub ResizeObserver in test setup for jsdom compatibility
- Wrap async renders in act() and advance fake timers inside act() to
  eliminate all act() warnings in App.test.tsx
2026-08-01 18:44:32 +08:00
954b9bede4 fix: add image preview and replace Monaco with CodeMirror 6
Markdown and image previews were rendering blank because
@monaco-editor/react loads its core assets from cdn.jsdelivr.net at
runtime, which the deployment server's network can't reach. Switching
to @uiw/react-codemirror removes the CDN dependency entirely (all
assets ship in the build) and cuts bundle size from ~2.5MB to ~770KB.

Also add proper image/* content-type detection so images render via
<img> instead of being force-decoded as editor text.
2026-08-01 18:12:19 +08:00
542361c63a fix: natural-sort file tree, indent nested folders, fix editor layout
Also add a reindex endpoint and button to rebuild the Meilisearch
index from files already on disk, without needing to re-upload them.
2026-08-01 17:32:32 +08:00
4a6fdaf994 feat: support uploading entire folders
Adds a folder picker (webkitdirectory) and drag-and-drop directory
support (File System Entries API), preserving relative paths via
a new optional relative_path field on the upload endpoint.
2026-08-01 16:30:29 +08:00
4c19fad561 refactor: replace Garage/S3 storage with local filesystem storage
Single-node deployment doesn't benefit from S3 abstraction overhead;
LocalFileClient keeps the same interface DocumentService depends on,
backed by a STORAGE_DIR volume mount instead of a separate Garage service.
2026-08-01 16:30:02 +08:00
360e9e5a14 refactor: rename all minio references to garage, drop minio SDK for boto3
The backend no longer mentions MinIO anywhere: MinioClient -> GarageClient
(minio_client.py -> garage_client.py), MINIO_* env vars -> GARAGE_*, and
the `minio` Python package is replaced with `boto3` (AWS's generic S3
client) since Garage is the only storage backend this project targets
now. S3 API semantics are unchanged, so document_service.py's behavior
is identical — this is a naming and dependency swap, not a logic change.

Also updates test fixtures/names (FakeMinioClient -> FakeGarageClient,
FakeMinioSDK -> FakeS3SDK) and storage/README.md, which no longer frames
Garage as a MinIO replacement (that migration note has served its purpose
now that no MinIO reference remains in the codebase).

Backend: 54/54 tests passing. Frontend: 38/38 tests passing (unaffected,
verified for regressions since it talks to the backend only through the
unchanged REST API).
2026-08-01 10:51:49 +08:00
9ef22f9f0a Fix wave 2: CORS default, path traversal, delete UI, shared clients, bucket check
- Default CORS_ORIGINS to http://localhost:5173 instead of "*" (still overridable)
- Reject ".." and leading "/" in document keys/paths across get/save/delete/upload,
  mapped to HTTP 400 via new InvalidPathError
- Add a delete button to DocumentEditor wired to deleteDocument + onDeleted,
  giving the existing DELETE API an actual UI entry point
- Share a single lru_cache'd Meilisearch (and Minio) SDK client instance instead
  of constructing duplicates in dependencies.py
- Add a startup check that creates the MinIO bucket if missing, tolerating
  MinIO being unreachable at boot without crashing the app
2026-08-01 09:15:16 +08:00
13789cc0b4 fix: remove duplicate /health route, escape extracted text, validate uploads, handle binary decode
- main.py: remove duplicate /health endpoint definition
- text_extract.py: HTML-escape extracted plain text before indexing so raw
  markup in uploaded documents can't render as live HTML via search snippets
  (stored XSS fix)
- document_service.py: base64-encode content when UTF-8 decoding fails
  instead of raising UnicodeDecodeError (500) on binary files; add upload
  validation for file extension (allowlist) and size (10MB max)
- routers/documents.py: map new validation errors to HTTP 400 with a clear
  detail message instead of letting them 500
- add/extend tests covering escaping, binary get_document, and upload
  validation rejection + acceptance paths
2026-08-01 08:59:34 +08:00
448a5cbe56 feat: wire documents and search routers into FastAPI app with e2e smoke test 2026-08-01 02:36:58 +08:00
d758500548 feat: add search route forwarding queries to SearchClient 2026-08-01 02:35:00 +08:00
6633cab98e chore: wire documents router into main.py for testing 2026-08-01 02:32:51 +08:00
5b4bc4e719 feat: add documents router for list/get/save/delete/upload 2026-08-01 02:32:42 +08:00
6a286d422d feat: add DocumentService coordinating MinIO writes and search indexing 2026-08-01 02:28:58 +08:00
c931b870ed feat: add SearchClient wrapper for index/delete/search operations 2026-08-01 02:25:48 +08:00
f4126ff3ec feat: add MinioClient wrapper for list/get/put/delete object operations 2026-08-01 02:24:15 +08:00
2a7a197b95 feat: add stdlib-only markdown and html text extraction for indexing 2026-08-01 02:21:38 +08:00
f9c612927a feat: scaffold FastAPI backend with config and health endpoint 2026-08-01 02:15:01 +08:00