mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-11 05:57:04 +03:00
Remove casting
This commit is contained in:
@@ -3,14 +3,14 @@ import {getHash} from "../utils/getHash";
|
|||||||
import {Request, Response} from "express";
|
import {Request, Response} from "express";
|
||||||
import { config } from "../config";
|
import { config } from "../config";
|
||||||
import { Category, Service, VideoID, VideoIDHash } from "../types/segments.model";
|
import { Category, Service, VideoID, VideoIDHash } from "../types/segments.model";
|
||||||
import { HashedUserID, UserID } from "../types/user.model";
|
import { UserID } from "../types/user.model";
|
||||||
import { QueryCacher } from "../utils/queryCacher";
|
import { QueryCacher } from "../utils/queryCacher";
|
||||||
import { isUserVIP } from "../utils/isUserVIP";
|
import { isUserVIP } from "../utils/isUserVIP";
|
||||||
|
|
||||||
export async function shadowBanUser(req: Request, res: Response): Promise<Response> {
|
export async function shadowBanUser(req: Request, res: Response): Promise<Response> {
|
||||||
const userID = req.query.userID as string;
|
const userID = req.query.userID as UserID;
|
||||||
const hashedIP = req.query.hashedIP as string;
|
const hashedIP = req.query.hashedIP as string;
|
||||||
let adminUserIDInput = req.query.adminUserID as string;
|
const adminUserIDInput = req.query.adminUserID as UserID;
|
||||||
|
|
||||||
const enabled = req.query.enabled === undefined
|
const enabled = req.query.enabled === undefined
|
||||||
? true
|
? true
|
||||||
@@ -28,9 +28,9 @@ export async function shadowBanUser(req: Request, res: Response): Promise<Respon
|
|||||||
}
|
}
|
||||||
|
|
||||||
//hash the userID
|
//hash the userID
|
||||||
adminUserIDInput = getHash(adminUserIDInput);
|
const adminUserID = getHash(adminUserIDInput);
|
||||||
|
|
||||||
const isVIP = await isUserVIP(adminUserIDInput as HashedUserID);
|
const isVIP = await isUserVIP(adminUserID);
|
||||||
if (!isVIP) {
|
if (!isVIP) {
|
||||||
//not authorized
|
//not authorized
|
||||||
return res.sendStatus(403);
|
return res.sendStatus(403);
|
||||||
|
|||||||
Reference in New Issue
Block a user