basic selection + download multiple files with selection

This commit is contained in:
2025-09-02 18:08:13 +02:00
parent be46f92ddf
commit e2085c1baa
22 changed files with 516 additions and 156 deletions

View File

@@ -149,7 +149,7 @@ export async function fetchShareFile(
password: string | null
): Promise<{ success: true; data: Blob } | { success: false }> {
const { data } = await useFetch<Blob>(
getApiUrl(`warrens/files/cat_share?shareId=${shareId}&path=${path}`),
getApiUrl(`warrens/files/cat_share?shareId=${shareId}&paths=${path}`),
{
method: 'GET',
headers:

View File

@@ -273,14 +273,27 @@ export async function fetchFile(
warrenId: string,
path: string,
fileName: string
): Promise<{ success: true; data: Blob } | { success: false }> {
return fetchFiles(warrenId, path, [fileName]);
}
export async function fetchFiles(
warrenId: string,
path: string,
fileNames: string[]
): Promise<{ success: true; data: Blob } | { success: false }> {
if (!path.endsWith('/')) {
path += '/';
}
path += fileName;
const paths = [];
for (const fileName of fileNames) {
paths.push(path + fileName);
}
const { data, error } = await useFetch<Blob>(
getApiUrl(`warrens/files/cat?warrenId=${warrenId}&path=${path}`),
getApiUrl(
`warrens/files/cat?warrenId=${warrenId}&paths=${paths.join(':')}`
),
{
method: 'GET',
headers: getApiHeaders(),
@@ -314,7 +327,7 @@ export async function fetchFileStream(
path += fileName;
const { data, error } = await useFetch<ReadableStream<Uint8Array>>(
getApiUrl(`warrens/files/cat?warrenId=${warrenId}&path=${path}`),
getApiUrl(`warrens/files/cat?warrenId=${warrenId}&paths=${path}`),
{
method: 'GET',
headers: getApiHeaders(),