mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 01:02:30 +01:00
Adding check to only allow a list of categories
This commit is contained in:
parent
6fe8dfc188
commit
dec0971c14
3 changed files with 12 additions and 1 deletions
|
@ -19,5 +19,6 @@
|
||||||
"privateDBSchema": "./databases/_private.db.sql",
|
"privateDBSchema": "./databases/_private.db.sql",
|
||||||
"mode": "development",
|
"mode": "development",
|
||||||
"readOnly": false,
|
"readOnly": false,
|
||||||
"webhooks": []
|
"webhooks": [],
|
||||||
|
"categoryList": ["sponsor", "intro", "outro", "interaction", "selfpromo", "music_offtopic"] // List of supported categories any other category will be rejected
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,6 +194,11 @@ module.exports = async function postSkipSegments(req, res) {
|
||||||
res.sendStatus(400);
|
res.sendStatus(400);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config.categoryList.includes(segments[i].category)) {
|
||||||
|
res.status("400").send("Category doesn't exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let startTime = parseFloat(segments[i].segment[0]);
|
let startTime = parseFloat(segments[i].segment[0]);
|
||||||
let endTime = parseFloat(segments[i].segment[1]);
|
let endTime = parseFloat(segments[i].segment[1]);
|
||||||
|
|
|
@ -150,6 +150,11 @@ function categoryVote(UUID, userID, isVIP, category, hashedIP, res) {
|
||||||
res.status("400").send("Submission doesn't exist.");
|
res.status("400").send("Submission doesn't exist.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config.categoryList.includes(category)) {
|
||||||
|
res.status("400").send("Category doesn't exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let timeSubmitted = Date.now();
|
let timeSubmitted = Date.now();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue