diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index b3b9e152..7a5dd69b 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -116,6 +116,9 @@ "connectionError": { "message": "A connection error has occurred. Error code: " }, + "segmentsStillLoading": { + "message": "Segments still loading..." + }, "clearTimes": { "message": "Clear Segments" }, @@ -1243,5 +1246,8 @@ }, "exportSegmentsAsURL": { "message": "Share as URL" + }, + "segmentFetchFailureWarning": { + "message": "Warning: The server hasn't responded with segments yet. There might actually be segments on this video already submitted but you just haven't recieved them due to issues with the server." } } diff --git a/src/content.ts b/src/content.ts index d9eb9a8c..3bfb66a5 100644 --- a/src/content.ts +++ b/src/content.ts @@ -56,6 +56,7 @@ let sponsorVideoID: VideoID = null; const skipNotices: SkipNotice[] = []; let activeSkipKeybindElement: ToggleSkippable = null; let retryFetchTimeout: NodeJS.Timeout = null; +let shownSegmentFailedToFetchWarning = false; // JSON video info let videoInfo: VideoInfo = null; @@ -344,6 +345,8 @@ function resetValues() { sponsorTimes = []; existingChaptersImported = false; sponsorSkipped = []; + lastResponseStatus = 0; + shownSegmentFailedToFetchWarning = false; sponsorVideoID = null; videoInfo = null; @@ -1922,6 +1925,12 @@ function startOrEndTimingNewSegment() { updateSponsorTimesSubmitting(false); importExistingChapters(false); + + if (lastResponseStatus !== 200 && !shownSegmentFailedToFetchWarning) { + alert(chrome.i18n.getMessage("segmentFetchFailureWarning")); + + shownSegmentFailedToFetchWarning = true; + } } function getIncompleteSegment(): SponsorTime { diff --git a/src/popup.ts b/src/popup.ts index 400906a0..d2e763f4 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -456,7 +456,12 @@ async function runThePopup(messageListener?: MessageListener): Promise { PageElements.videoFound.innerHTML = chrome.i18n.getMessage("sponsor404"); PageElements.issueReporterImportExport.classList.remove("hidden"); } else { - PageElements.videoFound.innerHTML = chrome.i18n.getMessage("connectionError") + request.status; + if (request.status) { + PageElements.videoFound.innerHTML = chrome.i18n.getMessage("connectionError") + request.status; + } else { + PageElements.videoFound.innerHTML = chrome.i18n.getMessage("segmentsStillLoading"); + } + PageElements.issueReporterImportExport.classList.remove("hidden"); } }