mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-12 06:27:10 +03:00
consistent return and sendStatus
This commit is contained in:
@@ -3,7 +3,7 @@ import {db} from '../databases/databases';
|
||||
import {config} from '../config';
|
||||
import {Request, Response} from 'express';
|
||||
|
||||
export async function addUserAsVIP(req: Request, res: Response): Promise<void> {
|
||||
export async function addUserAsVIP(req: Request, res: Response): Promise<Response> {
|
||||
const userID = req.query.userID as string;
|
||||
let adminUserIDInput = req.query.adminUserID as string;
|
||||
|
||||
@@ -13,8 +13,7 @@ export async function addUserAsVIP(req: Request, res: Response): Promise<void> {
|
||||
|
||||
if (userID == undefined || adminUserIDInput == undefined) {
|
||||
//invalid request
|
||||
res.sendStatus(400);
|
||||
return;
|
||||
return res.sendStatus(400);
|
||||
}
|
||||
|
||||
//hash the userID
|
||||
@@ -22,8 +21,7 @@ export async function addUserAsVIP(req: Request, res: Response): Promise<void> {
|
||||
|
||||
if (adminUserIDInput !== config.adminUserID) {
|
||||
//not authorized
|
||||
res.sendStatus(403);
|
||||
return;
|
||||
return res.sendStatus(403);
|
||||
}
|
||||
|
||||
//check to see if this user is already a vip
|
||||
@@ -37,5 +35,5 @@ export async function addUserAsVIP(req: Request, res: Response): Promise<void> {
|
||||
await db.prepare('run', 'DELETE FROM "vipUsers" WHERE "userID" = ?', [userID]);
|
||||
}
|
||||
|
||||
res.sendStatus(200);
|
||||
return res.sendStatus(200);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user