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