Properly ask for permissions when changing the server address

This commit is contained in:
Ajay Ramachandran
2020-03-10 00:48:53 -04:00
parent 2ec47d52cd
commit f0bf051259

View File

@@ -72,7 +72,7 @@ async function init() {
textChangeInput.value = Config.config[textChangeOption];
textChangeSetButton.addEventListener("click", () => {
textChangeSetButton.addEventListener("click", async () => {
// See if anything extra must be done
switch (textChangeOption) {
case "serverAddress":
@@ -84,6 +84,18 @@ async function init() {
return;
}
// Permission needed on Firefox
if (utils.isFirefox()) {
let permissionSuccess = await new Promise((resolve, reject) => {
chrome.permissions.request({
origins: [textChangeInput.value + "/"],
permissions: []
}, resolve);
});
if (!permissionSuccess) return;
}
break;
}