mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-27 01:48:33 +03:00
Merge pull request #365 from mchangrh/updateDependencies
update dependencies, add shims for node-fetch v3
This commit is contained in:
@@ -59,7 +59,7 @@ export async function getSkipSegmentsByHash(req: Request, res: Response): Promis
|
||||
return res.status(400).send("Bad parameter: requiredSegments (invalid JSON)");
|
||||
}
|
||||
|
||||
const service = getService(req.query.service, req.body.service);
|
||||
const service: Service = getService(req.query.service, req.body.service);
|
||||
|
||||
// filter out none string elements, only flat array with strings is valid
|
||||
categories = categories.filter((item: any) => typeof item === "string");
|
||||
|
||||
@@ -45,7 +45,7 @@ export async function getTotalStats(req: Request, res: Response): Promise<void>
|
||||
function updateExtensionUsers() {
|
||||
if (config.userCounterURL) {
|
||||
fetch(`${config.userCounterURL}/api/v1/userCount`)
|
||||
.then(res => res.json())
|
||||
.then(res => res.json() as Record<string, any>)
|
||||
.then(data => {
|
||||
apiUsersCache = Math.max(apiUsersCache, data.userCount);
|
||||
})
|
||||
@@ -56,7 +56,7 @@ function updateExtensionUsers() {
|
||||
const chromeExtensionUrl = "https://chrome.google.com/webstore/detail/sponsorblock-for-youtube/mnjggcdmjocbbbhaepdhchncahnbgone";
|
||||
|
||||
fetch(mozillaAddonsUrl)
|
||||
.then(res => res.json())
|
||||
.then(res => res.json() as Record<string, any>)
|
||||
.then(data => {
|
||||
firefoxUsersCache = data.average_daily_users;
|
||||
fetch(chromeExtensionUrl)
|
||||
|
||||
@@ -240,7 +240,7 @@ async function autoModerateSubmission(apiVideoInfo: APIVideoInfo,
|
||||
&segments=${nbString.substring(0, nbString.length - 1)}`);
|
||||
if (!response.ok) return false;
|
||||
|
||||
const nbPredictions = await response.json();
|
||||
const nbPredictions = await response.json() as Record<string, any>;
|
||||
let nbDecision = false;
|
||||
let predictionIdx = 0; //Keep track because only sponsor categories were submitted
|
||||
for (let i = 0; i < segments.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user