mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-16 08:27:03 +03:00
Fixed direct link channel whitelisting
This commit is contained in:
@@ -328,11 +328,12 @@ function videoIDChange(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sponsorsLookup(id: string, channelIDPromise = null) {
|
function sponsorsLookup(id: string, channelIDPromise?) {
|
||||||
|
|
||||||
v = document.querySelector('video') // Youtube video player
|
v = document.querySelector('video') // Youtube video player
|
||||||
//there is no video here
|
//there is no video here
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
setTimeout(() => sponsorsLookup(id), 100);
|
setTimeout(() => sponsorsLookup(id, channelIDPromise), 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,7 +344,7 @@ function sponsorsLookup(id: string, channelIDPromise = null) {
|
|||||||
v.addEventListener('durationchange', updatePreviewBar);
|
v.addEventListener('durationchange', updatePreviewBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channelIDPromise != null) {
|
if (channelIDPromise !== undefined) {
|
||||||
if (channelIDPromise.isFulfilled) {
|
if (channelIDPromise.isFulfilled) {
|
||||||
whitelistCheck();
|
whitelistCheck();
|
||||||
} else if (channelIDPromise.isRejected) {
|
} else if (channelIDPromise.isRejected) {
|
||||||
@@ -389,7 +390,7 @@ function sponsorsLookup(id: string, channelIDPromise = null) {
|
|||||||
//if less than 3 days old
|
//if less than 3 days old
|
||||||
if ((Date.now() / 1000) - unixTimePublished < 259200) {
|
if ((Date.now() / 1000) - unixTimePublished < 259200) {
|
||||||
//TODO lower when server becomes better
|
//TODO lower when server becomes better
|
||||||
setTimeout(() => sponsorsLookup(id), 180000);
|
setTimeout(() => sponsorsLookup(id, channelIDPromise), 180000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -400,7 +401,7 @@ function sponsorsLookup(id: string, channelIDPromise = null) {
|
|||||||
|
|
||||||
//TODO lower when server becomes better (back to 1 second)
|
//TODO lower when server becomes better (back to 1 second)
|
||||||
//some error occurred, try again in a second
|
//some error occurred, try again in a second
|
||||||
setTimeout(() => sponsorsLookup(id), 10000);
|
setTimeout(() => sponsorsLookup(id, channelIDPromise), 10000);
|
||||||
|
|
||||||
sponsorLookupRetries++;
|
sponsorLookupRetries++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user