mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-10 13:37:01 +03:00
Merge pull request #20 from ajayyy/experimental
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
|
//update the votes table
|
||||||
if (row != undefined) {
|
if (row != undefined) {
|
||||||
privateDB.prepare("UPDATE votes SET type = ? WHERE userID = ? AND UUID = ?").run(type, userID, UUID);
|
privateDB.prepare("UPDATE votes SET type = ? WHERE userID = ? AND UUID = ?").run(type, userID, UUID);
|
||||||
@@ -234,6 +241,7 @@ app.get('/api/voteOnSponsorTime', function (req, res) {
|
|||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
//Endpoint when a sponsorTime is used up
|
//Endpoint when a sponsorTime is used up
|
||||||
app.get('/api/viewedVideoSponsorTime', function (req, res) {
|
app.get('/api/viewedVideoSponsorTime', function (req, res) {
|
||||||
|
|||||||
Reference in New Issue
Block a user