summaryrefslogtreecommitdiff
path: root/frontend/lib
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-08-13 11:33:51 +0100
committerdiogo464 <[email protected]>2025-08-13 11:33:51 +0100
commitca703fd5de303d2101fe2b2a5c0e3037b7507156 (patch)
tree7078378ea380b1cfdf502aa62f2e1ada5708ccac /frontend/lib
parent74069a896a3b831a19baefc0d9487060b34760b3 (diff)
Implement path-based downloads with blob redirect system
- Add fctdrive stat command to get blob IDs from paths - Add Drive_stat function to drive_server.ts for backend integration - Create /download/[...path] endpoint that redirects to /blob/{blobId} - Update UI file links to use /download/ paths instead of direct blob links - Update permalinks to use immutable /blob/{blobId} URLs - Fix host preservation in redirects for remote access 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Diffstat (limited to 'frontend/lib')
-rw-r--r--frontend/lib/drive_server.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/frontend/lib/drive_server.ts b/frontend/lib/drive_server.ts
index 2a94fe9..41b9c71 100644
--- a/frontend/lib/drive_server.ts
+++ b/frontend/lib/drive_server.ts
@@ -108,6 +108,18 @@ export async function Drive_rename(oldPath: string, newPath: string, email: stri
108 } 108 }
109} 109}
110 110
111/// gets the blob ID for a given path
112export async function Drive_stat(path: string): Promise<string> {
113 const result = spawnSync('fctdrive', ['stat', path], { encoding: 'utf-8' });
114 if (result.error) {
115 throw new Error(`Failed to execute fctdrive: ${result.error.message}`);
116 }
117 if (result.status !== 0) {
118 throw new Error(`fctdrive exited with code ${result.status}: ${result.stderr}`);
119 }
120 return result.stdout.trim();
121}
122
111/// builds a filesystem tree from Drive_ls entries 123/// builds a filesystem tree from Drive_ls entries
112export async function Drive_tree(): Promise<DriveTreeResponse> { 124export async function Drive_tree(): Promise<DriveTreeResponse> {
113 const entries = await Drive_ls('/', true); 125 const entries = await Drive_ls('/', true);