mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 20:17:02 +03:00
Added VIP support to category vote
This commit is contained in:
@@ -23,6 +23,8 @@ function categoryVote(UUID, userID, isVIP, category, hashedIP, res) {
|
|||||||
|
|
||||||
let timeSubmitted = Date.now();
|
let timeSubmitted = Date.now();
|
||||||
|
|
||||||
|
let voteAmount = isVIP ? 500 : 1;
|
||||||
|
|
||||||
// Add the vote
|
// Add the vote
|
||||||
if (db.prepare("select count(*) as count from categoryVotes where UUID = ? and category = ?").get(UUID, category).count > 0) {
|
if (db.prepare("select count(*) as count from categoryVotes where UUID = ? and category = ?").get(UUID, category).count > 0) {
|
||||||
// Update the already existing db entry
|
// Update the already existing db entry
|
||||||
@@ -52,7 +54,8 @@ function categoryVote(UUID, userID, isVIP, category, hashedIP, res) {
|
|||||||
let nextCategoryCount = (previousVoteInfo.votes || 0) + 1;
|
let nextCategoryCount = (previousVoteInfo.votes || 0) + 1;
|
||||||
|
|
||||||
//TODO: In the future, raise this number from zero to make it harder to change categories
|
//TODO: In the future, raise this number from zero to make it harder to change categories
|
||||||
if (nextCategoryCount - currentCategoryCount >= 0) {
|
// VIPs change it every time
|
||||||
|
if (nextCategoryCount - currentCategoryCount >= 0 || isVIP) {
|
||||||
// Replace the category
|
// Replace the category
|
||||||
db.prepare("update sponsorTimes set category = ? where UUID = ?").run(category, UUID);
|
db.prepare("update sponsorTimes set category = ? where UUID = ?").run(category, UUID);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user