mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2024-11-22 11:40:13 +00:00
use full url
This commit is contained in:
parent
d5f5557e06
commit
afbcb5757e
@ -16,7 +16,7 @@ function getBrowser() {
|
|||||||
return chrome;
|
return chrome;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("failed to dedect browser");
|
console.log("failed to detect browser");
|
||||||
throw "browser detection error"
|
throw "browser detection error"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<form class="login-form">
|
<form class="login-form">
|
||||||
<label for="url">Tube Archivist URL:</label>
|
<label for="full-url">Tube Archivist URL:</label>
|
||||||
<input type="text" id="url" name="url">
|
<input type="text" id="full-url" name="url">
|
||||||
<label for="port">Tube Archivist Port:</label>
|
|
||||||
<input type="text" id="port" name="port">
|
|
||||||
<label for="api-key">Tube Archivist API Key:</label>
|
<label for="api-key">Tube Archivist API Key:</label>
|
||||||
<input type="password" id="api-key" name="api-key">
|
<input type="password" id="api-key" name="api-key">
|
||||||
</form>
|
</form>
|
||||||
|
@ -21,10 +21,15 @@ function getBrowser() {
|
|||||||
|
|
||||||
// store access details
|
// store access details
|
||||||
document.getElementById("save-login").addEventListener("click", function () {
|
document.getElementById("save-login").addEventListener("click", function () {
|
||||||
|
let url = document.getElementById("url").value;
|
||||||
|
if (!url.includes('://')) {
|
||||||
|
url = 'http://' + url;
|
||||||
|
}
|
||||||
|
let parsed = new URL(url);
|
||||||
let toStore = {
|
let toStore = {
|
||||||
"access": {
|
"access": {
|
||||||
"url": document.getElementById("url").value,
|
"url": document.getElementById("full-url").host,
|
||||||
"port": document.getElementById("port").value,
|
"port": document.getElementById("port").port || '80',
|
||||||
"apiKey": document.getElementById("api-key").value
|
"apiKey": document.getElementById("api-key").value
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -150,8 +155,12 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
setStatusIcon(false);
|
setStatusIcon(false);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
document.getElementById("url").value = item.access.url;
|
let { url, port } = item.access;
|
||||||
document.getElementById("port").value = item.access.port;
|
let fullUrl = url;
|
||||||
|
if (!(url.startsWith('http://') && port === '80')) {
|
||||||
|
fullUrl += `:${port}`;
|
||||||
|
}
|
||||||
|
document.getElementById("full-url").value = fullUrl;
|
||||||
document.getElementById("api-key").value = item.access.apiKey;
|
document.getElementById("api-key").value = item.access.apiKey;
|
||||||
pingBackend();
|
pingBackend();
|
||||||
addUrl(item.access);
|
addUrl(item.access);
|
||||||
|
Loading…
Reference in New Issue
Block a user