mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-09 21:17:15 +03:00
Made downvote more powerful if there are some views or votes already.
This commit is contained in:
8
index.js
8
index.js
@@ -219,6 +219,13 @@ app.get('/api/voteOnSponsorTime', function (req, res) {
|
||||
}
|
||||
}
|
||||
|
||||
//check if the increment amount should be multiplied (downvotes have more power if there have been many views)
|
||||
db.prepare("SELECT votes, views FROM sponsorTimes WHERE UUID = ?").get(UUID, function(err, row) {
|
||||
if (row != null && (row.votes > 3 || row.views > 4) && incrementAmount < 0) {
|
||||
//multiply the power of this downvote
|
||||
incrementAmount *= 4;
|
||||
}
|
||||
|
||||
//update the votes table
|
||||
if (row != undefined) {
|
||||
privateDB.prepare("UPDATE votes SET type = ? WHERE userID = ? AND UUID = ?").run(type, userID, UUID);
|
||||
@@ -233,6 +240,7 @@ app.get('/api/voteOnSponsorTime', function (req, res) {
|
||||
//added to db
|
||||
res.sendStatus(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//Endpoint when a sponsorTime is used up
|
||||
|
||||
Reference in New Issue
Block a user