Files
explorer/example.env
D. Rimron-Soutter b158bfc4a0 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
2026-02-17 14:49:38 +00:00

41 lines
1.6 KiB
Bash

# System hostname for permalinks (mandatory)
HOSTNAME=localhost
# HTTP varient (mandatory)
PROTO=http
# ZXDB MySQL connection URL (mandatory)
# Example using a readonly user created by ZXDB scripts
# CREATE ROLE 'zxdb_readonly';
# GRANT SELECT, SHOW VIEW ON `zxdb`.* TO 'zxdb_readonly';
# See docs/ZXDB.md for full setup instructions (DB import, helper tables,
# readonly role, and environment validation notes).
ZXDB_URL=mysql://zxdb_readonly:password@hostname:3306/zxdb
# Base HTTP locations for CDN sources used by downloads.file_link
# When file_link starts with /zxdb, it will be fetched from ZXDB_REMOTE_FILEPATH
ZXDB_REMOTE_FILEPATH=https://zxdbfiles.com/
# When file_link starts with /public, it will be fetched from WOS_REMOTE_FILEPATH
# Note: Example uses the Internet Archive WoS mirror; keep the trailing slash
WOS_REMOTE_FILEPATH=https://archive.org/download/World_of_Spectrum_June_2017_Mirror/World%20of%20Spectrum%20June%202017%20Mirror.zip/World%20of%20Spectrum%20June%202017%20Mirror/
# Local mirror filesystem paths for downloads.
# Enabling these (and verifying existence) will show "Local Mirror" links.
# See docs/ZXDB.md for how prefixes are stripped and joined to these paths.
# ZXDB_LOCAL_FILEPATH=/path/to/local/zxdb/mirror
# WOS_LOCAL_FILEPATH=/path/to/local/wos/mirror
# Optional: Path prefixes to strip from database links before local matching.
# ZXDB_FILE_PREFIX=/zxdb/sinclair/
# WOS_FILE_PREFIX=/pub/sinclair/
# OIDC Authentication configuration
# OIDC_PROVIDER_URL=
# OIDC_CLIENT_ID=
# OIDC_CLIENT_SECRET=
# Redis cache URL (e.g. redis://host:6379)
# CACHE_URL=
# SMTP mail URL (e.g. smtp://user:pass@host:587)
# MAIL_URL=