diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts index 1347a89..630fb70 100644 --- a/src/routes/postSkipSegments.ts +++ b/src/routes/postSkipSegments.ts @@ -23,6 +23,7 @@ import { vote } from "./voteOnSponsorTime"; import { canSubmit } from "../utils/permissions"; import { getVideoDetails, videoDetails } from "../utils/getVideoDetails"; import * as youtubeID from "../utils/youtubeID"; +import { banUser } from "./shadowBanUser"; type CheckResult = { pass: boolean, @@ -541,11 +542,18 @@ export async function postSkipSegments(req: Request, res: Response): Promise Logger.error(`Error banning user after submitting from a banned IP: ${e}`)); + } + for (const segmentInfo of segments) { // Full segments are always rejected since there can only be one, so shadow hide wouldn't work if (segmentInfo.ignoreSegment diff --git a/src/routes/shadowBanUser.ts b/src/routes/shadowBanUser.ts index 1f83805..e0e9112 100644 --- a/src/routes/shadowBanUser.ts +++ b/src/routes/shadowBanUser.ts @@ -70,7 +70,7 @@ export async function shadowBanUser(req: Request, res: Response): Promise { +export async function banUser(userID: UserID, enabled: boolean, unHideOldSubmissions: boolean, type: string, categories: Category[]): Promise { //check to see if this user is already shadowbanned const row = await db.prepare("get", `SELECT count(*) as "userCount" FROM "shadowBannedUsers" WHERE "userID" = ?`, [userID]); @@ -123,7 +123,7 @@ async function banUser(userID: UserID, enabled: boolean, unHideOldSubmissions: b return 200; } -async function banIP(hashedIP: HashedIP, enabled: boolean, unHideOldSubmissions: boolean, type: string, categories: Category[], banUsers: boolean): Promise { +export async function banIP(hashedIP: HashedIP, enabled: boolean, unHideOldSubmissions: boolean, type: string, categories: Category[], banUsers: boolean): Promise { //check to see if this user is already shadowbanned const row = await db.prepare("get", `SELECT count(*) as "userCount" FROM "shadowBannedIPs" WHERE "hashedIP" = ?`, [hashedIP]);