admin/config: nicer
Massimo Melina committed
Feb 24, 2023 at 14:21 UTC
8f0c4ea5f9f51ca2e1c0e5b2a73071ef4bff085f
1 file changed
+14
-15
admin/src/ConfigPage.ts
+14
-15
@@ -57,6 +57,7 @@ export default function ConfigPage() {
57
comp: NumberField,
58
min: 1,
59
placeholder: "no limit",
60
+ md: 3,
61
}
62
return h(Form, {
63
sx: { maxWidth: '60em' },
@@ -78,14 +79,12 @@ export default function ConfigPage() {
79
},
80
startIcon: h(Refresh),
81
}, "Reload")],
81
- defaults({ comp }) {
82
- return comp === ServerPort ? { sm: 6, md: 3 }
83
- : comp === NumberField ? { sm: 3 }
84
- : { sm: 6 }
82
+ defaults() {
83
+ return { sm: 6 }
84
},
85
fields: [
87
- { k: 'port', comp: ServerPort, label:"HTTP port", status: status?.http||true, suggestedPort: 80 },
88
- { k: 'https_port', comp: ServerPort, label: "HTTPS port", status: status?.https||true, suggestedPort: 443,
86
+ { k: 'port', comp: ServerPort, md: 3, label:"HTTP port", status: status?.http||true, suggestedPort: 80 },
87
+ { k: 'https_port', comp: ServerPort, md: 3, label: "HTTPS port", status: status?.https||true, suggestedPort: 443,
88
onChange(v: number) {
89
if (v >= 0 && values.https_port < 0 && !values.cert)
90
suggestMakingCert()
@@ -103,11 +102,15 @@ export default function ConfigPage() {
102
values.https_port >= 0 && { k: 'private_key', comp: FileField, label: "HTTPS private key file",
103
...with_(status?.https.error, e => isKeyError(e) ? { error: true, helperText: e } : null)
104
},
106
- { k: 'open_browser_at_start', comp: BoolField },
107
- { k: 'localhost_admin', comp: BoolField, sm: 12, md: 6, label: "Admin access for localhost connections",
105
+ { k: 'open_browser_at_start', comp: BoolField, label: "Open Admin-panel at start", helperText: "Browser is automatically launched with HFS" },
106
+ { k: 'localhost_admin', comp: BoolField, label: "Admin access for localhost connections",
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',
113
+ helperText: "The icon associated to your website" },
114
{ k: 'log', label: logLabels.log, md: 3, helperText: "Requests are logged here" },
115
{ k: 'error_log', label: logLabels.error_log, md: 3, placeholder: "errors go to main log", helperText: "If you want errors in a different log" },
116
{ k: 'log_rotation', comp: SelectField, options: [{ value:'', label:"disabled" }, 'daily', 'weekly', 'monthly' ],
@@ -118,16 +121,12 @@ export default function ConfigPage() {
121
helperText: "Wrong number will prevent detection of users' IP address"
122
},
123
{ k: 'allowed_referer', placeholder: "any", label: "Links from other websites", comp: AllowedReferer },
121
- { k: 'delete_unfinished_uploads_after', comp: NumberField, sm: 6, md: 3, min : 0, unit: "seconds", placeholder: "Never",
124
+ { k: 'delete_unfinished_uploads_after', comp: NumberField, md: 3, min : 0, unit: "seconds", placeholder: "Never",
125
helperText: "Leave empty to never delete" },
123
- { k: 'min_available_mb', comp: NumberField, sm: 6, md: 3, min : 0, unit: "MBytes", placeholder: "None",
126
+ { k: 'min_available_mb', comp: NumberField, md: 3, min : 0, unit: "MBytes", placeholder: "None",
127
label: "Min. available disk space", helperText: "Reject uploads that don't comply" },
125
- { k: 'zip_calculate_size_for_seconds', comp: NumberField, sm: 6, label: "Calculate ZIP size for", unit: "seconds",
128
+ { k: 'zip_calculate_size_for_seconds', comp: NumberField, label: "Calculate ZIP size for", unit: "seconds",
129
helperText: "If time is not enough, the browser will not show download percentage" },
127
- { k: 'favicon', comp: FileField, sm: 6, md: 6, fileMask: '*.png|*.ico|*.jpg|*.jpeg|*.gif|*.svg',
128
- helperText: "The icon associated to your website" },
129
- { k: 'dont_overwrite_uploading', comp: BoolField, md: 4, label: "Don't overwrite uploading",
130
- helperText: "Files will be numbered to avoid overwriting" },
130
{ k: 'custom_header', multiline: true, sm: 12, md: 6, sx: { '& textarea': { fontFamily: 'monospace' } },
131
helperText: "Any HTML code here will be displayed on top of the Frontend"
132
},