mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-11 22:17:14 +03:00
Add max title length
This commit is contained in:
@@ -35,6 +35,7 @@ addDefaults(config, {
|
||||
chapter: ["chapter"]
|
||||
},
|
||||
deArrowTypes: ["title", "thumbnail"],
|
||||
maxTitleLength: 110,
|
||||
maxNumberOfActiveWarnings: 1,
|
||||
hoursAfterWarningExpires: 16300000,
|
||||
adminUserID: "",
|
||||
|
||||
@@ -45,6 +45,11 @@ export async function postBranding(req: Request, res: Response) {
|
||||
const now = Date.now();
|
||||
const voteType = 1;
|
||||
|
||||
if (title && !isVip && title.title.length > config.maxTitleLength) {
|
||||
res.status(400).send("Your title is too long. Please keep titles concise.");
|
||||
return;
|
||||
}
|
||||
|
||||
await Promise.all([(async () => {
|
||||
if (title) {
|
||||
const existingUUID = (await db.prepare("get", `SELECT "UUID" from "titles" where "videoID" = ? AND "title" = ?`, [videoID, title.title]))?.UUID;
|
||||
|
||||
@@ -68,6 +68,7 @@ export interface SBSConfig {
|
||||
categoryList: string[];
|
||||
deArrowTypes: DeArrowType[];
|
||||
categorySupport: Record<string, string[]>;
|
||||
maxTitleLength: number;
|
||||
getTopUsersCacheTimeMinutes: number;
|
||||
maxNumberOfActiveWarnings: number;
|
||||
hoursAfterWarningExpires: number;
|
||||
|
||||
Reference in New Issue
Block a user