From 8a32c2d31f27ce78f5780311e4621823f386d337 Mon Sep 17 00:00:00 2001 From: C4illin Date: Sat, 25 May 2024 00:51:07 +0200 Subject: [PATCH] fix login --- src/components/header.tsx | 2 +- src/helpers/normalizeFiletype.ts | 2 -- src/index.tsx | 19 ++++++++++++------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/header.tsx b/src/components/header.tsx index 15ae929..21aab6a 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -7,7 +7,7 @@ export const Header = ({ loggedIn }: { loggedIn?: boolean }) => { History
  • - Logout + Logout
  • ); diff --git a/src/helpers/normalizeFiletype.ts b/src/helpers/normalizeFiletype.ts index c1389f2..989b5cb 100644 --- a/src/helpers/normalizeFiletype.ts +++ b/src/helpers/normalizeFiletype.ts @@ -17,8 +17,6 @@ export const normalizeOutputFiletype = (filetype: string): string => { switch (lowercaseFiletype) { case "jpeg": return "jpg"; - case "mpeg4": - return "mp4"; default: return lowercaseFiletype; } diff --git a/src/index.tsx b/src/index.tsx index 7b8bb51..37ed6cf 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -15,7 +15,10 @@ import { getAllTargets, getAllInputs, } from "./converters/main"; -import { normalizeFiletype } from "./helpers/normalizeFiletype"; +import { + normalizeFiletype, + normalizeOutputFiletype, +} from "./helpers/normalizeFiletype"; const db = new Database("./data/mydb.sqlite", { create: true }); const uploadsDir = "./data/uploads/"; @@ -336,18 +339,18 @@ const app = new Elysia() sameSite: "strict", }); - redirect("/"); + return redirect("/"); }, { body: t.Object({ email: t.String(), password: t.String() }) }, ) - .get("/logout", ({ redirect, cookie: { auth } }) => { + .get("/logoff", ({ redirect, cookie: { auth } }) => { if (auth?.value) { auth.remove(); } return redirect("/login"); }) - .post("/logout", ({ redirect, cookie: { auth } }) => { + .post("/logoff", ({ redirect, cookie: { auth } }) => { if (auth?.value) { auth.remove(); } @@ -415,7 +418,7 @@ const app = new Elysia() {/* */} - @@ -423,7 +426,7 @@ const app = new Elysia() // biome-ignore lint/correctness/useJsxKeyInIterable: ))} - + */}
    @@ -616,7 +619,7 @@ const app = new Elysia() const fileTypeOrig = fileName.split(".").pop() as string; const fileType = normalizeFiletype(fileTypeOrig); const newFileExt = normalizeOutputFiletype(convertTo); - const newFileName = fileName.replace(fileTypeOrig, convertTo); + const newFileName = fileName.replace(fileTypeOrig, newFileExt); const targetPath = `${userOutputDir}${newFileName}`; await mainConverter( @@ -863,6 +866,7 @@ const app = new Elysia() Count: {inputs.length}
      {inputs.map((input) => ( + // biome-ignore lint/correctness/useJsxKeyInIterable:
    • {input}
    • ))}
    @@ -871,6 +875,7 @@ const app = new Elysia() Count: {targets.length}
      {targets.map((target) => ( + // biome-ignore lint/correctness/useJsxKeyInIterable:
    • {target}
    • ))}