misc: addressed comments

This commit is contained in:
Sheen Capadngan
2025-09-11 00:45:27 +08:00
parent 1dcdb90c62
commit 71ff01daf2
9 changed files with 105 additions and 38 deletions
+3 -2
View File
@@ -4,6 +4,7 @@ import { getConfig } from "@app/lib/config/env";
import { crypto } from "@app/lib/crypto/cryptography";
import { BadRequestError, UnauthorizedError } from "@app/lib/errors";
import { writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -19,7 +20,7 @@ export const registerRelayRouter = async (server: FastifyZodProvider) => {
schema: {
body: z.object({
host: z.string(),
name: z.string()
name: slugSchema({ min: 1, max: 32, field: "name" })
}),
response: {
200: z.object({
@@ -69,7 +70,7 @@ export const registerRelayRouter = async (server: FastifyZodProvider) => {
schema: {
body: z.object({
host: z.string(),
name: z.string()
name: slugSchema({ min: 1, max: 32, field: "name" })
}),
response: {
200: z.object({
+3 -2
View File
@@ -2,6 +2,7 @@ import z from "zod";
import { GatewaysV2Schema } from "@app/db/schemas";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -20,8 +21,8 @@ export const registerGatewayV2Router = async (server: FastifyZodProvider) => {
url: "/",
schema: {
body: z.object({
relayName: z.string(),
name: z.string()
relayName: slugSchema({ min: 1, max: 32, field: "relayName" }),
name: slugSchema({ min: 1, max: 32, field: "name" })
}),
response: {
200: z.object({