mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 19:47:00 +03:00
Merge branch 'testing' of https://github.com/ajayyy/SponsorBlockServer into new-vote-options
# Conflicts: # src/routes/voteOnSponsorTime.js
This commit is contained in:
@@ -107,7 +107,11 @@ module.exports = async function voteOnSponsorTime(req, res) {
|
|||||||
// Send discord message
|
// Send discord message
|
||||||
if (incrementAmount < 0) {
|
if (incrementAmount < 0) {
|
||||||
// Get video ID
|
// Get video ID
|
||||||
let submissionInfoRow = db.prepare("SELECT videoID, userID, startTime, endTime FROM sponsorTimes WHERE UUID = ?").get(UUID);
|
let submissionInfoRow = db.prepare("SELECT s.videoID, s.userID, s.startTime, s.endTime, u.userName, "+
|
||||||
|
"(select count(1) from sponsorTimes where userID = s.userID) count, "+
|
||||||
|
"(select count(1) from sponsorTimes where userID = s.userID and votes <= -2) disregarded "+
|
||||||
|
"FROM sponsorTimes s inner join userNames u on s.userID = u.userID where s.UUID=?"
|
||||||
|
).get(UUID);
|
||||||
|
|
||||||
let userSubmissionCountRow = db.prepare("SELECT count(*) as submissionCount FROM sponsorTimes WHERE userID = ?").get(nonAnonUserID);
|
let userSubmissionCountRow = db.prepare("SELECT count(*) as submissionCount FROM sponsorTimes WHERE userID = ?").get(nonAnonUserID);
|
||||||
|
|
||||||
@@ -132,11 +136,14 @@ module.exports = async function voteOnSponsorTime(req, res) {
|
|||||||
json: {
|
json: {
|
||||||
"embeds": [{
|
"embeds": [{
|
||||||
"title": data.items[0].snippet.title,
|
"title": data.items[0].snippet.title,
|
||||||
"url": "https://www.youtube.com/watch?v=" + submissionInfoRow.videoID +
|
"url": "https://www.youtube.com/watch?v=" + submissionInfoRow.videoID
|
||||||
"&t=" + (submissionInfoRow.startTime.toFixed(0) - 2),
|
+ "&t=" + (submissionInfoRow.startTime.toFixed(0) - 2),
|
||||||
"description": "**" + row.votes + " Votes Prior | " + (row.votes + incrementAmount - oldIncrementAmount) + " Votes Now | " + row.views +
|
"description": "**" + row.votes + " Votes Prior | " + (row.votes + incrementAmount - oldIncrementAmount) + " Votes Now | " + row.views
|
||||||
" Views**\n\nSubmission ID: " + UUID +
|
+ " Views**\n\n**Submission ID:** " + UUID
|
||||||
"\n\nSubmitted by: " + submissionInfoRow.userID + "\n\nTimestamp: " +
|
+ "\n\n**Submitted by:** "+submissionInfoRow.userName+"\n " + submissionInfoRow.userID
|
||||||
|
+ "\n\n**Total User Submissions:** "+submissionInfoRow.count
|
||||||
|
+ "\n**Ignored User Submissions:** "+submissionInfoRow.disregarded
|
||||||
|
+"\n\n**Timestamp:** " +
|
||||||
getFormattedTime(submissionInfoRow.startTime) + " to " + getFormattedTime(submissionInfoRow.endTime),
|
getFormattedTime(submissionInfoRow.startTime) + " to " + getFormattedTime(submissionInfoRow.endTime),
|
||||||
"color": 10813440,
|
"color": 10813440,
|
||||||
"author": {
|
"author": {
|
||||||
@@ -202,5 +209,7 @@ module.exports = async function voteOnSponsorTime(req, res) {
|
|||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
|
res.status(500).json({error: 'Internal error creating segment vote'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user