Only ask for permission once

This commit is contained in:
Ajay Ramachandran
2021-05-12 17:00:31 -04:00
parent dc5ecaded4
commit 11144fa77b
3 changed files with 5 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ interface SBConfig {
testingServer: boolean,
hashPrefix: boolean,
refetchWhenNotFound: boolean,
ytInfoPermissionGranted: boolean,
// What categories should be skipped
categorySelections: CategorySelection[],
@@ -169,6 +170,7 @@ const Config: SBObject = {
testingServer: false,
hashPrefix: true,
refetchWhenNotFound: true,
ytInfoPermissionGranted: false,
categorySelections: [{
name: "sponsor",

View File

@@ -733,7 +733,7 @@ async function getVideoInfo(): Promise<void> {
async function videoInfoFetchFailed(errorMessage: string): Promise<void> {
console.log("failed\t" + errorMessage)
if (utils.isFirefox()) {
if (utils.isFirefox() && !Config.config.ytInfoPermissionGranted) {
// Attempt to ask permission for youtube.com domain
alert(chrome.i18n.getMessage("youtubePermissionRequest"));

View File

@@ -22,6 +22,8 @@ async function init() {
if (granted) {
alert(chrome.i18n.getMessage("permissionRequestSuccess"));
Config.config.ytInfoPermissionGranted = true;
chrome.tabs.getCurrent((tab) => {
chrome.tabs.remove(tab.id);
});