diff --git a/Speed/CreateServerModal.tsx b/Speed/CreateServerModal.tsx index 7e88bc3..4c276c7 100644 --- a/Speed/CreateServerModal.tsx +++ b/Speed/CreateServerModal.tsx @@ -68,9 +68,9 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => { z.literal(''), z.preprocess(Number, z.number().min(0)), ]), - rateLimit: z.union([ // 新增 - z.literal(''), - z.preprocess(Number, z.number().min(0)), + rateLimit: z.union([ + z.literal(''), + z.preprocess(Number, z.number().min(0)), ]), accountPassword: password(usKeyboardCharacters()).nonempty(), shouldCreateServer: z.literal(true), @@ -83,7 +83,7 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => { nodeId: z.preprocess(Number, z.number()), userId: z.preprocess(Number, z.number()), vmid: z.union([ - z.preprocess(Number, z.number().min(100).max(999999999)), + z.preprocess(Number, z.number().int().min(100).max(999999999)), z.literal(''), ]), hostname: hostname().max(191).nonempty(), @@ -103,6 +103,10 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => { z.literal(''), z.preprocess(Number, z.number().min(0)), ]), + rateLimit: z.union([ + z.literal(''), + z.preprocess(Number, z.number().min(0)), + ]), accountPassword: password(usKeyboardCharacters()).optional(), shouldCreateServer: z.literal(false), startOnCompletion: z.boolean(), @@ -129,6 +133,7 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => { snapshotLimit: '0', backupLimit: '', bandwidthLimit: '', + rateLimit: '', accountPassword: '', shouldCreateServer: true, startOnCompletion: false, @@ -148,6 +153,7 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => { snapshotLimit, backupLimit, bandwidthLimit, + rateLimit, addressIds, accountPassword, ...data @@ -165,6 +171,7 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => { backups: backupLimit !== '' ? backupLimit : null, bandwidth: bandwidthLimit !== '' ? bandwidthLimit * 1048576 : null, + rateLimit: rateLimit !== '' ? Number(rateLimit) : null, addressIds, }, accountPassword: accountPassword ? accountPassword : null, @@ -257,6 +264,14 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => { } /> +