admin/config: title
Massimo Melina committed
Feb 24, 2023 at 17:44 UTC
38dcf6e2a34b4358d97a968082fcfdc8c1662c24
4 files changed
+8
-5
admin/src/ConfigPage.ts
+4
-3
@@ -107,9 +107,8 @@ export default function ConfigPage() {
107
getError: x => !x && admins?.length===0 && "First create at least one admin account",
108
helperText: "To access Admin without entering credentials"
109
},
110
- { k: 'dont_overwrite_uploading', comp: BoolField, label: "Don't overwrite uploading",
111
- helperText: "Files will be numbered to avoid overwriting" },
112
- { k: 'favicon', comp: FileField, fileMask: '*.png|*.ico|*.jpg|*.jpeg|*.gif|*.svg',
110
+ { k: 'title', helperText: "You can see this in the tab of your browser" },
111
+ { k: 'favicon', comp: FileField, placeholder: "None", fileMask: '*.png|*.ico|*.jpg|*.jpeg|*.gif|*.svg',
112
helperText: "The icon associated to your website" },
113
{ k: 'log', label: logLabels.log, md: 3, helperText: "Requests are logged here" },
114
{ k: 'error_log', label: logLabels.error_log, md: 3, placeholder: "errors go to main log", helperText: "If you want errors in a different log" },
@@ -121,6 +120,8 @@ export default function ConfigPage() {
120
helperText: "Wrong number will prevent detection of users' IP address"
121
},
122
{ k: 'allowed_referer', placeholder: "any", label: "Links from other websites", comp: AllowedReferer },
123
+ { k: 'dont_overwrite_uploading', comp: BoolField, label: "Don't overwrite uploading",
124
+ helperText: "Files will be numbered to avoid overwriting" },
125
{ k: 'delete_unfinished_uploads_after', comp: NumberField, md: 3, min : 0, unit: "seconds", placeholder: "Never",
126
helperText: "Leave empty to never delete" },
127
{ k: 'min_available_mb', comp: NumberField, md: 3, min : 0, unit: "MBytes", placeholder: "None",
frontend/index.html
+1
-1
@@ -6,7 +6,7 @@
6
<link href="/fontello.css" rel="stylesheet" />
7
<link rel="icon"/>
8
<script>SESSION = _HFS_SESSION_</script>
9
- <title>File Server</title>
9
+ <title>_HFS_TITLE_</title>
10
</head>
11
<body>
12
<noscript>You need to enable JavaScript to run this app.</noscript>
src/adminApis.ts
+1
@@ -155,6 +155,7 @@ for (const [k, was] of Object.entries(adminApis))
155
156
export const localhostAdmin = defineConfig('localhost_admin', true)
157
export const favicon = defineConfig<string>('favicon')
158
+export const title = defineConfig('title', "File server")
159
160
export function ctxAdminAccess(ctx: Koa.Context) {
161
return !ctx.state.proxiedFor // we consider localhost_admin only if no proxy is detected
src/serveGuiFiles.ts
+2
-1
@@ -9,7 +9,7 @@ import { refresh_session } from './api.auth'
9
import { ApiError } from './apiMiddleware'
10
import { join, extname } from 'path'
11
import { getOrSet } from './misc'
12
-import { favicon } from './adminApis'
12
+import { favicon, title } from './adminApis'
13
14
// in case of dev env we have our static files within the 'dist' folder'
15
const DEV_STATIC = process.env.DEV ? 'dist/' : ''
@@ -59,6 +59,7 @@ async function treatIndex(ctx: Koa.Context, body: string, filesUri: string) {
59
return body
60
.replace(/((?:src|href) *= *['"])\/?(?![a-z]+:\/\/)/g, '$1' + filesUri)
61
.replace('<link rel="icon"/>', `<link rel="icon" href="${favicon.get() ? '/favicon.ico' : 'data:;'}" />`)
62
+ .replace('_HFS_TITLE_', title.get())
63
.replace('_HFS_SESSION_', session instanceof ApiError ? 'null' : JSON.stringify(session))
64
// replacing this text allow us to avoid injecting in frontends that don't support plugins. Don't use a <--comment--> or it will be removed by webpack
65
.replace('_HFS_PLUGINS_', pluginsInjection)