show connectionError string if status is not 404
This commit is contained in:
Michael C
2022-06-24 01:21:19 -04:00
parent 6b4da25847
commit b92132bf47
3 changed files with 17 additions and 6 deletions

View File

@@ -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) {