refactor: API route for backup/restore

This commit is contained in:
charlesgauthereau
2026-01-17 17:27:33 +01:00
parent 0216c40bfe
commit 7d818206b0
14 changed files with 415 additions and 237 deletions
+8 -1
View File
@@ -49,11 +49,18 @@ export async function getLocal(
const expiresAt = Date.now() + 60 * 1000;
const token = crypto.createHash("sha256").update(`${fileName}${expiresAt}`).digest("hex");
const params = new URLSearchParams({
path: input.data.path,
token,
expires: expiresAt.toString(),
});
return {
success: true,
provider: 'local',
file: file,
url: `${baseUrl}/api/files/${fileName}?token=${token}&expires=${expiresAt}`,
url: `${baseUrl}/api/files/?${params.toString()}`,
};
}