Merge branch 'nb-mod-fetch' of https://github.com/andrewzlee/SponsorBlockServer into nb-mod-fetch

This commit is contained in:
Andrew Lee
2020-08-29 17:48:44 -04:00

View File

@@ -81,7 +81,7 @@ async function autoModerateSubmission(submission, callback) {
let {err, data} = await new Promise((resolve, reject) => {
YouTubeAPI.videos.list({
part: "contentDetails",
id: videoID
id: submission.videoID
}, (err, data) => resolve({err, data}));
});
@@ -90,7 +90,7 @@ async function autoModerateSubmission(submission, callback) {
} else {
// Check to see if video exists
if (data.pageInfo.totalResults === 0) {
return "No video exists with id " + videoID;
return "No video exists with id " + submission.videoID;
} else {
let duration = data.items[0].contentDetails.duration;
duration = isoDurations.toSeconds(isoDurations.parse(duration));
@@ -195,7 +195,7 @@ module.exports = async function postSkipSegments(req, res) {
let hashedIP = getHash(getIP(req) + config.globalSalt);
//check if this user is on the vip list
let isVIP = db.prepare("SELECT count(*) as userCount FROM vipUsers WHERE userID = ?").get(userID).userCount > 0;
let isVIP = db.prepare("get", "SELECT count(*) as userCount FROM vipUsers WHERE userID = ?", [userID]).userCount > 0;
// Check if all submissions are correct
for (let i = 0; i < segments.length; i++) {
@@ -240,9 +240,6 @@ module.exports = async function postSkipSegments(req, res) {
}
try {
//check if this user is on the vip list
let vipRow = db.prepare('get', "SELECT count(*) as userCount FROM vipUsers WHERE userID = ?", [userID]);
//get current time
let timeSubmitted = Date.now();