mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-09-20 04:53:43 +02:00
parent
6b4da25847
commit
b92132bf47
3 changed files with 17 additions and 6 deletions
|
@ -65,8 +65,8 @@ const videosWithEventListeners: HTMLVideoElement[] = [];
|
|||
const controlsWithEventListeners: HTMLElement[] = []
|
||||
|
||||
// This misleading variable name will be fixed soon
|
||||
let onInvidious;
|
||||
let onMobileYouTube;
|
||||
let onInvidious: boolean;
|
||||
let onMobileYouTube: boolean;
|
||||
|
||||
//the video id of the last preview bar update
|
||||
let lastPreviewBarUpdate;
|
||||
|
@ -117,6 +117,9 @@ let submissionNotice: SubmissionNotice = null;
|
|||
// If there is an advert playing (or about to be played), this is true
|
||||
let isAdPlaying = false;
|
||||
|
||||
// last response status
|
||||
let lastResponseStatus: number;
|
||||
|
||||
// Contains all of the functions and variables needed by the skip notice
|
||||
const skipNoticeContentContainer: ContentContainer = () => ({
|
||||
vote,
|
||||
|
@ -163,6 +166,7 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
|
|||
//send the sponsor times along with if it's found
|
||||
sendResponse({
|
||||
found: sponsorDataFound,
|
||||
status: lastResponseStatus,
|
||||
sponsorTimes: sponsorTimes,
|
||||
onMobileYouTube
|
||||
});
|
||||
|
@ -204,6 +208,7 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
|
|||
case "refreshSegments":
|
||||
sponsorsLookup(false).then(() => sendResponse({
|
||||
found: sponsorDataFound,
|
||||
status: lastResponseStatus,
|
||||
sponsorTimes: sponsorTimes,
|
||||
onMobileYouTube
|
||||
}));
|
||||
|
@ -904,8 +909,11 @@ async function sponsorsLookup(keepOldSubmissions = true) {
|
|||
//otherwise the listener can handle it
|
||||
updatePreviewBar();
|
||||
}
|
||||
} else if (response?.status === 404) {
|
||||
retryFetch();
|
||||
} else {
|
||||
lastResponseStatus = response?.status;
|
||||
if (lastResponseStatus === 404) {
|
||||
retryFetch();
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.config.isVip) {
|
||||
|
|
|
@ -63,6 +63,7 @@ export type Message = BaseMessage & (DefaultMessage | BoolValueMessage | IsInfoF
|
|||
|
||||
export interface IsInfoFoundMessageResponse {
|
||||
found: boolean;
|
||||
status: number;
|
||||
sponsorTimes: SponsorTime[];
|
||||
onMobileYouTube: boolean;
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ export type MessageResponse =
|
|||
| GetChannelIDResponse
|
||||
| SponsorStartResponse
|
||||
| IsChannelWhitelistedResponse
|
||||
| Record<string, never>
|
||||
| Record<never, never> // empty object response {}
|
||||
| VoteResponse;
|
||||
|
||||
export interface VoteResponse {
|
||||
|
|
|
@ -367,8 +367,10 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("sponsorFound");
|
||||
|
||||
displayDownloadedSponsorTimes(request);
|
||||
} else {
|
||||
} else if (request.status == 404) {
|
||||
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("sponsor404");
|
||||
} else {
|
||||
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("connectionError") + request.status;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue