Misc fixes and additions
Some checks failed
Automated Container Build / build-and-push (push) Failing after 8s

This commit is contained in:
Elijah 2026-05-22 14:27:45 -07:00
parent 724d70e58b
commit 02eefdac0e
9 changed files with 311 additions and 65 deletions

View file

@ -139,7 +139,7 @@ class ApiClient {
// --- Files ---
async listDirectory(path: string = '.') {
const res = await this.request(`/api/files/${encodeURIComponent(path)}`);
const res = await this.request(`/api/files/?path=${encodeURIComponent(path)}`);
return res.json();
}
@ -182,10 +182,11 @@ class ApiClient {
return res.json();
}
upload(file: File, destPath: string): Promise<void> {
upload(file: File, destPath: string, callbacks?: { onProgress?: (percent: number) => void }): Promise<void> {
return new Promise((resolve, reject) => {
const upload = new tus.Upload(file, {
endpoint: `${API_BASE}/api/tus/`,
chunkSize: 5 * 1024 * 1024, // 5MB chunks bypass Next.js 10MB proxy limit
retryDelays: [0, 3000, 5000, 10000, 20000],
headers: this.getStreamHeaders(),
metadata: {
@ -197,8 +198,8 @@ class ApiClient {
reject(error);
},
onProgress: function (bytesUploaded, bytesTotal) {
const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
console.log(bytesUploaded, bytesTotal, percentage + '%');
const percentage = (bytesUploaded / bytesTotal) * 100;
callbacks?.onProgress?.(percentage);
},
onSuccess: function () {
resolve();
@ -209,8 +210,8 @@ class ApiClient {
}
getDownloadUrl(path: string) {
const url = `${API_BASE}/api/files/download/${encodeURIComponent(path)}`;
return this.accessToken ? `${url}?token=${this.accessToken}` : url;
const url = `${API_BASE}/api/files/download/?path=${encodeURIComponent(path)}`;
return this.accessToken ? `${url}&token=${this.accessToken}` : url;
}
getThumbnailUrl(checksum: string) {