Proxy local ZXDB/WoS mirror downloads through application API
- Created `src/app/api/zxdb/download/route.ts` to serve local files. - Updated `resolveLocalLink` in `src/server/repo/zxdb.ts` to return API-relative URLs with `source` and `path` parameters. - Encodes the relative subpath to ensure correct URL construction. - Includes security checks in the API route to prevent path traversal. - Updated `docs/ZXDB.md` to reflect the proxy mechanism. Signed-off: junie@lucy.xalior.com
This commit is contained in:
@@ -63,7 +63,7 @@ WOS_FILE_PREFIX=/pub/sinclair/
|
||||
2. It strips the prefix from the database link.
|
||||
3. It joins the remaining relative path to the corresponding `*_LOCAL_FILEPATH`.
|
||||
4. It checks if the file exists on the local disk.
|
||||
5. If the file exists and the environment variable is set, a "Local Mirror" link is displayed in the UI.
|
||||
5. If the file exists and the environment variable is set, a "Local Mirror" link is displayed in the UI, pointing to a proxy download API (`/api/zxdb/download`).
|
||||
|
||||
Note: Obtaining these mirrors is left as an exercise to the host. The paths do not need to share a common parent directory. Both mirrors are optional and independent; you can configure one, both, or neither.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user