Merge pull request #254 from kek-Sec/feat/hide-history
feat: add HIDE_HISTORY option to control visibility of history page
This commit is contained in:
commit
bed52cef17
5 changed files with 42 additions and 28 deletions
|
|
@ -80,6 +80,7 @@ All are optional, JWT_SECRET is recommended to be set.
|
||||||
| AUTO_DELETE_EVERY_N_HOURS | 24 | Checks every n hours for files older then n hours and deletes them, set to 0 to disable |
|
| AUTO_DELETE_EVERY_N_HOURS | 24 | Checks every n hours for files older then n hours and deletes them, set to 0 to disable |
|
||||||
| WEBROOT | | The address to the root path setting this to "/convert" will serve the website on "example.com/convert/" |
|
| WEBROOT | | The address to the root path setting this to "/convert" will serve the website on "example.com/convert/" |
|
||||||
| FFMPEG_ARGS | | Arguments to pass to ffmpeg, e.g. `-preset veryfast` |
|
| FFMPEG_ARGS | | Arguments to pass to ffmpeg, e.g. `-preset veryfast` |
|
||||||
|
| HIDE_HISTORY | false | Hide the history page |
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> If you can't login, make sure you are accessing the service over https or set HTTP_ALLOWED=true
|
> If you can't login, make sure you are accessing the service over https or set HTTP_ALLOWED=true
|
||||||
|
|
|
||||||
34
bun.lock
34
bun.lock
|
|
@ -8,35 +8,35 @@
|
||||||
"@elysiajs/jwt": "^1.2.0",
|
"@elysiajs/jwt": "^1.2.0",
|
||||||
"@elysiajs/static": "^1.2.0",
|
"@elysiajs/static": "^1.2.0",
|
||||||
"@kitajs/html": "^4.2.7",
|
"@kitajs/html": "^4.2.7",
|
||||||
"elysia": "^1.2.12",
|
"elysia": "^1.2.25",
|
||||||
"sanitize-filename": "^1.6.3",
|
"sanitize-filename": "^1.6.3",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.19.0",
|
"@eslint/js": "^9.23.0",
|
||||||
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
|
||||||
"@kitajs/ts-html-plugin": "^4.1.1",
|
"@kitajs/ts-html-plugin": "^4.1.1",
|
||||||
"@tailwindcss/cli": "^4.0.4",
|
"@tailwindcss/cli": "^4.0.17",
|
||||||
"@tailwindcss/postcss": "^4.0.4",
|
"@tailwindcss/postcss": "^4.0.17",
|
||||||
"@total-typescript/ts-reset": "^0.6.1",
|
"@total-typescript/ts-reset": "^0.6.1",
|
||||||
"@types/bun": "^1.2.2",
|
"@types/bun": "^1.2.8",
|
||||||
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
||||||
"@types/node": "^22.13.1",
|
"@types/node": "^22.13.16",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.21",
|
||||||
"cssnano": "^7.0.6",
|
"cssnano": "^7.0.6",
|
||||||
"eslint": "^9.19.0",
|
"eslint": "^9.23.0",
|
||||||
"eslint-plugin-readable-tailwind": "^2.0.0-beta.4",
|
"eslint-plugin-readable-tailwind": "^2.0.0",
|
||||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
"eslint-plugin-tailwindcss": "4.0.0-alpha.0",
|
"eslint-plugin-tailwindcss": "4.0.0-alpha.0",
|
||||||
"globals": "^16.0.0",
|
"globals": "^16.0.0",
|
||||||
"knip": "^5.43.6",
|
"knip": "^5.46.4",
|
||||||
"npm-run-all2": "^7.0.2",
|
"npm-run-all2": "^7.0.2",
|
||||||
"postcss": "^8.5.1",
|
"postcss": "^8.5.3",
|
||||||
"postcss-cli": "^11.0.0",
|
"postcss-cli": "^11.0.1",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.5.3",
|
||||||
"tailwind-scrollbar": "^4.0.0",
|
"tailwind-scrollbar": "^4.0.2",
|
||||||
"tailwindcss": "^4.0.4",
|
"tailwindcss": "^4.0.17",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.8.2",
|
||||||
"typescript-eslint": "^8.23.0",
|
"typescript-eslint": "^8.29.0",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,6 @@ services:
|
||||||
- AUTO_DELETE_EVERY_N_HOURS=1 # checks every n hours for files older then n hours and deletes them, set to 0 to disable
|
- AUTO_DELETE_EVERY_N_HOURS=1 # checks every n hours for files older then n hours and deletes them, set to 0 to disable
|
||||||
# - FFMPEG_ARGS=-hwaccel vulkan # additional arguments to pass to ffmpeg
|
# - FFMPEG_ARGS=-hwaccel vulkan # additional arguments to pass to ffmpeg
|
||||||
# - WEBROOT=/convertx # the root path of the web interface, leave empty to disable
|
# - WEBROOT=/convertx # the root path of the web interface, leave empty to disable
|
||||||
|
# - HIDE_HISTORY=true # hides the history tab in the web interface, defaults to false
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,20 @@ export const Header = ({
|
||||||
loggedIn,
|
loggedIn,
|
||||||
accountRegistration,
|
accountRegistration,
|
||||||
allowUnauthenticated,
|
allowUnauthenticated,
|
||||||
|
hideHistory,
|
||||||
webroot = "",
|
webroot = "",
|
||||||
}: {
|
}: {
|
||||||
loggedIn?: boolean;
|
loggedIn?: boolean;
|
||||||
accountRegistration?: boolean;
|
accountRegistration?: boolean;
|
||||||
allowUnauthenticated?: boolean;
|
allowUnauthenticated?: boolean;
|
||||||
|
hideHistory?: boolean;
|
||||||
webroot?: string;
|
webroot?: string;
|
||||||
}) => {
|
}) => {
|
||||||
let rightNav: JSX.Element;
|
let rightNav: JSX.Element;
|
||||||
if (loggedIn) {
|
if (loggedIn) {
|
||||||
rightNav = (
|
rightNav = (
|
||||||
<ul class="flex gap-4">
|
<ul class="flex gap-4">
|
||||||
|
{!hideHistory && (
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class={`
|
class={`
|
||||||
|
|
@ -26,6 +29,7 @@ export const Header = ({
|
||||||
History
|
History
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
)}
|
||||||
{!allowUnauthenticated ? (
|
{!allowUnauthenticated ? (
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ const ALLOW_UNAUTHENTICATED =
|
||||||
const AUTO_DELETE_EVERY_N_HOURS = process.env.AUTO_DELETE_EVERY_N_HOURS
|
const AUTO_DELETE_EVERY_N_HOURS = process.env.AUTO_DELETE_EVERY_N_HOURS
|
||||||
? Number(process.env.AUTO_DELETE_EVERY_N_HOURS)
|
? Number(process.env.AUTO_DELETE_EVERY_N_HOURS)
|
||||||
: 24;
|
: 24;
|
||||||
|
const HIDE_HISTORY =
|
||||||
|
process.env.HIDE_HISTORY?.toLowerCase() === "true" || false;
|
||||||
|
|
||||||
const WEBROOT = process.env.WEBROOT ?? "";
|
const WEBROOT = process.env.WEBROOT ?? "";
|
||||||
|
|
||||||
|
|
@ -351,6 +353,7 @@ const app = new Elysia({
|
||||||
webroot={WEBROOT}
|
webroot={WEBROOT}
|
||||||
accountRegistration={ACCOUNT_REGISTRATION}
|
accountRegistration={ACCOUNT_REGISTRATION}
|
||||||
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
|
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
|
||||||
|
hideHistory={HIDE_HISTORY}
|
||||||
/>
|
/>
|
||||||
<main
|
<main
|
||||||
class={`
|
class={`
|
||||||
|
|
@ -953,6 +956,10 @@ const app = new Elysia({
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.get("/history", async ({ jwt, redirect, cookie: { auth } }) => {
|
.get("/history", async ({ jwt, redirect, cookie: { auth } }) => {
|
||||||
|
if (HIDE_HISTORY) {
|
||||||
|
return redirect(`${WEBROOT}/`, 302);
|
||||||
|
}
|
||||||
|
|
||||||
if (!auth?.value) {
|
if (!auth?.value) {
|
||||||
return redirect(`${WEBROOT}/login`, 302);
|
return redirect(`${WEBROOT}/login`, 302);
|
||||||
}
|
}
|
||||||
|
|
@ -986,6 +993,7 @@ const app = new Elysia({
|
||||||
<Header
|
<Header
|
||||||
webroot={WEBROOT}
|
webroot={WEBROOT}
|
||||||
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
|
allowUnauthenticated={ALLOW_UNAUTHENTICATED}
|
||||||
|
hideHistory={HIDE_HISTORY}
|
||||||
loggedIn
|
loggedIn
|
||||||
/>
|
/>
|
||||||
<main
|
<main
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue