From cba4bfc8230697df48f15f8e8f7c0a872ed7a190 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 3 Oct 2023 11:22:45 -0700 Subject: [PATCH] no need to specify http in url --- app/src/main/assets/welcome.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/assets/welcome.html b/app/src/main/assets/welcome.html index 84da0d32..23b87b5d 100644 --- a/app/src/main/assets/welcome.html +++ b/app/src/main/assets/welcome.html @@ -49,12 +49,20 @@ } } + function getUrl() { + const url = urlBox.value.toLowerCase(); + if (!url.startsWith("http://") && !url.startsWith("https://")) { + return "https://" + url; + } + return url; + } + function updateLoginEnabled() { - loginButton.disabled = !validateUrl(urlBox.value); + loginButton.disabled = !validateUrl(getUrl()); } function getMemoriesUrl() { - const url = new URL(urlBox.value); + const url = new URL(getUrl()); // Add trailing slash to the path if it's not there already if (!url.pathname.endsWith("/")) {