diff --git a/DatabaseSchema.md b/DatabaseSchema.md index 935f978..5f41446 100644 --- a/DatabaseSchema.md +++ b/DatabaseSchema.md @@ -37,7 +37,7 @@ | views | INTEGER | not null | | category | TEXT | not null, default 'sponsor' | | actionType | TEXT | not null, default 'skip' | -| service | TEXT | not null, default 'Youtube' | +| service | TEXT | not null, default 'YouTube' | | videoDuration | INTEGER | not null, default '0' | | hidden | INTEGER | not null, default '0' | | reputation | REAL | not null, default '0' | @@ -96,10 +96,11 @@ | category | TEXT | not null | | hashedVideoID | TEXT | not null, default '' | | reason | TEXT | not null, default '' | +| service | TEXT | not null, default 'YouTube' | | index | field | | -- | :--: | -| noSegments_videoID | videoID | +| lockCategories_videoID | videoID, service, category | ### warnings @@ -135,6 +136,7 @@ | views | TEXT | not null | | channelID | TEXT | not null | | timeSubmitted | INTEGER | not null | +| service | TEXT | not null, default 'YouTube' | ### config @@ -159,7 +161,7 @@ | views | INTEGER | not null | | category | TEXT | not null, default 'sponsor' | | actionType | TEXT | not null, default 'skip' | -| service | TEXT | not null, default 'Youtube' | +| service | TEXT | not null, default 'YouTube' | | videoDuration | INTEGER | not null, default '0' | | hidden | INTEGER | not null, default '0' | | reputation | REAL | not null, default '0' | @@ -208,11 +210,12 @@ | videoID | TEXT | not null | | hashedIP | TEXT | not null | | timeSubmitted | INTEGER | not null | +| service | TEXT | not null, default 'YouTube' | | index | field | | -- | :--: | | sponsorTimes_hashedIP | hashedIP | -| privateDB_sponsorTimes_videoID | videoID | +| privateDB_sponsorTimes_videoID_v2 | videoID, service | ### config diff --git a/databases/_private_indexes.sql b/databases/_private_indexes.sql index d930c85..48ed490 100644 --- a/databases/_private_indexes.sql +++ b/databases/_private_indexes.sql @@ -5,9 +5,9 @@ CREATE INDEX IF NOT EXISTS "sponsorTimes_hashedIP" ("hashedIP" COLLATE pg_catalog."default" ASC NULLS LAST) TABLESPACE pg_default; -CREATE INDEX IF NOT EXISTS "privateDB_sponsorTimes_videoID" +CREATE INDEX IF NOT EXISTS "privateDB_sponsorTimes_videoID_v2" ON public."sponsorTimes" USING btree - ("videoID" ASC NULLS LAST) + ("videoID" ASC NULLS LAST, service COLLATE pg_catalog."default" ASC NULLS LAST) ; -- votes diff --git a/databases/_sponsorTimes_indexes.sql b/databases/_sponsorTimes_indexes.sql index 40fe33e..cfcab8f 100644 --- a/databases/_sponsorTimes_indexes.sql +++ b/databases/_sponsorTimes_indexes.sql @@ -53,9 +53,9 @@ CREATE INDEX IF NOT EXISTS "warnings_issueTime" -- lockCategories -CREATE INDEX IF NOT EXISTS "noSegments_videoID" +CREATE INDEX IF NOT EXISTS "lockCategories_videoID" ON public."lockCategories" USING btree - ("videoID" COLLATE pg_catalog."default" ASC NULLS LAST, category COLLATE pg_catalog."default" ASC NULLS LAST) + ("videoID" COLLATE pg_catalog."default" ASC NULLS LAST, service COLLATE pg_catalog."default" ASC NULLS LAST, category COLLATE pg_catalog."default" ASC NULLS LAST) TABLESPACE pg_default; -- categoryVotes diff --git a/databases/_upgrade_private_3.sql b/databases/_upgrade_private_3.sql new file mode 100644 index 0000000..ecc5ecd --- /dev/null +++ b/databases/_upgrade_private_3.sql @@ -0,0 +1,10 @@ +BEGIN TRANSACTION; + +ALTER TABLE "sponsorTimes" ADD "service" TEXT NOT NULL default 'YouTube'; +-- UPDATE "sponsorTimes" SET "service" = "YouTube"; + +DROP INDEX IF EXISTS "privateDB_sponsorTimes_videoID"; + +UPDATE "config" SET value = 3 WHERE key = 'version'; + +COMMIT; \ No newline at end of file diff --git a/databases/_upgrade_sponsorTimes_24.sql b/databases/_upgrade_sponsorTimes_24.sql new file mode 100644 index 0000000..fc35878 --- /dev/null +++ b/databases/_upgrade_sponsorTimes_24.sql @@ -0,0 +1,21 @@ +BEGIN TRANSACTION; + +ALTER TABLE "lockCategories" ADD "service" TEXT NOT NULL default 'YouTube'; + +UPDATE "lockCategories" +SET "service" = "sponsorTimes"."service" +FROM "sponsorTimes" +WHERE "lockCategories"."videoID" = "sponsorTimes"."videoID"; + +ALTER TABLE "unlistedVideos" ADD "service" TEXT NOT NULL default 'YouTube'; + +UPDATE "unlistedVideos" +SET "service" = "sponsorTimes"."service" +FROM "sponsorTimes" +WHERE "unlistedVideos"."videoID" = "sponsorTimes"."videoID"; + +DROP INDEX IF EXISTS "noSegments_videoID"; + +UPDATE "config" SET value = 24 WHERE key = 'version'; + +COMMIT; diff --git a/src/routes/addUnlistedVideo.ts b/src/routes/addUnlistedVideo.ts index db5fef4..4c6cdba 100644 --- a/src/routes/addUnlistedVideo.ts +++ b/src/routes/addUnlistedVideo.ts @@ -1,5 +1,6 @@ import { Request, Response } from "express"; import { db } from "../databases/databases"; +import { getService } from "../utils/getService"; import { Logger } from "../utils/logger"; /** @@ -14,6 +15,7 @@ export function addUnlistedVideo(req: Request, res: Response): Response { const year = req.body.year || 0; const views = req.body.views || 0; const channelID = req.body.channelID || "Unknown"; + const service = getService(req.body.service); if (videoID === undefined || typeof(videoID) !== "string" || videoID.length !== 11) { return res.status(400).send("Invalid parameters"); @@ -21,7 +23,7 @@ export function addUnlistedVideo(req: Request, res: Response): Response { try { const timeSubmitted = Date.now(); - db.prepare("run", `INSERT INTO "unlistedVideos" ("videoID", "year", "views", "channelID", "timeSubmitted") values (?, ?, ?, ?, ?)`, [videoID, year, views, channelID, timeSubmitted]); + db.prepare("run", `INSERT INTO "unlistedVideos" ("videoID", "year", "views", "channelID", "timeSubmitted", "service") values (?, ?, ?, ?, ?, ?)`, [videoID, year, views, channelID, timeSubmitted, service]); } catch (err) { Logger.error(err as string); return res.sendStatus(500); diff --git a/src/routes/deleteLockCategories.ts b/src/routes/deleteLockCategories.ts index f50df50..ec1b665 100644 --- a/src/routes/deleteLockCategories.ts +++ b/src/routes/deleteLockCategories.ts @@ -2,14 +2,16 @@ import { Request, Response } from "express"; import { isUserVIP } from "../utils/isUserVIP"; import { getHash } from "../utils/getHash"; import { db } from "../databases/databases"; -import { Category, VideoID } from "../types/segments.model"; +import { Category, Service, VideoID } from "../types/segments.model"; import { UserID } from "../types/user.model"; +import { getService } from "../utils/getService"; export async function deleteLockCategoriesEndpoint(req: Request, res: Response): Promise { // Collect user input data const videoID = req.body.videoID as VideoID; const userID = req.body.userID as UserID; const categories = req.body.categories as Category[]; + const service = getService(req.body.service); // Check input data is valid if (!videoID @@ -33,7 +35,7 @@ export async function deleteLockCategoriesEndpoint(req: Request, res: Response): }); } - await deleteLockCategories(videoID, categories); + await deleteLockCategories(videoID, categories, service); return res.status(200).json({ message: `Removed lock categories entrys for video ${videoID}` }); } @@ -42,13 +44,20 @@ export async function deleteLockCategoriesEndpoint(req: Request, res: Response): * * @param videoID * @param categories If null, will remove all + * @param service */ -export async function deleteLockCategories(videoID: VideoID, categories: Category[]): Promise { - const entries = (await db.prepare("all", 'SELECT * FROM "lockCategories" WHERE "videoID" = ?', [videoID])).filter((entry: any) => { - return categories === null || categories.indexOf(entry.category) !== -1; - }); +export async function deleteLockCategories(videoID: VideoID, categories: Category[], service: Service): Promise { + const entries = ( + await db.prepare("all", 'SELECT * FROM "lockCategories" WHERE "videoID" = ? AND "service" = ?', [videoID, service])) + .filter((entry: any) => { + return categories === null || categories.indexOf(entry.category) !== -1; + }); for (const entry of entries) { - await db.prepare("run", 'DELETE FROM "lockCategories" WHERE "videoID" = ? AND "category" = ?', [videoID, entry.category]); + await db.prepare( + "run", + 'DELETE FROM "lockCategories" WHERE "videoID" = ? AND "service" = ? AND "category" = ?', + [videoID, service, entry.category] + ); } } diff --git a/src/routes/getLockCategories.ts b/src/routes/getLockCategories.ts index 735df8e..693b7de 100644 --- a/src/routes/getLockCategories.ts +++ b/src/routes/getLockCategories.ts @@ -2,9 +2,11 @@ import { db } from "../databases/databases"; import { Logger } from "../utils/logger"; import { Request, Response } from "express"; import { Category, VideoID } from "../types/segments.model"; +import { getService } from "../utils/getService"; export async function getLockCategories(req: Request, res: Response): Promise { const videoID = req.query.videoID as VideoID; + const service = getService(req.query.service as string); if (videoID == undefined) { //invalid request @@ -13,7 +15,7 @@ export async function getLockCategories(req: Request, res: Response): Promise item.category); if (categories.length === 0 || !categories[0]) return res.sendStatus(404); diff --git a/src/routes/getSkipSegments.ts b/src/routes/getSkipSegments.ts index 16c87c6..7782fed 100644 --- a/src/routes/getSkipSegments.ts +++ b/src/routes/getSkipSegments.ts @@ -27,8 +27,9 @@ async function prepareCategorySegments(req: Request, videoID: VideoID, category: if (cache.shadowHiddenSegmentIPs[videoID] === undefined) cache.shadowHiddenSegmentIPs[videoID] = {}; if (cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted] === undefined) { - cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted] = await privateDB.prepare("all", 'SELECT "hashedIP" FROM "sponsorTimes" WHERE "videoID" = ? AND "timeSubmitted" = ?', - [videoID, segment.timeSubmitted]) as { hashedIP: HashedIP }[]; + const service = getService(req?.query?.service as string); + cache.shadowHiddenSegmentIPs[videoID][segment.timeSubmitted] = await privateDB.prepare("all", 'SELECT "hashedIP" FROM "sponsorTimes" WHERE "videoID" = ? AND "timeSubmitted" = ? AND "service" = ?', + [videoID, segment.timeSubmitted, service]) as { hashedIP: HashedIP }[]; } //if this isn't their ip, don't send it to them diff --git a/src/routes/postLockCategories.ts b/src/routes/postLockCategories.ts index ef541af..3d0de9d 100644 --- a/src/routes/postLockCategories.ts +++ b/src/routes/postLockCategories.ts @@ -4,6 +4,7 @@ import { isUserVIP } from "../utils/isUserVIP"; import { db } from "../databases/databases"; import { Request, Response } from "express"; import { VideoIDHash } from "../types/segments.model"; +import { getService } from "../utils/getService"; export async function postLockCategories(req: Request, res: Response): Promise { // Collect user input data @@ -11,6 +12,7 @@ export async function postLockCategories(req: Request, res: Response): Promise, isVIP: boolean, service:string, apiVideoInfo: APIVideoInfo, decreaseVotes: number): Promise { // Auto moderator check if (!isVIP && service == Service.YouTube) { - const autoModerateResult = await autoModerateSubmission(apiVideoInfo, { userID, videoID, segments });//startTime, endTime, category: segments[i].category}); + const autoModerateResult = await autoModerateSubmission(apiVideoInfo, { userID, videoID, segments, service });//startTime, endTime, category: segments[i].category}); + if (autoModerateResult == "Rejected based on NeuralBlock predictions.") { // If NB automod rejects, the submission will start with -2 votes. // Note, if one submission is bad all submissions will be affected. @@ -431,8 +432,8 @@ async function checkByAutoModerator(videoID: any, userID: any, segments: Array ?`, [hashedIP, videoID, yesterday]); + const rateLimitCheckRow = await privateDB.prepare("get", `SELECT COUNT(*) as count FROM "sponsorTimes" WHERE "hashedIP" = ? AND "videoID" = ? AND "timeSubmitted" > ? AND "service" = ?`, [hashedIP, videoID, yesterday, service]); if (rateLimitCheckRow.count >= 10) { //too many sponsors for the same video from the same ip address @@ -613,7 +614,7 @@ export async function postSkipSegments(req: Request, res: Response): Promise item.UUID); const allSegments = (await db.prepare("all", `SELECT "UUID" FROM "sponsorTimes" st WHERE "st"."userID" = ?`, [userID])) .map((item: {UUID: string}) => item.UUID); @@ -120,7 +120,7 @@ export async function shadowBanUser(req: Request, res: Response): Promise `'${c}'`).join(",")}) AND NOT EXISTS ( SELECT "videoID", "category" FROM "lockCategories" WHERE - "sponsorTimes"."videoID" = "lockCategories"."videoID" AND "sponsorTimes"."category" = "lockCategories"."category")`, [userID]); + "sponsorTimes"."videoID" = "lockCategories"."videoID" AND "sponsorTimes"."service" = "lockCategories"."service" AND "sponsorTimes"."category" = "lockCategories"."category")`, [userID]); // clear cache for all old videos (await db.prepare("all", `SELECT "videoID", "hashedVideoID", "service", "votes", "views" FROM "sponsorTimes" WHERE "userID" = ?`, [userID])) diff --git a/src/routes/voteOnSponsorTime.ts b/src/routes/voteOnSponsorTime.ts index c3783b5..3bfb8f8 100644 --- a/src/routes/voteOnSponsorTime.ts +++ b/src/routes/voteOnSponsorTime.ts @@ -290,7 +290,8 @@ export async function voteOnSponsorTime(req: Request, res: Response): Promise !!(await db.prepare("get", `SELECT "locked" FROM "sponsorTimes" WHERE "UUID" = ?`, [UUID]))?.locked; const isVideoLocked = async () => !!(await db.prepare("get", `SELECT "lockCategories".category from "lockCategories" left join "sponsorTimes" - on ("lockCategories"."videoID" = "sponsorTimes"."videoID" and "lockCategories".category = "sponsorTimes".category) + on ("lockCategories"."videoID" = "sponsorTimes"."videoID" and + "lockCategories"."service" = "sponsorTimes"."service" and "lockCategories".category = "sponsorTimes".category) where "UUID" = ?`, [UUID])); if (await isSegmentLocked() || await isVideoLocked()) { diff --git a/src/utils/getSubmissionUUID.ts b/src/utils/getSubmissionUUID.ts index 27abd99..4d90c58 100644 --- a/src/utils/getSubmissionUUID.ts +++ b/src/utils/getSubmissionUUID.ts @@ -1,8 +1,15 @@ import { getHash } from "./getHash"; import { HashedValue } from "../types/hash.model"; -import { ActionType, VideoID } from "../types/segments.model"; +import { ActionType, VideoID, Service } from "../types/segments.model"; import { UserID } from "../types/user.model"; -export function getSubmissionUUID(videoID: VideoID, actionType: ActionType, userID: UserID, startTime: number, endTime: number): HashedValue{ - return `4${getHash(`${videoID}${startTime}${endTime}${userID}${actionType}`, 1)}` as HashedValue; +export function getSubmissionUUID( + videoID: VideoID, + actionType: ActionType, + userID: UserID, + startTime: number, + endTime: number, + service: Service +) : HashedValue { + return `5${getHash(`${videoID}${startTime}${endTime}${userID}${actionType}${service}`, 1)}` as HashedValue; } diff --git a/src/utils/reputation.ts b/src/utils/reputation.ts index e1d5e40..7f44384 100644 --- a/src/utils/reputation.ts +++ b/src/utils/reputation.ts @@ -38,7 +38,7 @@ export async function getReputation(userID: UserID): Promise { c."category" = "a"."category" LIMIT 1) AND EXISTS ( SELECT * FROM "lockCategories" as l - WHERE l."videoID" = "a"."videoID" AND l."category" = "a"."category" LIMIT 1) + WHERE l."videoID" = "a"."videoID" AND l."service" = "a"."service" AND l."category" = "a"."category" LIMIT 1) THEN 1 ELSE 0 END) AS "mostUpvotedInLockedVideoSum" FROM "sponsorTimes" as "a" WHERE "userID" = ?`, [userID, weekAgo, pastDate, userID]) as Promise; diff --git a/test/cases/getLockCategories.ts b/test/cases/getLockCategories.ts index 2b2ff9c..b8285bf 100644 --- a/test/cases/getLockCategories.ts +++ b/test/cases/getLockCategories.ts @@ -4,19 +4,21 @@ import assert from "assert"; import { client } from "../utils/httpClient"; const endpoint = "/api/lockCategories"; const getLockCategories = (videoID: string) => client.get(endpoint, { params: { videoID } }); +const getLockCategoriesWithService = (videoID: string, service: string) => client.get(endpoint, { params: { videoID, service } }); describe("getLockCategories", () => { before(async () => { const insertVipUserQuery = 'INSERT INTO "vipUsers" ("userID") VALUES (?)'; await db.prepare("run", insertVipUserQuery, [getHash("getLockCategoriesVIP")]); - const insertLockCategoryQuery = 'INSERT INTO "lockCategories" ("userID", "videoID", "category", "reason") VALUES (?, ?, ?, ?)'; - await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock1", "sponsor", "1-short"]); - await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock1", "interaction", "1-longer-reason"]); + const insertLockCategoryQuery = 'INSERT INTO "lockCategories" ("userID", "videoID", "category", "reason", "service") VALUES (?, ?, ?, ?, ?)'; + await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock1", "sponsor", "1-short", "YouTube"]); + await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock1", "interaction", "1-longer-reason", "YouTube"]); - await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock2", "preview", "2-reason"]); + await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock2", "preview", "2-reason", "YouTube"]); - await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock3", "nonmusic", "3-reason"]); + await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock3", "nonmusic", "3-reason", "PeerTube"]); + await db.prepare("run", insertLockCategoryQuery, [getHash("getLockCategoriesVIP"), "getLock3", "sponsor", "3-reason", "YouTube"]); }); it("Should update the database version when starting the application", async () => { @@ -74,4 +76,69 @@ describe("getLockCategories", () => { }) .catch(err => done(err)); }); + + it("Should be able to get multiple locks with service", (done) => { + getLockCategoriesWithService("getLock1", "YouTube") + .then(res => { + assert.strictEqual(res.status, 200); + const expected = { + categories: [ + "sponsor", + "interaction" + ], + reason: "1-longer-reason" + }; + assert.deepStrictEqual(res.data, expected); + done(); + }) + .catch(err => done(err)); + }); + + it("Should be able to get single locks with service", (done) => { + getLockCategoriesWithService("getLock3", "PeerTube") + .then(res => { + assert.strictEqual(res.status, 200); + const expected = { + categories: [ + "nonmusic" + ], + reason: "3-reason" + }; + assert.deepStrictEqual(res.data, expected); + done(); + }) + .catch(err => done(err)); + }); + + it("Should be able to get single locks with service", (done) => { + getLockCategoriesWithService("getLock3", "Youtube") + .then(res => { + assert.strictEqual(res.status, 200); + const expected = { + categories: [ + "sponsor" + ], + reason: "3-reason" + }; + assert.deepStrictEqual(res.data, expected); + done(); + }) + .catch(err => done(err)); + }); + + it("should return result from Youtube service if service not match", (done) => { + getLockCategoriesWithService("getLock3", "Dailymotion") + .then(res => { + assert.strictEqual(res.status, 200); + const expected = { + categories: [ + "sponsor" + ], + reason: "3-reason" + }; + assert.deepStrictEqual(res.data, expected); + done(); + }) + .catch(err => done(err)); + }); }); diff --git a/test/cases/getSubmissionUUID.ts b/test/cases/getSubmissionUUID.ts index ad6ae63..61ec053 100644 --- a/test/cases/getSubmissionUUID.ts +++ b/test/cases/getSubmissionUUID.ts @@ -1,10 +1,12 @@ import { getSubmissionUUID } from "../../src/utils/getSubmissionUUID"; import assert from "assert"; -import { ActionType, VideoID } from "../../src/types/segments.model"; +import { ActionType, VideoID, Service } from "../../src/types/segments.model"; import { UserID } from "../../src/types/user.model"; describe("getSubmissionUUID", () => { it("Should return the hashed value", () => { - assert.strictEqual(getSubmissionUUID("video001" as VideoID, "skip" as ActionType, "testuser001" as UserID, 13.33337, 42.000001), "48ad47e445e67a7b963d9200037b36ec706eddcb752fdadc7bb2f061b56be6a23"); + assert.strictEqual( + getSubmissionUUID("video001" as VideoID, "skip" as ActionType, "testuser001" as UserID, 13.33337, 42.000001, Service.YouTube), + "529611b4cdd7319e705a32ae9557a02e59c8dbc1306097b2d2d5807c6405e9b1a"); }); }); diff --git a/test/cases/lockCategoriesRecords.ts b/test/cases/lockCategoriesRecords.ts index 15a23f8..ef1f28a 100644 --- a/test/cases/lockCategoriesRecords.ts +++ b/test/cases/lockCategoriesRecords.ts @@ -23,18 +23,18 @@ describe("lockCategoriesRecords", () => { const insertVipUserQuery = 'INSERT INTO "vipUsers" ("userID") VALUES (?)'; await db.prepare("run", insertVipUserQuery, [lockVIPUserHash]); - const insertLockCategoryQuery = 'INSERT INTO "lockCategories" ("userID", "videoID", "category", "reason") VALUES (?, ?, ?, ?)'; - await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "no-segments-video-id", "sponsor", "reason-1"]); - await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "no-segments-video-id", "intro", "reason-1"]); + const insertLockCategoryQuery = 'INSERT INTO "lockCategories" ("userID", "videoID", "category", "reason", "service") VALUES (?, ?, ?, ?, ?)'; + await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "no-segments-video-id", "sponsor", "reason-1", "YouTube"]); + await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "no-segments-video-id", "intro", "reason-1", "YouTube"]); - await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "no-segments-video-id-1", "sponsor", "reason-2"]); - await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "no-segments-video-id-1", "intro", "reason-2"]); - await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "lockCategoryVideo", "sponsor", "reason-3"]); + await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "no-segments-video-id-1", "sponsor", "reason-2", "YouTube"]); + await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "no-segments-video-id-1", "intro", "reason-2", "YouTube"]); + await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "lockCategoryVideo", "sponsor", "reason-3", "YouTube"]); - await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "delete-record", "sponsor", "reason-4"]); + await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "delete-record", "sponsor", "reason-4", "YouTube"]); - await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "delete-record-1", "sponsor", "reason-5"]); - await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "delete-record-1", "intro", "reason-5"]); + await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "delete-record-1", "sponsor", "reason-5", "YouTube"]); + await db.prepare("run", insertLockCategoryQuery, [lockVIPUserHash, "delete-record-1", "intro", "reason-5", "YouTube"]); }); it("Should update the database version when starting the application", async () => {