mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-26 17:38:28 +03:00
Add permission check in more places
This commit is contained in:
@@ -18,6 +18,7 @@ import { checkBanStatus } from "../utils/checkBan";
|
||||
import axios from "axios";
|
||||
import { getMaxResThumbnail } from "../utils/youtubeApi";
|
||||
import { getVideoDetails } from "../utils/getVideoDetails";
|
||||
import { canVote } from "../utils/permissions";
|
||||
|
||||
enum BrandingType {
|
||||
Title,
|
||||
@@ -55,6 +56,10 @@ export async function postBranding(req: Request, res: Response) {
|
||||
const hashedIP = await getHashCache(getIP(req) + config.globalSalt as IPAddress);
|
||||
const isBanned = await checkBanStatus(hashedUserID, hashedIP);
|
||||
|
||||
if (!await canVote(hashedUserID)) {
|
||||
res.status(200).send("OK");
|
||||
}
|
||||
|
||||
if (videoDuration && thumbnail && await checkForWrongVideoDuration(videoID, videoDuration)) {
|
||||
res.status(403).send("YouTube is currently testing a new anti-adblock technique called server-side ad-injection. This causes skips and submissions to be offset by the duration of the ad. It seems that you are affected by this A/B test, so until a fix is developed, we cannot accept submissions from your device due to them potentially being inaccurate.");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user