mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 20:47:11 +03:00
Only ask for permission once
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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"));
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user