Sharing fixes, live preview
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m19s

This commit is contained in:
Elijah 2026-05-22 19:19:15 -07:00
parent 27fd6fa4f5
commit a52f1d63f7
4 changed files with 350 additions and 92 deletions

View file

@ -351,9 +351,13 @@ class ApiClient {
return res.json();
}
async getPublicShare(id: string, password?: string) {
async getPublicShare(id: string, password?: string, path?: string) {
// Note: No auth headers here, so we use fetch directly to avoid interceptors
const res = await fetch(`${API_BASE}/api/public/share/${id}`, {
let url = `${API_BASE}/api/public/share/${id}`;
if (path) {
url += `?path=${encodeURIComponent(path)}`;
}
const res = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ password }),
@ -365,10 +369,14 @@ class ApiClient {
return res.json();
}
getPublicDownloadUrl(id: string, password?: string) {
getPublicDownloadUrl(id: string, password?: string, path?: string) {
let url = `${API_BASE}/api/public/download/${id}`;
if (password) {
url += `?pwd=${encodeURIComponent(password)}`;
const params = new URLSearchParams();
if (password) params.set('pwd', password);
if (path) params.set('path', path);
const qs = params.toString();
if (qs) {
url += `?${qs}`;
}
return url;
}