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