api/schema: update youtubeDubLang to accept all valid language codes

This commit is contained in:
wukko
2024-10-28 19:56:18 +06:00
parent b14c618228
commit cdfc91844d
2 changed files with 7 additions and 11 deletions

View File

@@ -1,7 +1,5 @@
import { z } from "zod";
import { normalizeURL } from "./url.js";
import { verifyLanguageCode } from "../misc/utils.js";
export const apiSchema = z.object({
url: z.string()
@@ -33,17 +31,21 @@ export const apiSchema = z.object({
).default("1080"),
youtubeDubLang: z.string()
.length(2)
.transform(verifyLanguageCode)
.min(2)
.max(8)
.regex(/^[0-9a-zA-Z\-]+$/)
.optional(),
// TODO: remove this variable as it's no longer used
// and is kept for schema compatibility reasons
youtubeDubBrowserLang: z.boolean().default(false),
alwaysProxy: z.boolean().default(false),
disableMetadata: z.boolean().default(false),
tiktokFullAudio: z.boolean().default(false),
tiktokH265: z.boolean().default(false),
twitterGif: z.boolean().default(true),
youtubeDubBrowserLang: z.boolean().default(false),
youtubeHLS: z.boolean().default(false),
})
.strict();