Send webhooks after response

This commit is contained in:
Ajay Ramachandran
2020-08-29 19:22:44 -04:00
parent f7ea7061d6
commit 800a3dff9d
2 changed files with 139 additions and 108 deletions

View File

@@ -226,6 +226,9 @@ module.exports = async function postSkipSegments(req, res) {
}
}
// Will be filled when submitting
let UUIDs = [];
try {
//check if this user is on the vip list
let vipRow = db.prepare('get', "SELECT count(*) as userCount FROM vipUsers WHERE userID = ?", [userID]);
@@ -301,8 +304,7 @@ module.exports = async function postSkipSegments(req, res) {
return;
}
// Webhooks
sendWebhooks(userID, videoID, UUID, segmentInfo);
UUIDs.push(UUID);
}
} catch (err) {
logger.error(err);
@@ -313,4 +315,8 @@ module.exports = async function postSkipSegments(req, res) {
}
res.sendStatus(200);
for (let i = 0; i < segments.length; i++) {
sendWebhooks(userID, videoID, UUIDs[i], segments[i]);
}
}