From 67951b39d971ae3589ea93162cabef0bc0b48422 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 29 Aug 2020 12:25:35 -0400 Subject: [PATCH] Change vote and username requirements --- src/routes/getTopUsers.js | 4 +++- src/routes/setUsername.js | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/routes/getTopUsers.js b/src/routes/getTopUsers.js index 2b452b6..a5baf09 100644 --- a/src/routes/getTopUsers.js +++ b/src/routes/getTopUsers.js @@ -42,11 +42,13 @@ module.exports = function getTopUsers (req, res) { let rows = db.prepare('all', "SELECT COUNT(*) as totalSubmissions, SUM(views) as viewCount," + "SUM((sponsorTimes.endTime - sponsorTimes.startTime) / 60 * sponsorTimes.views) as minutesSaved, " + + "SUM(votes) as userVotes, " + additionalFields + "IFNULL(userNames.userName, sponsorTimes.userID) as userName FROM sponsorTimes LEFT JOIN userNames ON sponsorTimes.userID=userNames.userID " + "LEFT JOIN privateDB.shadowBannedUsers ON sponsorTimes.userID=privateDB.shadowBannedUsers.userID " + "WHERE sponsorTimes.votes > -1 AND sponsorTimes.shadowHidden != 1 AND privateDB.shadowBannedUsers.userID IS NULL " + - "GROUP BY IFNULL(userName, sponsorTimes.userID) ORDER BY " + sortBy + " DESC LIMIT 100", []); + "GROUP BY IFNULL(userName, sponsorTimes.userID) HAVING userVotes > 200 " + + "ORDER BY " + sortBy + " DESC LIMIT 100", []); for (let i = 0; i < rows.length; i++) { userNames[i] = rows[i].userName; diff --git a/src/routes/setUsername.js b/src/routes/setUsername.js index cc143fb..13e877f 100644 --- a/src/routes/setUsername.js +++ b/src/routes/setUsername.js @@ -18,6 +18,12 @@ module.exports = function setUsername(req, res) { return; } + if (userName.contains("discord")) { + // Don't allow + res.sendStatus(200); + return; + } + if (adminUserIDInput != undefined) { //this is the admin controlling the other users account, don't hash the controling account's ID adminUserIDInput = getHash(adminUserIDInput);