From aab95a1adcec7b7d2e9c3d6c360f872a2f4d5d66 Mon Sep 17 00:00:00 2001 From: Michael C Date: Sun, 29 Aug 2021 21:43:21 -0400 Subject: [PATCH] add config key for poiMinimumStartTime --- src/config.ts | 1 + src/routes/postSkipSegments.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index cb985ab..2aaaf12 100644 --- a/src/config.ts +++ b/src/config.ts @@ -50,6 +50,7 @@ addDefaults(config, { userCounterURL: null, newLeafURLs: null, maxRewardTimePerSegmentInSeconds: 600, + poiMinimumStartTime: 2, postgres: null, dumpDatabase: { enabled: false, diff --git a/src/routes/postSkipSegments.ts b/src/routes/postSkipSegments.ts index 243a301..4aac84d 100644 --- a/src/routes/postSkipSegments.ts +++ b/src/routes/postSkipSegments.ts @@ -391,8 +391,8 @@ async function checkEachSegmentValid(userID: string, videoID: VideoID } // Check for POI segments before 1 second - if (getCategoryActionType(segments[i].category) === CategoryActionType.POI && startTime < 1) { - return { pass: false, errorMessage: "POI must be after 1 second", errorCode: 400}; + if (getCategoryActionType(segments[i].category) === CategoryActionType.POI && startTime < config.poiMinimumStartTime) { + return { pass: false, errorMessage: `POI cannot be that early`, errorCode: 400}; } if (!isVIP && segments[i].category === "sponsor" && Math.abs(startTime - endTime) < 1) {