mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-20 14:38:24 +03:00
fixed db update, started no segments
This commit is contained in:
31
src/routes/postNoSegments.js
Normal file
31
src/routes/postNoSegments.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const getHash = require('../utils/getHash.js');
|
||||
const isUserVIP = require('../utils/isUserVIP.js');
|
||||
|
||||
module.exports = (req, res) => {
|
||||
// Collect user input data
|
||||
let videoID = req.body.videoID;
|
||||
let userID = req.body.userID;
|
||||
let categorys = req.body.categorys;
|
||||
|
||||
// Check input data is valid
|
||||
if (!videoID
|
||||
|| !userID
|
||||
|| !categorys
|
||||
|| !Array.isArray(categorys)
|
||||
|| categorys.length === 0
|
||||
) {
|
||||
res.status(400).json({});
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if user is VIP
|
||||
userID = getHash(userID);
|
||||
let userIsVIP = isUserVIP(userID);
|
||||
|
||||
if (!userIsVIP) {
|
||||
res.status(403).json({});
|
||||
return;
|
||||
}
|
||||
|
||||
res.status(200).json({status: 200});
|
||||
};
|
||||
Reference in New Issue
Block a user