mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-14 15:37:07 +03:00
Don't allow self votes
This commit is contained in:
@@ -383,7 +383,8 @@ export async function voteOnSponsorTime(req: Request, res: Response) {
|
||||
|
||||
// Only change the database if they have made a submission before and haven't voted recently
|
||||
const ableToVote = isVIP
|
||||
|| ((await db.prepare("get", `SELECT "userID" FROM "sponsorTimes" WHERE "userID" = ?`, [nonAnonUserID])) !== undefined
|
||||
|| (!(isOwnSubmission && incrementAmount > 0)
|
||||
&& (await db.prepare("get", `SELECT "userID" FROM "sponsorTimes" WHERE "userID" = ?`, [nonAnonUserID])) !== undefined
|
||||
&& (await privateDB.prepare("get", `SELECT "userID" FROM "shadowBannedUsers" WHERE "userID" = ?`, [nonAnonUserID])) === undefined
|
||||
&& (await privateDB.prepare("get", `SELECT "UUID" FROM "votes" WHERE "UUID" = ? AND "hashedIP" = ? AND "userID" != ?`, [UUID, hashedIP, userID])) === undefined)
|
||||
&& finalResponse.finalStatus === 200;
|
||||
|
||||
Reference in New Issue
Block a user