feat: add delete button in history (#440)

This commit is contained in:
Emrik Östling 2025-11-16 00:34:49 +01:00 committed by GitHub
parent 0096a6f197
commit 64264a41d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 122 additions and 104 deletions

View file

@ -12,6 +12,7 @@ export const download = new Elysia()
.get(
"/download/:userId/:jobId/:fileName",
async ({ params, redirect, user }) => {
const userId = user.id;
const job = await db
.query("SELECT * FROM jobs WHERE user_id = ? AND id = ?")
.get(user.id, params.jobId);
@ -20,7 +21,6 @@ export const download = new Elysia()
return redirect(`${WEBROOT}/results`, 302);
}
// parse from URL encoded string
const userId = decodeURIComponent(params.userId);
const jobId = decodeURIComponent(params.jobId);
const fileName = sanitize(decodeURIComponent(params.fileName));
@ -32,8 +32,9 @@ export const download = new Elysia()
},
)
.get(
"/archive/:userId/:jobId",
"/archive/:jobId",
async ({ params, redirect, user }) => {
const userId = user.id;
const job = await db
.query("SELECT * FROM jobs WHERE user_id = ? AND id = ?")
.get(user.id, params.jobId);
@ -42,7 +43,6 @@ export const download = new Elysia()
return redirect(`${WEBROOT}/results`, 302);
}
const userId = decodeURIComponent(params.userId);
const jobId = decodeURIComponent(params.jobId);
const outputPath = `${outputDir}${userId}/${jobId}`;
const outputTar = path.join(outputPath, `converted_files_${jobId}.tar`);