diff --git a/config/version b/config/version index 24ed28a..46f4bea 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -v0.3.3.9 \ No newline at end of file +v0.3.3.10 \ No newline at end of file diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 9f0866c..7989ff5 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -55,17 +55,11 @@ const TLS_VERSION_OPTION = { }; const TLS_CIPHER_OPTION = { - RSA_AES_128_CBC: "TLS_RSA_WITH_AES_128_CBC_SHA", - RSA_AES_256_CBC: "TLS_RSA_WITH_AES_256_CBC_SHA", - RSA_AES_128_GCM: "TLS_RSA_WITH_AES_128_GCM_SHA256", - RSA_AES_256_GCM: "TLS_RSA_WITH_AES_256_GCM_SHA384", AES_128_GCM: "TLS_AES_128_GCM_SHA256", AES_256_GCM: "TLS_AES_256_GCM_SHA384", CHACHA20_POLY1305: "TLS_CHACHA20_POLY1305_SHA256", ECDHE_ECDSA_AES_128_CBC: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", ECDHE_ECDSA_AES_256_CBC: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", - ECDHE_RSA_AES_128_CBC: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", - ECDHE_RSA_AES_256_CBC: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", ECDHE_ECDSA_AES_128_GCM: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", ECDHE_ECDSA_AES_256_GCM: "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", ECDHE_RSA_AES_128_GCM: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", @@ -660,44 +654,55 @@ class RealityStreamSettings extends XrayCommonClass { } class SockoptStreamSettings extends XrayCommonClass { - constructor(tcpFastOpen = false, + constructor(tcpMaxSeg = 1440, + tcpFastOpen = false, domainStrategy = DOMAIN_STRATEGY.AsIs, tcpcongestion = '', acceptProxyProtocol = false, tcpKeepAliveIdle = 0, tcpKeepAliveInterval = 0, + tcpUserTimeout = 10000, _interface = "", ) { super(); + this.tcpMaxSeg = tcpMaxSeg; this.tcpFastOpen = tcpFastOpen; this.domainStrategy = domainStrategy; this.tcpcongestion = tcpcongestion; this.acceptProxyProtocol = acceptProxyProtocol; this.tcpKeepAliveIdle = tcpKeepAliveIdle; this.tcpKeepAliveInterval = tcpKeepAliveInterval; + this.tcpUserTimeout = tcpUserTimeout; + this.tcpcongestion = tcpcongestion; this.interface = _interface instanceof Array ? this.interface : _interface; } static fromJson(json = {}) { return new SockoptStreamSettings( + json.tcpMaxSeg, json.tcpFastOpen, json.domainStrategy, json.tcpcongestion, json.acceptProxyProtocol, json.tcpKeepAliveIdle, json.tcpKeepAliveInterval, + json.tcpUserTimeout, + json.tcpcongestion, json.interface, ); } toJson() { return { + tcpMaxSeg: this.tcpMaxSeg, tcpFastOpen: this.tcpFastOpen, domainStrategy: this.domainStrategy, tcpcongestion: this.tcpcongestion, acceptProxyProtocol: this.acceptProxyProtocol, tcpKeepAliveIdle: this.tcpKeepAliveIdle, tcpKeepAliveInterval: this.tcpKeepAliveInterval, + tcpUserTimeout: this.tcpUserTimeout, + tcpcongestion: this.tcpcongestion, interface: this.interface, }; } diff --git a/web/controller/server.go b/web/controller/server.go index 263e252..79599d8 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -1,6 +1,9 @@ package controller import ( + "fmt" + "net/http" + "regexp" "time" "x-ui/web/global" "x-ui/web/service" @@ -8,6 +11,8 @@ import ( "github.com/gin-gonic/gin" ) +var filenameRegex = regexp.MustCompile(`^[a-zA-Z0-9_\-.]+$`) + type ServerController struct { BaseController @@ -192,14 +197,27 @@ func (a *ServerController) getDatabase(c *gin.Context) { jsonMsg(c, "get Database", err) return } + + filename := "x-ui.db" + + if !isValidFilename(filename) { + c.AbortWithError(http.StatusBadRequest, fmt.Errorf("Invalid filename")) + return + } + // Set the headers for the response c.Header("Content-Type", "application/octet-stream") - c.Header("Content-Disposition", "attachment; filename=x-ui.db") + c.Header("Content-Disposition", "attachment; filename"+filename) // Write the file contents to the response c.Writer.Write(db) } +func isValidFilename(filename string) bool { + // Validate that the filename only contains allowed characters + return filenameRegex.MatchString(filename) +} + func (a *ServerController) getConfigJson(c *gin.Context) { configJson, err := a.serverService.GetConfigJson() if err != nil { diff --git a/web/html/xui/form/stream_sockopt.html b/web/html/xui/form/stream_sockopt.html index 11a6d0a..bffcfbe 100644 --- a/web/html/xui/form/stream_sockopt.html +++ b/web/html/xui/form/stream_sockopt.html @@ -15,7 +15,11 @@ - + + + + + @@ -40,6 +44,10 @@ + + + + 系统默认