mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 09:07:47 +01:00
Made untrustworthy users have hidden submissions.
This commit is contained in:
parent
662dcf430a
commit
1b53b3c993
1 changed files with 19 additions and 2 deletions
21
index.js
21
index.js
|
@ -171,11 +171,28 @@ app.get('/api/postVideoSponsorTimes', async function (req, res) {
|
|||
if (err) console.log(err);
|
||||
|
||||
//check to see if this user is shadowbanned
|
||||
let result = await new Promise((resolve, reject) => {
|
||||
let shadowBanResult = await new Promise((resolve, reject) => {
|
||||
privateDB.prepare("SELECT count(*) as userCount FROM shadowBannedUsers WHERE userID = ?").get(userID, (err, row) => resolve({err, row}));
|
||||
});
|
||||
|
||||
let shadowBanned = result.row.userCount;
|
||||
let shadowBanned = shadowBanResult.row.userCount;
|
||||
|
||||
//check to see if this user how many submissions this user has submitted
|
||||
let totalSubmissionsResult = await new Promise((resolve, reject) => {
|
||||
db.prepare("SELECT count(*) as totalSubmissions FROM sponsorTimes WHERE userID = ?").get(userID, (err, row) => resolve({err, row}));
|
||||
});
|
||||
|
||||
if (totalSubmissionsResult.row.totalSubmissions > 15) {
|
||||
//check if they have a high downvote ratio
|
||||
let downvotedSubmissionsResult = await new Promise((resolve, reject) => {
|
||||
db.prepare("SELECT count(*) as downvotedSubmissions FROM sponsorTimes WHERE userID = ? AND votes < 0").get(userID, (err, row) => resolve({err, row}));
|
||||
});
|
||||
|
||||
if (downvotedSubmissionsResult.row.downvotedSubmissions / totalSubmissionsResult.row.totalSubmissions > 0.6) {
|
||||
//hide this submission as this user is untrustworthy
|
||||
shadowBanned = true;
|
||||
}
|
||||
}
|
||||
|
||||
let startingVotes = 0;
|
||||
if (vipResult.row.userCount > 0) {
|
||||
|
|
Loading…
Reference in a new issue