fix login
This commit is contained in:
parent
ac8f44b4c1
commit
8a32c2d31f
3 changed files with 13 additions and 10 deletions
|
|
@ -7,7 +7,7 @@ export const Header = ({ loggedIn }: { loggedIn?: boolean }) => {
|
||||||
<a href="/test">History</a>
|
<a href="/test">History</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/logout">Logout</a>
|
<a href="/logoff">Logout</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@ export const normalizeOutputFiletype = (filetype: string): string => {
|
||||||
switch (lowercaseFiletype) {
|
switch (lowercaseFiletype) {
|
||||||
case "jpeg":
|
case "jpeg":
|
||||||
return "jpg";
|
return "jpg";
|
||||||
case "mpeg4":
|
|
||||||
return "mp4";
|
|
||||||
default:
|
default:
|
||||||
return lowercaseFiletype;
|
return lowercaseFiletype;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@ import {
|
||||||
getAllTargets,
|
getAllTargets,
|
||||||
getAllInputs,
|
getAllInputs,
|
||||||
} from "./converters/main";
|
} from "./converters/main";
|
||||||
import { normalizeFiletype } from "./helpers/normalizeFiletype";
|
import {
|
||||||
|
normalizeFiletype,
|
||||||
|
normalizeOutputFiletype,
|
||||||
|
} from "./helpers/normalizeFiletype";
|
||||||
|
|
||||||
const db = new Database("./data/mydb.sqlite", { create: true });
|
const db = new Database("./data/mydb.sqlite", { create: true });
|
||||||
const uploadsDir = "./data/uploads/";
|
const uploadsDir = "./data/uploads/";
|
||||||
|
|
@ -336,18 +339,18 @@ const app = new Elysia()
|
||||||
sameSite: "strict",
|
sameSite: "strict",
|
||||||
});
|
});
|
||||||
|
|
||||||
redirect("/");
|
return redirect("/");
|
||||||
},
|
},
|
||||||
{ body: t.Object({ email: t.String(), password: t.String() }) },
|
{ body: t.Object({ email: t.String(), password: t.String() }) },
|
||||||
)
|
)
|
||||||
.get("/logout", ({ redirect, cookie: { auth } }) => {
|
.get("/logoff", ({ redirect, cookie: { auth } }) => {
|
||||||
if (auth?.value) {
|
if (auth?.value) {
|
||||||
auth.remove();
|
auth.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect("/login");
|
return redirect("/login");
|
||||||
})
|
})
|
||||||
.post("/logout", ({ redirect, cookie: { auth } }) => {
|
.post("/logoff", ({ redirect, cookie: { auth } }) => {
|
||||||
if (auth?.value) {
|
if (auth?.value) {
|
||||||
auth.remove();
|
auth.remove();
|
||||||
}
|
}
|
||||||
|
|
@ -415,7 +418,7 @@ const app = new Elysia()
|
||||||
</div>
|
</div>
|
||||||
<input type="file" name="file" multiple />
|
<input type="file" name="file" multiple />
|
||||||
{/* <label for="convert_from">Convert from</label> */}
|
{/* <label for="convert_from">Convert from</label> */}
|
||||||
<select name="convert_from" aria-label="Convert from" required>
|
{/* <select name="convert_from" aria-label="Convert from" required>
|
||||||
<option selected disabled value="">
|
<option selected disabled value="">
|
||||||
Convert from
|
Convert from
|
||||||
</option>
|
</option>
|
||||||
|
|
@ -423,7 +426,7 @@ const app = new Elysia()
|
||||||
// biome-ignore lint/correctness/useJsxKeyInIterable: <explanation>
|
// biome-ignore lint/correctness/useJsxKeyInIterable: <explanation>
|
||||||
<option>{input}</option>
|
<option>{input}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select> */}
|
||||||
</article>
|
</article>
|
||||||
<form method="post" action="/convert">
|
<form method="post" action="/convert">
|
||||||
<input type="hidden" name="file_names" id="file_names" />
|
<input type="hidden" name="file_names" id="file_names" />
|
||||||
|
|
@ -616,7 +619,7 @@ const app = new Elysia()
|
||||||
const fileTypeOrig = fileName.split(".").pop() as string;
|
const fileTypeOrig = fileName.split(".").pop() as string;
|
||||||
const fileType = normalizeFiletype(fileTypeOrig);
|
const fileType = normalizeFiletype(fileTypeOrig);
|
||||||
const newFileExt = normalizeOutputFiletype(convertTo);
|
const newFileExt = normalizeOutputFiletype(convertTo);
|
||||||
const newFileName = fileName.replace(fileTypeOrig, convertTo);
|
const newFileName = fileName.replace(fileTypeOrig, newFileExt);
|
||||||
const targetPath = `${userOutputDir}${newFileName}`;
|
const targetPath = `${userOutputDir}${newFileName}`;
|
||||||
|
|
||||||
await mainConverter(
|
await mainConverter(
|
||||||
|
|
@ -863,6 +866,7 @@ const app = new Elysia()
|
||||||
Count: {inputs.length}
|
Count: {inputs.length}
|
||||||
<ul>
|
<ul>
|
||||||
{inputs.map((input) => (
|
{inputs.map((input) => (
|
||||||
|
// biome-ignore lint/correctness/useJsxKeyInIterable: <explanation>
|
||||||
<li>{input}</li>
|
<li>{input}</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -871,6 +875,7 @@ const app = new Elysia()
|
||||||
Count: {targets.length}
|
Count: {targets.length}
|
||||||
<ul>
|
<ul>
|
||||||
{targets.map((target) => (
|
{targets.map((target) => (
|
||||||
|
// biome-ignore lint/correctness/useJsxKeyInIterable: <explanation>
|
||||||
<li>{target}</li>
|
<li>{target}</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue