mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-02 18:39:36 +00:00
fix(settings): sync generated schemas
- entity.go: tighten SessionMaxAge validate tag gte=0 -> gte=1 to match the panel UI (min 60) and the hand-written setting.ts schema - GeneralTab.tsx: add max bounds to sessionMaxAge (525600) and pageSize (1000), raise pageSize min to 1 - regenerate zod.ts/types.ts, picking up pending drift: panelProxy field, client group field, InboundFallback.dest, and dropping the stale hysteria2 protocol enum value
This commit is contained in:
@@ -27,6 +27,7 @@ export interface AllSetting {
|
||||
ldapUserFilter: string;
|
||||
ldapVlessField: string;
|
||||
pageSize: number;
|
||||
panelProxy: string;
|
||||
remarkModel: string;
|
||||
restartXrayOnClientDisable: boolean;
|
||||
sessionMaxAge: number;
|
||||
@@ -113,6 +114,7 @@ export interface AllSettingView {
|
||||
ldapUserFilter: string;
|
||||
ldapVlessField: string;
|
||||
pageSize: number;
|
||||
panelProxy: string;
|
||||
remarkModel: string;
|
||||
restartXrayOnClientDisable: boolean;
|
||||
sessionMaxAge: number;
|
||||
@@ -183,6 +185,7 @@ export interface Client {
|
||||
enable: boolean;
|
||||
expiryTime: number;
|
||||
flow?: string;
|
||||
group?: string;
|
||||
id?: string;
|
||||
limitIp: number;
|
||||
password?: string;
|
||||
@@ -210,6 +213,7 @@ export interface ClientRecord {
|
||||
enable: boolean;
|
||||
expiryTime: number;
|
||||
flow: string;
|
||||
group: string;
|
||||
id: number;
|
||||
limitIp: number;
|
||||
password: string;
|
||||
@@ -295,6 +299,7 @@ export interface InboundClientIps {
|
||||
export interface InboundFallback {
|
||||
alpn: string;
|
||||
childId: number;
|
||||
dest: string;
|
||||
id: number;
|
||||
masterId: number;
|
||||
name: string;
|
||||
|
||||
@@ -29,9 +29,10 @@ export const AllSettingSchema = z.object({
|
||||
ldapUserFilter: z.string(),
|
||||
ldapVlessField: z.string(),
|
||||
pageSize: z.number().int().min(1).max(1000),
|
||||
panelProxy: z.string(),
|
||||
remarkModel: z.string(),
|
||||
restartXrayOnClientDisable: z.boolean(),
|
||||
sessionMaxAge: z.number().int().min(0).max(525600),
|
||||
sessionMaxAge: z.number().int().min(1).max(525600),
|
||||
subAnnounce: z.string(),
|
||||
subCertFile: z.string(),
|
||||
subClashEnable: z.boolean(),
|
||||
@@ -116,9 +117,10 @@ export const AllSettingViewSchema = z.object({
|
||||
ldapUserFilter: z.string(),
|
||||
ldapVlessField: z.string(),
|
||||
pageSize: z.number().int().min(1).max(1000),
|
||||
panelProxy: z.string(),
|
||||
remarkModel: z.string(),
|
||||
restartXrayOnClientDisable: z.boolean(),
|
||||
sessionMaxAge: z.number().int().min(0).max(525600),
|
||||
sessionMaxAge: z.number().int().min(1).max(525600),
|
||||
subAnnounce: z.string(),
|
||||
subCertFile: z.string(),
|
||||
subClashEnable: z.boolean(),
|
||||
@@ -188,6 +190,7 @@ export const ClientSchema = z.object({
|
||||
enable: z.boolean(),
|
||||
expiryTime: z.number().int(),
|
||||
flow: z.string().optional(),
|
||||
group: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
limitIp: z.number().int(),
|
||||
password: z.string().optional(),
|
||||
@@ -217,6 +220,7 @@ export const ClientRecordSchema = z.object({
|
||||
enable: z.boolean(),
|
||||
expiryTime: z.number().int(),
|
||||
flow: z.string(),
|
||||
group: z.string(),
|
||||
id: z.number().int(),
|
||||
limitIp: z.number().int(),
|
||||
password: z.string(),
|
||||
@@ -288,7 +292,7 @@ export const InboundSchema = z.object({
|
||||
listen: z.string(),
|
||||
nodeId: z.number().int().nullable().optional(),
|
||||
port: z.number().int().min(1).max(65535),
|
||||
protocol: z.enum(['vmess', 'vless', 'trojan', 'shadowsocks', 'wireguard', 'hysteria', 'hysteria2', 'http', 'mixed', 'tunnel']),
|
||||
protocol: z.enum(['vmess', 'vless', 'trojan', 'shadowsocks', 'wireguard', 'hysteria', 'http', 'mixed', 'tunnel']),
|
||||
remark: z.string(),
|
||||
settings: z.unknown(),
|
||||
sniffing: z.unknown(),
|
||||
@@ -310,6 +314,7 @@ export type InboundClientIps = z.infer<typeof InboundClientIpsSchema>;
|
||||
export const InboundFallbackSchema = z.object({
|
||||
alpn: z.string(),
|
||||
childId: z.number().int(),
|
||||
dest: z.string(),
|
||||
id: z.number().int(),
|
||||
masterId: z.number().int(),
|
||||
name: z.string(),
|
||||
|
||||
@@ -155,7 +155,7 @@ export default function GeneralTab({ allSetting, updateSetting }: GeneralTabProp
|
||||
</SettingListItem>
|
||||
|
||||
<SettingListItem paddings="small" title={t('pages.settings.sessionMaxAge')} description={t('pages.settings.sessionMaxAgeDesc')}>
|
||||
<InputNumber value={allSetting.sessionMaxAge} min={60} style={{ width: '100%' }}
|
||||
<InputNumber value={allSetting.sessionMaxAge} min={60} max={525600} style={{ width: '100%' }}
|
||||
onChange={(v) => updateSetting({ sessionMaxAge: Number(v) || 0 })} />
|
||||
</SettingListItem>
|
||||
|
||||
@@ -180,7 +180,7 @@ export default function GeneralTab({ allSetting, updateSetting }: GeneralTabProp
|
||||
</SettingListItem>
|
||||
|
||||
<SettingListItem paddings="small" title={t('pages.settings.pageSize')} description={t('pages.settings.pageSizeDesc')}>
|
||||
<InputNumber value={allSetting.pageSize} min={0} step={5} style={{ width: '100%' }}
|
||||
<InputNumber value={allSetting.pageSize} min={1} max={1000} step={5} style={{ width: '100%' }}
|
||||
onChange={(v) => updateSetting({ pageSize: Number(v) || 0 })} />
|
||||
</SettingListItem>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ export const AllSettingSchema = z.object({
|
||||
webCertFile: z.string().optional(),
|
||||
webKeyFile: z.string().optional(),
|
||||
webBasePath: absolutePath.optional(),
|
||||
sessionMaxAge: z.number().int().min(1).optional(),
|
||||
sessionMaxAge: z.number().int().min(1).max(525600).optional(),
|
||||
trustedProxyCIDRs: z.string().optional(),
|
||||
panelProxy: z.string().optional(),
|
||||
pageSize: z.number().int().min(1).max(1000).optional(),
|
||||
|
||||
@@ -27,7 +27,7 @@ type AllSetting struct {
|
||||
WebCertFile string `json:"webCertFile" form:"webCertFile"` // Path to SSL certificate file for web server
|
||||
WebKeyFile string `json:"webKeyFile" form:"webKeyFile"` // Path to SSL private key file for web server
|
||||
WebBasePath string `json:"webBasePath" form:"webBasePath"` // Base path for web panel URLs
|
||||
SessionMaxAge int `json:"sessionMaxAge" form:"sessionMaxAge" validate:"gte=0,lte=525600"` // Session maximum age in minutes (cap at one year)
|
||||
SessionMaxAge int `json:"sessionMaxAge" form:"sessionMaxAge" validate:"gte=1,lte=525600"` // Session maximum age in minutes (cap at one year)
|
||||
TrustedProxyCIDRs string `json:"trustedProxyCIDRs" form:"trustedProxyCIDRs"` // Trusted reverse proxy IPs/CIDRs for forwarded headers
|
||||
PanelProxy string `json:"panelProxy" form:"panelProxy"` // Proxy URL for the panel's own outbound requests (GitHub/Telegram)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user