From 2683c61995424b31cf6f0d66350fde542e8d0f06 Mon Sep 17 00:00:00 2001 From: Michael C Date: Sat, 17 Dec 2022 23:35:13 -0500 Subject: [PATCH] add minUserIDLength config option --- ci.json | 3 ++- config.json.example | 3 ++- src/config.ts | 3 ++- src/routes/voteOnSponsorTime.ts | 2 +- src/types/config.model.ts | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ci.json b/ci.json index 5a3ee2f..1637b41 100644 --- a/ci.json +++ b/ci.json @@ -76,5 +76,6 @@ "clientSecret": "testClientSecret", "redirectUri": "http://127.0.0.1/fake/callback" }, - "minReputationToSubmitFiller": -1 + "minReputationToSubmitFiller": -1, + "minUserIDLength": 0 } diff --git a/config.json.example b/config.json.example index 2445ba9..7adefc2 100644 --- a/config.json.example +++ b/config.json.example @@ -66,5 +66,6 @@ { "name": "vipUsers" }] - } + }, + "minUserIDLength": 30 // minimum length of UserID to be accepted } diff --git a/src/config.ts b/src/config.ts index e8ae606..53e86f6 100644 --- a/src/config.ts +++ b/src/config.ts @@ -166,7 +166,8 @@ addDefaults(config, { }, gumroad: { productPermalinks: ["sponsorblock"] - } + }, + minUserIDLength: 30 }); loadFromEnv(config); migrate(config); diff --git a/src/routes/voteOnSponsorTime.ts b/src/routes/voteOnSponsorTime.ts index bbda1e2..186c8f9 100644 --- a/src/routes/voteOnSponsorTime.ts +++ b/src/routes/voteOnSponsorTime.ts @@ -325,7 +325,7 @@ export async function vote(ip: IPAddress, UUID: SegmentUUID, paramUserID: UserID return { status: 400 }; } // Ignore this vote, invalid - if (paramUserID.length < 30 && config.mode !== "test") { + if (paramUserID.length < config.minUserIDLength) { return { status: 200 }; } diff --git a/src/types/config.model.ts b/src/types/config.model.ts index 3f7e1ae..058048e 100644 --- a/src/types/config.model.ts +++ b/src/types/config.model.ts @@ -94,7 +94,8 @@ export interface SBSConfig { } gumroad: { productPermalinks: string[], - } + }, + minUserIDLength: number } export interface WebhookConfig {