mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 20:54:14 +00:00
fix(settings): enforce trafficDiff max of 100 in UI (#4769)
The trafficDiff InputNumber and form schema lacked an upper bound, so values above 100 were accepted in the UI but rejected by the backend (gte=0,lte=100), failing the entire settings save with a misleading 'request body failed validation' error. Add max=100 to the input and .max(100) to the schema.
This commit is contained in:
parent
13c04bb982
commit
39b716409a
2 changed files with 2 additions and 2 deletions
|
|
@ -205,7 +205,7 @@ export default function GeneralTab({ allSetting, updateSetting }: GeneralTabProp
|
||||||
onChange={(v) => updateSetting({ expireDiff: Number(v) || 0 })} />
|
onChange={(v) => updateSetting({ expireDiff: Number(v) || 0 })} />
|
||||||
</SettingListItem>
|
</SettingListItem>
|
||||||
<SettingListItem paddings="small" title={t('pages.settings.trafficDiff')} description={t('pages.settings.trafficDiffDesc')}>
|
<SettingListItem paddings="small" title={t('pages.settings.trafficDiff')} description={t('pages.settings.trafficDiffDesc')}>
|
||||||
<InputNumber value={allSetting.trafficDiff} min={0} style={{ width: '100%' }}
|
<InputNumber value={allSetting.trafficDiff} min={0} max={100} style={{ width: '100%' }}
|
||||||
onChange={(v) => updateSetting({ trafficDiff: Number(v) || 0 })} />
|
onChange={(v) => updateSetting({ trafficDiff: Number(v) || 0 })} />
|
||||||
</SettingListItem>
|
</SettingListItem>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export const AllSettingSchema = z.object({
|
||||||
panelProxy: z.string().optional(),
|
panelProxy: z.string().optional(),
|
||||||
pageSize: z.number().int().min(1).max(1000).optional(),
|
pageSize: z.number().int().min(1).max(1000).optional(),
|
||||||
expireDiff: nonNegativeInt.optional(),
|
expireDiff: nonNegativeInt.optional(),
|
||||||
trafficDiff: nonNegativeInt.optional(),
|
trafficDiff: nonNegativeInt.max(100).optional(),
|
||||||
remarkModel: z.string().optional(),
|
remarkModel: z.string().optional(),
|
||||||
datepicker: z.enum(['gregorian', 'jalalian']).optional(),
|
datepicker: z.enum(['gregorian', 'jalalian']).optional(),
|
||||||
tgBotEnable: z.boolean().optional(),
|
tgBotEnable: z.boolean().optional(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue