mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2025-04-20 18:20:12 +00:00
handle errors from URL constructor
This commit is contained in:
parent
5a59c4c80b
commit
ebb92473d5
@ -44,18 +44,23 @@ document.getElementById('save-login').addEventListener('click', function () {
|
|||||||
if (!url.includes('://')) {
|
if (!url.includes('://')) {
|
||||||
url = 'http://' + url;
|
url = 'http://' + url;
|
||||||
}
|
}
|
||||||
let parsed = new URL(url);
|
try {
|
||||||
let toStore = {
|
clearError();
|
||||||
access: {
|
let parsed = new URL(url);
|
||||||
url: `${parsed.protocol}//${parsed.hostname}`,
|
let toStore = {
|
||||||
port: parsed.port || (parsed.protocol === 'https:' ? '443' : '80'),
|
access: {
|
||||||
apiKey: document.getElementById('api-key').value,
|
url: `${parsed.protocol}//${parsed.hostname}`,
|
||||||
},
|
port: parsed.port || (parsed.protocol === 'https:' ? '443' : '80'),
|
||||||
};
|
apiKey: document.getElementById('api-key').value,
|
||||||
browserType.storage.local.set(toStore, function () {
|
},
|
||||||
console.log('Stored connection details: ' + JSON.stringify(toStore));
|
};
|
||||||
pingBackend();
|
browserType.storage.local.set(toStore, function () {
|
||||||
});
|
console.log('Stored connection details: ' + JSON.stringify(toStore));
|
||||||
|
pingBackend();
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
setError(e.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// verify connection status
|
// verify connection status
|
||||||
|
Loading…
Reference in New Issue
Block a user