api/processing: slightly reformat code related to zod

This commit is contained in:
wukko 2024-08-08 23:43:04 +06:00
parent 66d70ffc44
commit e727e3a95b
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
2 changed files with 6 additions and 4 deletions

View file

@ -72,7 +72,9 @@ export function createResponse(responseType, responseData) {
} }
export function normalizeRequest(request) { export function normalizeRequest(request) {
return apiSchema.safeParseAsync(request).catch(() => ({ success: false })); return apiSchema.safeParseAsync(request).catch(() => (
{ success: false }
));
} }
export function getIP(req) { export function getIP(req) {

View file

@ -24,9 +24,9 @@ export const apiSchema = z.object({
["h264", "av1", "vp9"] ["h264", "av1", "vp9"]
).default("h264"), ).default("h264"),
videoQuality: z.enum([ videoQuality: z.enum(
"max", "4320", "2160", "1440", "1080", "720", "480", "360", "240", "144" ["max", "4320", "2160", "1440", "1080", "720", "480", "360", "240", "144"]
]).default("720"), ).default("720"),
youtubeDubLang: z.string() youtubeDubLang: z.string()
.length(2) .length(2)