no need to specify http in url

pull/653/merge
Varun Patil 2023-10-03 11:22:45 -07:00
parent 1a4d01f387
commit cba4bfc823
1 changed files with 10 additions and 2 deletions

View File

@ -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() { function updateLoginEnabled() {
loginButton.disabled = !validateUrl(urlBox.value); loginButton.disabled = !validateUrl(getUrl());
} }
function getMemoriesUrl() { 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 // Add trailing slash to the path if it's not there already
if (!url.pathname.endsWith("/")) { if (!url.pathname.endsWith("/")) {