From f863504721d5e600a8947378425302e6a44fd337 Mon Sep 17 00:00:00 2001 From: Massimo Melina Date: Sun, 13 Feb 2022 21:05:42 +0100 Subject: [PATCH] admin/config: suggested ports that make sense instead of 1 --- admin/src/ConfigPage.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/src/ConfigPage.ts b/admin/src/ConfigPage.ts index 6218dc325..87cbbe88c 100644 --- a/admin/src/ConfigPage.ts +++ b/admin/src/ConfigPage.ts @@ -48,8 +48,8 @@ export default function ConfigPage() { return { md: shortField ? 3 : 6 } }, fields: [ - { k: 'port', comp: ServerPort, label:'HTTP port', status: status?.http||true }, - { k: 'https_port', comp: ServerPort, label: 'HTTPS port', status: status?.https||true }, + { k: 'port', comp: ServerPort, label:'HTTP port', status: status?.http||true, suggestedPort: 80 }, + { k: 'https_port', comp: ServerPort, label: 'HTTPS port', status: status?.https||true, suggestedPort: 443 }, config.https_port >= 0 && { k: 'cert', comp: StringField, label: 'HTTPS certificate file' }, config.https_port >= 0 && { k: 'private_key', comp: StringField, label: 'HTTPS private key file' }, { k: 'admin_port', comp: ServerPort, label: 'Admin port' }, @@ -92,8 +92,8 @@ function recalculateChanges() { state.changes = changes } -function ServerPort({ label, value, onChange, status }: FieldProps) { - const lastCustom = useRef(1) +function ServerPort({ label, value, onChange, status, suggestedPort=1 }: FieldProps) { + const lastCustom = useRef(suggestedPort) if (value! > 0) lastCustom.current = value! const selectValue = Number(value! > 0 ? lastCustom.current : value) || 0