mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-14 07:27:01 +03:00
Filter input
This commit is contained in:
@@ -59,7 +59,7 @@ export async function deleteLockCategoriesEndpoint(req: DeleteLockCategoriesRequ
|
|||||||
|
|
||||||
export async function deleteLockCategories(videoID: VideoID, categories = config.categoryList, actionTypes = [ActionType.Skip, ActionType.Mute], service: Service): Promise<void> {
|
export async function deleteLockCategories(videoID: VideoID, categories = config.categoryList, actionTypes = [ActionType.Skip, ActionType.Mute], service: Service): Promise<void> {
|
||||||
const arrJoin = (arr: string[]): string => `'${arr.join(`','`)}'`;
|
const arrJoin = (arr: string[]): string => `'${arr.join(`','`)}'`;
|
||||||
const categoryString = arrJoin(categories);
|
const categoryString = arrJoin(categories.filter((v) => !/[^a-z|_|-]/.test(v)));
|
||||||
const actionTypeString = arrJoin(actionTypes);
|
const actionTypeString = arrJoin(actionTypes.filter((v) => !/[^a-z|_|-]/.test(v)));
|
||||||
await db.prepare("run", `DELETE FROM "lockCategories" WHERE "videoID" = ? AND "service" = ? AND "category" IN (${categoryString}) AND "actionType" IN (${actionTypeString})`, [videoID, service]);
|
await db.prepare("run", `DELETE FROM "lockCategories" WHERE "videoID" = ? AND "service" = ? AND "category" IN (${categoryString}) AND "actionType" IN (${actionTypeString})`, [videoID, service]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user