mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 20:47:11 +03:00
Properly ask for permissions when changing the server address
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user