From 9fc3e9082f035aa28382f3e6424b6456e559a9e4 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Thu, 29 Feb 2024 21:36:04 +0000 Subject: [PATCH] feat: automatically prefix backend url with https:// if not provided --- src/pages/Settings.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index 5fe8843b..eec41eb2 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -208,7 +208,13 @@ export function SettingsPage() { // when backend url gets changed, log the user out first if (state.backendUrl.changed) { await logout(); - setBackendUrl(state.backendUrl.state); + + let url = state.backendUrl.state; + if (url && !url.startsWith("http://") && !url.startsWith("https://")) { + url = `https://${url}`; + } + + setBackendUrl(url); } }, [ state,