Compare commits

..

5 Commits
5.1.7 ... 5.1.8

Author SHA1 Message Date
Ajay
43c30bb03d bump version 2022-11-23 23:42:17 -05:00
Ajay
eac2caadce Fix document script sending events when video id not changed 2022-11-23 23:42:06 -05:00
Ajay
8d0a4ec2e6 Fix race condition causing double fetch 2022-11-23 23:37:52 -05:00
Ajay
8b6fb98b3d Merge branch 'master' of https://github.com/ajayyy/SponsorBlock 2022-11-23 23:24:59 -05:00
Ajay
8f13c5b8a5 Disable refetch 2022-11-23 23:24:57 -05:00
3 changed files with 12 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "__MSG_fullName__",
"short_name": "SponsorBlock",
"version": "5.1.7",
"version": "5.1.8",
"default_locale": "en",
"description": "__MSG_Description__",
"homepage_url": "https://sponsor.ajay.app",

View File

@@ -154,6 +154,7 @@ let isAdPlaying = false;
let lastResponseStatus: number;
let retryCount = 0;
let lookupWaiting = false;
// Contains all of the functions and variables needed by the skip notice
const skipNoticeContentContainer: ContentContainer = () => ({
@@ -965,10 +966,15 @@ function setupCategoryPill() {
}
async function sponsorsLookup(keepOldSubmissions = true) {
if (lookupWaiting) return;
if (!video || !isVisible(video)) refreshVideoAttachments();
//there is still no video here
if (!video) {
setTimeout(() => sponsorsLookup(), 100);
lookupWaiting = true;
setTimeout(() => {
lookupWaiting = false;
sponsorsLookup()
}, 100);
return;
}
@@ -1198,7 +1204,7 @@ function retryFetch(errorCode: number): void {
retryFetchTimeout = setTimeout(() => {
if (sponsorVideoID && sponsorTimes?.length === 0
|| sponsorTimes.every((segment) => segment.source !== SponsorSourceType.Server)) {
sponsorsLookup();
// sponsorsLookup();
}
}, delay);
}

View File

@@ -33,6 +33,7 @@ type WindowMessage = StartMessage | FinishMessage | AdMessage | VideoData;
// global playerClient - too difficult to type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let playerClient: any;
let lastVideo = "";
const sendMessage = (message: WindowMessage): void => {
window.postMessage({ source: "sponsorblock", ...message }, "/");
@@ -87,7 +88,8 @@ function navigateFinishSend(event: CustomEvent): void {
function sendVideoData(): void {
if (!playerClient) return;
const videoData = playerClient.getVideoData();
if (videoData) {
if (videoData && videoData.video_id !== lastVideo) {
lastVideo = videoData.video_id;
sendMessage({ type: "data", videoID: videoData.video_id, isLive: videoData.isLive, isPremiere: videoData.isPremiere } as VideoData);
}
}