Skip to content

Commit

Permalink
add minUserIDLength config option
Browse files Browse the repository at this point in the history
  • Loading branch information
mchangrh committed Dec 18, 2022
1 parent cff2325 commit 2683c61
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@
"clientSecret": "testClientSecret",
"redirectUri": "http://127.0.0.1/fake/callback"
},
"minReputationToSubmitFiller": -1
"minReputationToSubmitFiller": -1,
"minUserIDLength": 0
}
3 changes: 2 additions & 1 deletion config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@
{
"name": "vipUsers"
}]
}
},
"minUserIDLength": 30 // minimum length of UserID to be accepted
}
3 changes: 2 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ addDefaults(config, {
},
gumroad: {
productPermalinks: ["sponsorblock"]
}
},
minUserIDLength: 30
});
loadFromEnv(config);
migrate(config);
Expand Down
2 changes: 1 addition & 1 deletion src/routes/voteOnSponsorTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

Expand Down
3 changes: 2 additions & 1 deletion src/types/config.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export interface SBSConfig {
}
gumroad: {
productPermalinks: string[],
}
},
minUserIDLength: number
}

export interface WebhookConfig {
Expand Down

0 comments on commit 2683c61

Please sign in to comment.