From 9bd09c8b183836186c8ab25d5831b51baaf52ac1 Mon Sep 17 00:00:00 2001 From: ste87 Date: Sat, 14 Mar 2026 16:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20ServerBuildSettingsCard.ts?= =?UTF-8?q?x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ServerBuildSettingsCard.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ServerBuildSettingsCard.tsx b/ServerBuildSettingsCard.tsx index c30e74c..d6d63e1 100644 --- a/ServerBuildSettingsCard.tsx +++ b/ServerBuildSettingsCard.tsx @@ -49,6 +49,10 @@ const ServerBuildSettingsCard = () => { z.literal(''), z.preprocess(Number, z.number().min(0)), ]), + rateLimit: z.union([ + z.literal(''), + z.preprocess(Number, z.number().min(0)), + ]), bandwidthUsage: z.preprocess(Number, z.number().min(0)), }) @@ -64,6 +68,7 @@ const ServerBuildSettingsCard = () => { bandwidthLimit: server.limits.bandwidth ? (server.limits.bandwidth / 1048576).toString() : '', + rateLimit: server.limits.rateLimit?.toString() ?? '', bandwidthUsage: (server.usages.bandwidth / 1048576).toString(), }, }) @@ -75,6 +80,7 @@ const ServerBuildSettingsCard = () => { snapshotLimit, backupLimit, bandwidthLimit, + rateLimit, bandwidthUsage, ...data } = _data as z.infer @@ -88,6 +94,7 @@ const ServerBuildSettingsCard = () => { backupLimit: backupLimit !== '' ? backupLimit : null, bandwidthLimit: bandwidthLimit !== '' ? bandwidthLimit * 1048576 : null, + rateLimit: rateLimit !== '' ? Number(rateLimit) : null, bandwidthUsage: bandwidthUsage * 1048576, ...data, }) @@ -103,6 +110,7 @@ const ServerBuildSettingsCard = () => { backupLimit: backupLimit.toString() ?? '', bandwidthLimit: bandwidthLimit !== '' ? bandwidthLimit.toString() : '', + rateLimit: rateLimit !== '' ? rateLimit.toString() : '', bandwidthUsage: bandwidthUsage.toString(), }) } catch (error) { @@ -148,6 +156,14 @@ const ServerBuildSettingsCard = () => { 'Leave blank for no limit' } /> +