Kaynağa Gözat

fix(settings): allow pagination size of 0 to disable pagination

The pageSize setting described '(0 = disable)' and the inbounds table already treated 0 as show-all, but every validation layer enforced a minimum of 1. Relax the bound to gte=0 in the AllSetting struct tag (source of truth for the generated frontend schemas), regenerate zod, and lower the min on the hand-written schema and the InputNumber control.
MHSanaei 15 saat önce
ebeveyn
işleme
2f12b34635

+ 2 - 2
frontend/src/generated/zod.ts

@@ -28,7 +28,7 @@ export const AllSettingSchema = z.object({
   ldapUserAttr: z.string(),
   ldapUserAttr: z.string(),
   ldapUserFilter: z.string(),
   ldapUserFilter: z.string(),
   ldapVlessField: z.string(),
   ldapVlessField: z.string(),
-  pageSize: z.number().int().min(1).max(1000),
+  pageSize: z.number().int().min(0).max(1000),
   panelProxy: z.string(),
   panelProxy: z.string(),
   remarkModel: z.string(),
   remarkModel: z.string(),
   restartXrayOnClientDisable: z.boolean(),
   restartXrayOnClientDisable: z.boolean(),
@@ -116,7 +116,7 @@ export const AllSettingViewSchema = z.object({
   ldapUserAttr: z.string(),
   ldapUserAttr: z.string(),
   ldapUserFilter: z.string(),
   ldapUserFilter: z.string(),
   ldapVlessField: z.string(),
   ldapVlessField: z.string(),
-  pageSize: z.number().int().min(1).max(1000),
+  pageSize: z.number().int().min(0).max(1000),
   panelProxy: z.string(),
   panelProxy: z.string(),
   remarkModel: z.string(),
   remarkModel: z.string(),
   restartXrayOnClientDisable: z.boolean(),
   restartXrayOnClientDisable: z.boolean(),

+ 1 - 1
frontend/src/pages/settings/GeneralTab.tsx

@@ -180,7 +180,7 @@ export default function GeneralTab({ allSetting, updateSetting }: GeneralTabProp
             </SettingListItem>
             </SettingListItem>
 
 
             <SettingListItem paddings="small" title={t('pages.settings.pageSize')} description={t('pages.settings.pageSizeDesc')}>
             <SettingListItem paddings="small" title={t('pages.settings.pageSize')} description={t('pages.settings.pageSizeDesc')}>
-              <InputNumber value={allSetting.pageSize} min={1} max={1000} step={5} style={{ width: '100%' }}
+              <InputNumber value={allSetting.pageSize} min={0} max={1000} step={5} style={{ width: '100%' }}
                 onChange={(v) => updateSetting({ pageSize: Number(v) || 0 })} />
                 onChange={(v) => updateSetting({ pageSize: Number(v) || 0 })} />
             </SettingListItem>
             </SettingListItem>
 
 

+ 1 - 1
frontend/src/schemas/setting.ts

@@ -14,7 +14,7 @@ export const AllSettingSchema = z.object({
   sessionMaxAge: z.number().int().min(1).max(525600).optional(),
   sessionMaxAge: z.number().int().min(1).max(525600).optional(),
   trustedProxyCIDRs: z.string().optional(),
   trustedProxyCIDRs: z.string().optional(),
   panelProxy: z.string().optional(),
   panelProxy: z.string().optional(),
-  pageSize: z.number().int().min(1).max(1000).optional(),
+  pageSize: z.number().int().min(0).max(1000).optional(),
   expireDiff: nonNegativeInt.optional(),
   expireDiff: nonNegativeInt.optional(),
   trafficDiff: nonNegativeInt.max(100).optional(),
   trafficDiff: nonNegativeInt.max(100).optional(),
   remarkModel: z.string().optional(),
   remarkModel: z.string().optional(),

+ 1 - 1
web/entity/entity.go

@@ -32,7 +32,7 @@ type AllSetting struct {
 	PanelProxy        string `json:"panelProxy" form:"panelProxy"`                                   // Proxy URL for the panel's own outbound requests (GitHub/Telegram)
 	PanelProxy        string `json:"panelProxy" form:"panelProxy"`                                   // Proxy URL for the panel's own outbound requests (GitHub/Telegram)
 
 
 	// UI settings
 	// UI settings
-	PageSize    int    `json:"pageSize" form:"pageSize" validate:"gte=1,lte=1000"`      // Number of items per page in lists
+	PageSize    int    `json:"pageSize" form:"pageSize" validate:"gte=0,lte=1000"`      // Number of items per page in lists (0 disables pagination)
 	ExpireDiff  int    `json:"expireDiff" form:"expireDiff" validate:"gte=0"`           // Expiration warning threshold in days
 	ExpireDiff  int    `json:"expireDiff" form:"expireDiff" validate:"gte=0"`           // Expiration warning threshold in days
 	TrafficDiff int    `json:"trafficDiff" form:"trafficDiff" validate:"gte=0,lte=100"` // Traffic warning threshold percentage
 	TrafficDiff int    `json:"trafficDiff" form:"trafficDiff" validate:"gte=0,lte=100"` // Traffic warning threshold percentage
 	RemarkModel string `json:"remarkModel" form:"remarkModel"`                          // Remark model pattern for inbounds
 	RemarkModel string `json:"remarkModel" form:"remarkModel"`                          // Remark model pattern for inbounds