Improve ZXDB downloads with local mirroring and inline preview

This commit implements a comprehensive local file mirror system for
ZXDB and WoS downloads, allowing users to access local archives
directly through the explorer UI.

Key Changes:

Local File Mirroring & Proxy:
- Added `ZXDB_LOCAL_FILEPATH` and `WOS_LOCAL_FILEPATH` to `src/env.ts`
  and `example.env` for opt-in local mirroring.
- Implemented `resolveLocalLink` in `src/server/repo/zxdb.ts` to map
  database `file_link` paths to local filesystem paths based on
  configurable prefixes.
- Created `src/app/api/zxdb/download/route.ts` to safely proxy local
  files, preventing path traversal and serving with appropriate
  `Content-Type` and `Content-Disposition`.
- Updated `docs/ZXDB.md` with setup instructions and resolution logic.

UI Enhancements & Grouping:
- Grouped downloads and scraps by type (e.g., Inlay, Game manual, Tape
  image) in `EntryDetail.tsx` and `ReleaseDetail.tsx` for better
  organization.
- Introduced `FileViewer.tsx` component to provide inline previews
  for supported formats (.txt, .nfo, .png, .jpg, .gif, .pdf).
- Added a "Preview" button for local mirrors of supported file types.
- Optimized download tables with badge-style links for local/remote
  sources.

Guideline Updates:
- Updated `AGENTS.md` to clarify commit message handling: edit or
  append to `COMMIT_EDITMSG` instead of overwriting.
- Re-emphasized testing rules: use `tsc --noEmit`, do not restart
  dev-server, and avoid `pnpm build` during development.

Signed-off-by: junie@lucy.xalior.com
This commit is contained in:
2026-02-17 14:49:38 +00:00
parent 728b36e45e
commit b158bfc4a0
5 changed files with 176 additions and 5 deletions

View File

@@ -147,7 +147,8 @@ Comment what the code does, not what the agent has done. The documentation's pur
- git branching:
- Do not create new branches
- git commits:
- Create or update COMMIT_EDITMSG file, await any user edits, then commit
- Create or update COMMIT_EDITMSG file if commits pending, await any user
edits, or additional instructions. Once told, commit all the changes
using that commit note, and then delete the COMMIT_EDITMSG file.
Remember to keep the first line as the subject <50char
- git commit messages: