mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
Added error when segments haven't loaded and improved popup message
Resolves #1553
This commit is contained in:
@@ -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."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -456,7 +456,12 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user