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,
|
testingServer: boolean,
|
||||||
hashPrefix: boolean,
|
hashPrefix: boolean,
|
||||||
refetchWhenNotFound: boolean,
|
refetchWhenNotFound: boolean,
|
||||||
|
ytInfoPermissionGranted: boolean,
|
||||||
|
|
||||||
// What categories should be skipped
|
// What categories should be skipped
|
||||||
categorySelections: CategorySelection[],
|
categorySelections: CategorySelection[],
|
||||||
@@ -169,6 +170,7 @@ const Config: SBObject = {
|
|||||||
testingServer: false,
|
testingServer: false,
|
||||||
hashPrefix: true,
|
hashPrefix: true,
|
||||||
refetchWhenNotFound: true,
|
refetchWhenNotFound: true,
|
||||||
|
ytInfoPermissionGranted: false,
|
||||||
|
|
||||||
categorySelections: [{
|
categorySelections: [{
|
||||||
name: "sponsor",
|
name: "sponsor",
|
||||||
|
|||||||
@@ -733,7 +733,7 @@ async function getVideoInfo(): Promise<void> {
|
|||||||
|
|
||||||
async function videoInfoFetchFailed(errorMessage: string): Promise<void> {
|
async function videoInfoFetchFailed(errorMessage: string): Promise<void> {
|
||||||
console.log("failed\t" + errorMessage)
|
console.log("failed\t" + errorMessage)
|
||||||
if (utils.isFirefox()) {
|
if (utils.isFirefox() && !Config.config.ytInfoPermissionGranted) {
|
||||||
// Attempt to ask permission for youtube.com domain
|
// Attempt to ask permission for youtube.com domain
|
||||||
alert(chrome.i18n.getMessage("youtubePermissionRequest"));
|
alert(chrome.i18n.getMessage("youtubePermissionRequest"));
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ async function init() {
|
|||||||
if (granted) {
|
if (granted) {
|
||||||
alert(chrome.i18n.getMessage("permissionRequestSuccess"));
|
alert(chrome.i18n.getMessage("permissionRequestSuccess"));
|
||||||
|
|
||||||
|
Config.config.ytInfoPermissionGranted = true;
|
||||||
|
|
||||||
chrome.tabs.getCurrent((tab) => {
|
chrome.tabs.getCurrent((tab) => {
|
||||||
chrome.tabs.remove(tab.id);
|
chrome.tabs.remove(tab.id);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user