api/processing: slightly reformat code related to zod
This commit is contained in:
parent
66d70ffc44
commit
e727e3a95b
2 changed files with 6 additions and 4 deletions
|
@ -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) {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue