Add save actions and cross-platform file manager support (#848)

* files-download-feature

* feat: add save option to file directory context menus and viewer

* fix: open files in the system file manager
This commit is contained in:
Dave Otero
2026-04-16 23:33:55 +03:00
committed by GitHub
parent 79a9f93ae2
commit fd8972a7d9
7 changed files with 102 additions and 6 deletions
+11
View File
@@ -211,4 +211,15 @@ export const createWebFilesAPI = (): FilesAPI => ({
const result = await response.json().catch(() => ({}));
return { success: Boolean((result as { success?: boolean }).success) };
},
async downloadFile(path: string): Promise<void> {
const target = normalizePath(path);
const url = `/api/fs/raw?path=${encodeURIComponent(target)}&download=true`;
const a = document.createElement('a');
a.href = url;
a.download = target.split('/').pop() || 'file';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
},
});