mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
store response status 200
This commit is contained in:
parent
b92132bf47
commit
7cc0847db1
2 changed files with 4 additions and 3 deletions
|
@ -833,7 +833,6 @@ async function sponsorsLookup(keepOldSubmissions = true) {
|
||||||
const hashParams = getHashParams();
|
const hashParams = getHashParams();
|
||||||
if (hashParams.requiredSegment) extraRequestData.requiredSegment = hashParams.requiredSegment;
|
if (hashParams.requiredSegment) extraRequestData.requiredSegment = hashParams.requiredSegment;
|
||||||
|
|
||||||
// Check for hashPrefix setting
|
|
||||||
const hashPrefix = (await utils.getHash(sponsorVideoID, 1)).slice(0, 4) as VideoID & HashedValue;
|
const hashPrefix = (await utils.getHash(sponsorVideoID, 1)).slice(0, 4) as VideoID & HashedValue;
|
||||||
const response = await utils.asyncRequestToServer('GET', "/api/skipSegments/" + hashPrefix, {
|
const response = await utils.asyncRequestToServer('GET', "/api/skipSegments/" + hashPrefix, {
|
||||||
categories,
|
categories,
|
||||||
|
@ -842,6 +841,9 @@ async function sponsorsLookup(keepOldSubmissions = true) {
|
||||||
...extraRequestData
|
...extraRequestData
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// store last response status
|
||||||
|
lastResponseStatus = response?.status;
|
||||||
|
|
||||||
if (response?.ok) {
|
if (response?.ok) {
|
||||||
const recievedSegments: SponsorTime[] = JSON.parse(response.responseText)
|
const recievedSegments: SponsorTime[] = JSON.parse(response.responseText)
|
||||||
?.filter((video) => video.videoID === sponsorVideoID)
|
?.filter((video) => video.videoID === sponsorVideoID)
|
||||||
|
@ -910,7 +912,6 @@ async function sponsorsLookup(keepOldSubmissions = true) {
|
||||||
updatePreviewBar();
|
updatePreviewBar();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lastResponseStatus = response?.status;
|
|
||||||
if (lastResponseStatus === 404) {
|
if (lastResponseStatus === 404) {
|
||||||
retryFetch();
|
retryFetch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,7 +367,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
||||||
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("sponsorFound");
|
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("sponsorFound");
|
||||||
|
|
||||||
displayDownloadedSponsorTimes(request);
|
displayDownloadedSponsorTimes(request);
|
||||||
} else if (request.status == 404) {
|
} else if (request.status == 404 || request.status == 200) {
|
||||||
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("sponsor404");
|
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("sponsor404");
|
||||||
} else {
|
} else {
|
||||||
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("connectionError") + request.status;
|
PageElements.videoFound.innerHTML = chrome.i18n.getMessage("connectionError") + request.status;
|
||||||
|
|
Loading…
Reference in a new issue