Add max title length

This commit is contained in:
Ajay
2023-07-06 16:36:37 -04:00
parent d2f8e3aee4
commit d1d2b011f8
3 changed files with 7 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ addDefaults(config, {
chapter: ["chapter"]
},
deArrowTypes: ["title", "thumbnail"],
maxTitleLength: 110,
maxNumberOfActiveWarnings: 1,
hoursAfterWarningExpires: 16300000,
adminUserID: "",

View File

@@ -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;

View File

@@ -68,6 +68,7 @@ export interface SBSConfig {
categoryList: string[];
deArrowTypes: DeArrowType[];
categorySupport: Record<string, string[]>;
maxTitleLength: number;
getTopUsersCacheTimeMinutes: number;
maxNumberOfActiveWarnings: number;
hoursAfterWarningExpires: number;