mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 06:27:14 +03:00
Call whitelist check if not still waiting for channel id in window listener
This commit is contained in:
@@ -120,6 +120,7 @@ let lastCheckVideoTime = -1;
|
|||||||
|
|
||||||
//is this channel whitelised from getting sponsors skipped
|
//is this channel whitelised from getting sponsors skipped
|
||||||
let channelWhitelisted = false;
|
let channelWhitelisted = false;
|
||||||
|
let waitingForChannelID = false;
|
||||||
|
|
||||||
let previewBar: PreviewBar = null;
|
let previewBar: PreviewBar = null;
|
||||||
// Skip to highlight button
|
// Skip to highlight button
|
||||||
@@ -1470,6 +1471,7 @@ async function whitelistCheck() {
|
|||||||
const whitelistedChannels = Config.config.whitelistedChannels;
|
const whitelistedChannels = Config.config.whitelistedChannels;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
waitingForChannelID = true;
|
||||||
await utils.wait(() => channelIDInfo.status === ChannelIDStatus.Found, 6000, 20);
|
await utils.wait(() => channelIDInfo.status === ChannelIDStatus.Found, 6000, 20);
|
||||||
|
|
||||||
// If found, continue on, it was set by the listener
|
// If found, continue on, it was set by the listener
|
||||||
@@ -1494,6 +1496,8 @@ async function whitelistCheck() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waitingForChannelID = false;
|
||||||
|
|
||||||
//see if this is a whitelisted channel
|
//see if this is a whitelisted channel
|
||||||
if (whitelistedChannels != undefined &&
|
if (whitelistedChannels != undefined &&
|
||||||
channelIDInfo.status === ChannelIDStatus.Found && whitelistedChannels.includes(channelIDInfo.id)) {
|
channelIDInfo.status === ChannelIDStatus.Found && whitelistedChannels.includes(channelIDInfo.id)) {
|
||||||
@@ -2392,6 +2396,10 @@ function windowListenerHandler(event: MessageEvent): void {
|
|||||||
id: data.channelID,
|
id: data.channelID,
|
||||||
status: ChannelIDStatus.Found
|
status: ChannelIDStatus.Found
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!waitingForChannelID) {
|
||||||
|
whitelistCheck();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
videoIDChange(data.videoID);
|
videoIDChange(data.videoID);
|
||||||
|
|||||||
Reference in New Issue
Block a user