mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Add return types to vip fetching functions
This commit is contained in:
@@ -768,7 +768,7 @@ function lookupVipInformation(id: string): void {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateVipInfo() {
|
async function updateVipInfo(): Promise<boolean> {
|
||||||
const currentTime = Date.now();
|
const currentTime = Date.now();
|
||||||
const lastUpdate = Config.config.lastIsVipUpdate;
|
const lastUpdate = Config.config.lastIsVipUpdate;
|
||||||
if (currentTime - lastUpdate > 1000 * 60 * 60 * 72) { // 72 hours
|
if (currentTime - lastUpdate > 1000 * 60 * 60 * 72) { // 72 hours
|
||||||
@@ -793,28 +793,26 @@ async function updateVipInfo() {
|
|||||||
return Config.config.isVip;
|
return Config.config.isVip;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function lockedSegmentsLookup() {
|
async function lockedSegmentsLookup(): Promise<void> {
|
||||||
utils.asyncRequestToServer("GET", "/api/segmentInfo", { UUIDs: sponsorTimes?.map((segment) => segment.UUID) })
|
const response = await utils.asyncRequestToServer("GET", "/api/segmentInfo", { UUIDs: sponsorTimes?.map((segment) => segment.UUID) });
|
||||||
.then((response) => {
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
for (let i = 0; i < sponsorTimes.length && i < 10; i++) { // Because the api only return 10 segments maximum
|
for (let i = 0; i < sponsorTimes.length && i < 10; i++) { // Because the api only return 10 segments maximum
|
||||||
try {
|
try {
|
||||||
sponsorTimes[i].locked = (JSON.parse(response.responseText)[i].locked === 1) ? true : false;
|
sponsorTimes[i].locked = (JSON.parse(response.responseText)[i].locked === 1) ? true : false;
|
||||||
} catch (e) { } //eslint-disable-line no-empty
|
} catch (e) { } //eslint-disable-line no-empty
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function lockedCategoriesLookup(id: string) {
|
async function lockedCategoriesLookup(id: string): Promise<void> {
|
||||||
utils.asyncRequestToServer("GET", "/api/lockCategories", { videoID: id })
|
const response = await utils.asyncRequestToServer("GET", "/api/lockCategories", { videoID: id });
|
||||||
.then((response) => {
|
|
||||||
if (response.status === 200 && response.ok) {
|
if (response.status === 200 && response.ok) {
|
||||||
for (const category of JSON.parse(response.responseText).categories) {
|
for (const category of JSON.parse(response.responseText).categories) {
|
||||||
lockedCategories.push(category);
|
lockedCategories.push(category);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function retryFetch(): void {
|
function retryFetch(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user