mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-13 15:06:59 +03:00
Rename func
This commit is contained in:
@@ -18,7 +18,7 @@ import { checkBanStatus } from "../utils/checkBan";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { getMaxResThumbnail } from "../utils/youtubeApi";
|
import { getMaxResThumbnail } from "../utils/youtubeApi";
|
||||||
import { getVideoDetails } from "../utils/getVideoDetails";
|
import { getVideoDetails } from "../utils/getVideoDetails";
|
||||||
import { canVote } from "../utils/permissions";
|
import { canSubmitGlobal } from "../utils/permissions";
|
||||||
|
|
||||||
enum BrandingType {
|
enum BrandingType {
|
||||||
Title,
|
Title,
|
||||||
@@ -56,7 +56,7 @@ export async function postBranding(req: Request, res: Response) {
|
|||||||
const hashedIP = await getHashCache(getIP(req) + config.globalSalt as IPAddress);
|
const hashedIP = await getHashCache(getIP(req) + config.globalSalt as IPAddress);
|
||||||
const isBanned = await checkBanStatus(hashedUserID, hashedIP);
|
const isBanned = await checkBanStatus(hashedUserID, hashedIP);
|
||||||
|
|
||||||
const permission = await canVote(hashedUserID);
|
const permission = await canSubmitGlobal(hashedUserID);
|
||||||
if (!permission.canSubmit) {
|
if (!permission.canSubmit) {
|
||||||
res.status(403).send(permission.reason);
|
res.status(403).send(permission.reason);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import crypto from "crypto";
|
|||||||
import { QueryCacher } from "../utils/queryCacher";
|
import { QueryCacher } from "../utils/queryCacher";
|
||||||
import { acquireLock } from "../utils/redisLock";
|
import { acquireLock } from "../utils/redisLock";
|
||||||
import { checkBanStatus } from "../utils/checkBan";
|
import { checkBanStatus } from "../utils/checkBan";
|
||||||
import { canVote } from "../utils/permissions";
|
import { canSubmitGlobal } from "../utils/permissions";
|
||||||
|
|
||||||
interface ExistingVote {
|
interface ExistingVote {
|
||||||
UUID: BrandingUUID;
|
UUID: BrandingUUID;
|
||||||
@@ -42,7 +42,7 @@ export async function postCasual(req: Request, res: Response) {
|
|||||||
const hashedIP = await getHashCache(getIP(req) + config.globalSalt as IPAddress);
|
const hashedIP = await getHashCache(getIP(req) + config.globalSalt as IPAddress);
|
||||||
const isBanned = await checkBanStatus(hashedUserID, hashedIP);
|
const isBanned = await checkBanStatus(hashedUserID, hashedIP);
|
||||||
|
|
||||||
const permission = await canVote(hashedUserID);
|
const permission = await canSubmitGlobal(hashedUserID);
|
||||||
if (!permission.canSubmit) {
|
if (!permission.canSubmit) {
|
||||||
res.status(403).send(permission.reason);
|
res.status(403).send(permission.reason);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { getVideoDetails, videoDetails } from "../utils/getVideoDetails";
|
|||||||
import { deleteLockCategories } from "./deleteLockCategories";
|
import { deleteLockCategories } from "./deleteLockCategories";
|
||||||
import { acquireLock } from "../utils/redisLock";
|
import { acquireLock } from "../utils/redisLock";
|
||||||
import { checkBanStatus } from "../utils/checkBan";
|
import { checkBanStatus } from "../utils/checkBan";
|
||||||
import { canVote } from "../utils/permissions";
|
import { canSubmitGlobal } from "../utils/permissions";
|
||||||
|
|
||||||
const voteTypes = {
|
const voteTypes = {
|
||||||
normal: 0,
|
normal: 0,
|
||||||
@@ -343,7 +343,7 @@ export async function vote(ip: IPAddress, UUID: SegmentUUID, paramUserID: UserID
|
|||||||
const nonAnonUserID = await getHashCache(paramUserID);
|
const nonAnonUserID = await getHashCache(paramUserID);
|
||||||
const userID = await getHashCache(paramUserID + UUID);
|
const userID = await getHashCache(paramUserID + UUID);
|
||||||
|
|
||||||
const permission = await canVote(nonAnonUserID);
|
const permission = await canSubmitGlobal(nonAnonUserID);
|
||||||
if (!permission.canSubmit) {
|
if (!permission.canSubmit) {
|
||||||
return {
|
return {
|
||||||
status: 403,
|
status: 403,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export async function canSubmit(userID: HashedUserID, category: Category): Promi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function canVote(userID: HashedUserID): Promise<CanSubmitResult> {
|
export async function canSubmitGlobal(userID: HashedUserID): Promise<CanSubmitResult> {
|
||||||
return {
|
return {
|
||||||
canSubmit: await oneOf([isUserVIP(userID),
|
canSubmit: await oneOf([isUserVIP(userID),
|
||||||
oldSubmitter(userID)
|
oldSubmitter(userID)
|
||||||
|
|||||||
Reference in New Issue
Block a user