mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-31 18:24:10 +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:
parent
982a78ecdd
commit
b1c141a515
5 changed files with 17 additions and 7 deletions
|
|
@ -27,6 +27,7 @@ export interface AllSetting {
|
||||||
ldapUserFilter: string;
|
ldapUserFilter: string;
|
||||||
ldapVlessField: string;
|
ldapVlessField: string;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
|
panelProxy: string;
|
||||||
remarkModel: string;
|
remarkModel: string;
|
||||||
restartXrayOnClientDisable: boolean;
|
restartXrayOnClientDisable: boolean;
|
||||||
sessionMaxAge: number;
|
sessionMaxAge: number;
|
||||||
|
|
@ -113,6 +114,7 @@ export interface AllSettingView {
|
||||||
ldapUserFilter: string;
|
ldapUserFilter: string;
|
||||||
ldapVlessField: string;
|
ldapVlessField: string;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
|
panelProxy: string;
|
||||||
remarkModel: string;
|
remarkModel: string;
|
||||||
restartXrayOnClientDisable: boolean;
|
restartXrayOnClientDisable: boolean;
|
||||||
sessionMaxAge: number;
|
sessionMaxAge: number;
|
||||||
|
|
@ -183,6 +185,7 @@ export interface Client {
|
||||||
enable: boolean;
|
enable: boolean;
|
||||||
expiryTime: number;
|
expiryTime: number;
|
||||||
flow?: string;
|
flow?: string;
|
||||||
|
group?: string;
|
||||||
id?: string;
|
id?: string;
|
||||||
limitIp: number;
|
limitIp: number;
|
||||||
password?: string;
|
password?: string;
|
||||||
|
|
@ -210,6 +213,7 @@ export interface ClientRecord {
|
||||||
enable: boolean;
|
enable: boolean;
|
||||||
expiryTime: number;
|
expiryTime: number;
|
||||||
flow: string;
|
flow: string;
|
||||||
|
group: string;
|
||||||
id: number;
|
id: number;
|
||||||
limitIp: number;
|
limitIp: number;
|
||||||
password: string;
|
password: string;
|
||||||
|
|
@ -295,6 +299,7 @@ export interface InboundClientIps {
|
||||||
export interface InboundFallback {
|
export interface InboundFallback {
|
||||||
alpn: string;
|
alpn: string;
|
||||||
childId: number;
|
childId: number;
|
||||||
|
dest: string;
|
||||||
id: number;
|
id: number;
|
||||||
masterId: number;
|
masterId: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,10 @@ export const AllSettingSchema = z.object({
|
||||||
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(1).max(1000),
|
||||||
|
panelProxy: z.string(),
|
||||||
remarkModel: z.string(),
|
remarkModel: z.string(),
|
||||||
restartXrayOnClientDisable: z.boolean(),
|
restartXrayOnClientDisable: z.boolean(),
|
||||||
sessionMaxAge: z.number().int().min(0).max(525600),
|
sessionMaxAge: z.number().int().min(1).max(525600),
|
||||||
subAnnounce: z.string(),
|
subAnnounce: z.string(),
|
||||||
subCertFile: z.string(),
|
subCertFile: z.string(),
|
||||||
subClashEnable: z.boolean(),
|
subClashEnable: z.boolean(),
|
||||||
|
|
@ -116,9 +117,10 @@ export const AllSettingViewSchema = z.object({
|
||||||
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(1).max(1000),
|
||||||
|
panelProxy: z.string(),
|
||||||
remarkModel: z.string(),
|
remarkModel: z.string(),
|
||||||
restartXrayOnClientDisable: z.boolean(),
|
restartXrayOnClientDisable: z.boolean(),
|
||||||
sessionMaxAge: z.number().int().min(0).max(525600),
|
sessionMaxAge: z.number().int().min(1).max(525600),
|
||||||
subAnnounce: z.string(),
|
subAnnounce: z.string(),
|
||||||
subCertFile: z.string(),
|
subCertFile: z.string(),
|
||||||
subClashEnable: z.boolean(),
|
subClashEnable: z.boolean(),
|
||||||
|
|
@ -188,6 +190,7 @@ export const ClientSchema = z.object({
|
||||||
enable: z.boolean(),
|
enable: z.boolean(),
|
||||||
expiryTime: z.number().int(),
|
expiryTime: z.number().int(),
|
||||||
flow: z.string().optional(),
|
flow: z.string().optional(),
|
||||||
|
group: z.string().optional(),
|
||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
limitIp: z.number().int(),
|
limitIp: z.number().int(),
|
||||||
password: z.string().optional(),
|
password: z.string().optional(),
|
||||||
|
|
@ -217,6 +220,7 @@ export const ClientRecordSchema = z.object({
|
||||||
enable: z.boolean(),
|
enable: z.boolean(),
|
||||||
expiryTime: z.number().int(),
|
expiryTime: z.number().int(),
|
||||||
flow: z.string(),
|
flow: z.string(),
|
||||||
|
group: z.string(),
|
||||||
id: z.number().int(),
|
id: z.number().int(),
|
||||||
limitIp: z.number().int(),
|
limitIp: z.number().int(),
|
||||||
password: z.string(),
|
password: z.string(),
|
||||||
|
|
@ -288,7 +292,7 @@ export const InboundSchema = z.object({
|
||||||
listen: z.string(),
|
listen: z.string(),
|
||||||
nodeId: z.number().int().nullable().optional(),
|
nodeId: z.number().int().nullable().optional(),
|
||||||
port: z.number().int().min(1).max(65535),
|
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(),
|
remark: z.string(),
|
||||||
settings: z.unknown(),
|
settings: z.unknown(),
|
||||||
sniffing: z.unknown(),
|
sniffing: z.unknown(),
|
||||||
|
|
@ -310,6 +314,7 @@ export type InboundClientIps = z.infer<typeof InboundClientIpsSchema>;
|
||||||
export const InboundFallbackSchema = z.object({
|
export const InboundFallbackSchema = z.object({
|
||||||
alpn: z.string(),
|
alpn: z.string(),
|
||||||
childId: z.number().int(),
|
childId: z.number().int(),
|
||||||
|
dest: z.string(),
|
||||||
id: z.number().int(),
|
id: z.number().int(),
|
||||||
masterId: z.number().int(),
|
masterId: z.number().int(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ export default function GeneralTab({ allSetting, updateSetting }: GeneralTabProp
|
||||||
</SettingListItem>
|
</SettingListItem>
|
||||||
|
|
||||||
<SettingListItem paddings="small" title={t('pages.settings.sessionMaxAge')} description={t('pages.settings.sessionMaxAgeDesc')}>
|
<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 })} />
|
onChange={(v) => updateSetting({ sessionMaxAge: Number(v) || 0 })} />
|
||||||
</SettingListItem>
|
</SettingListItem>
|
||||||
|
|
||||||
|
|
@ -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={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 })} />
|
onChange={(v) => updateSetting({ pageSize: Number(v) || 0 })} />
|
||||||
</SettingListItem>
|
</SettingListItem>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export const AllSettingSchema = z.object({
|
||||||
webCertFile: z.string().optional(),
|
webCertFile: z.string().optional(),
|
||||||
webKeyFile: z.string().optional(),
|
webKeyFile: z.string().optional(),
|
||||||
webBasePath: absolutePath.optional(),
|
webBasePath: absolutePath.optional(),
|
||||||
sessionMaxAge: z.number().int().min(1).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(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
|
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
|
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
|
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
|
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)
|
PanelProxy string `json:"panelProxy" form:"panelProxy"` // Proxy URL for the panel's own outbound requests (GitHub/Telegram)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue