From 2a8da2ba3cbfbf7ac46e5ba7ba071588f3f2d8b5 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Mon, 4 Dec 2023 19:20:46 +0100 Subject: separate xray page #1286 --- web/entity/entity.go | 69 +++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 39 deletions(-) (limited to 'web/entity') diff --git a/web/entity/entity.go b/web/entity/entity.go index 1428abe0..1c90305e 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -2,12 +2,10 @@ package entity import ( "crypto/tls" - "encoding/json" "net" "strings" "time" "x-ui/util/common" - "x-ui/xray" ) type Msg struct { @@ -27,36 +25,35 @@ type Pager struct { } type AllSetting struct { - WebListen string `json:"webListen" form:"webListen"` - WebDomain string `json:"webDomain" form:"webDomain"` - WebPort int `json:"webPort" form:"webPort"` - WebCertFile string `json:"webCertFile" form:"webCertFile"` - WebKeyFile string `json:"webKeyFile" form:"webKeyFile"` - WebBasePath string `json:"webBasePath" form:"webBasePath"` - SessionMaxAge int `json:"sessionMaxAge" form:"sessionMaxAge"` - ExpireDiff int `json:"expireDiff" form:"expireDiff"` - TrafficDiff int `json:"trafficDiff" form:"trafficDiff"` - TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"` - TgBotToken string `json:"tgBotToken" form:"tgBotToken"` - TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"` - TgRunTime string `json:"tgRunTime" form:"tgRunTime"` - TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"` - TgBotLoginNotify bool `json:"tgBotLoginNotify" form:"tgBotLoginNotify"` - TgCpu int `json:"tgCpu" form:"tgCpu"` - TgLang string `json:"tgLang" form:"tgLang"` - XrayTemplateConfig string `json:"xrayTemplateConfig" form:"xrayTemplateConfig"` - TimeLocation string `json:"timeLocation" form:"timeLocation"` - SecretEnable bool `json:"secretEnable" form:"secretEnable"` - SubEnable bool `json:"subEnable" form:"subEnable"` - SubListen string `json:"subListen" form:"subListen"` - SubPort int `json:"subPort" form:"subPort"` - SubPath string `json:"subPath" form:"subPath"` - SubDomain string `json:"subDomain" form:"subDomain"` - SubCertFile string `json:"subCertFile" form:"subCertFile"` - SubKeyFile string `json:"subKeyFile" form:"subKeyFile"` - SubUpdates int `json:"subUpdates" form:"subUpdates"` - SubEncrypt bool `json:"subEncrypt" form:"subEncrypt"` - SubShowInfo bool `json:"subShowInfo" form:"subShowInfo"` + WebListen string `json:"webListen" form:"webListen"` + WebDomain string `json:"webDomain" form:"webDomain"` + WebPort int `json:"webPort" form:"webPort"` + WebCertFile string `json:"webCertFile" form:"webCertFile"` + WebKeyFile string `json:"webKeyFile" form:"webKeyFile"` + WebBasePath string `json:"webBasePath" form:"webBasePath"` + SessionMaxAge int `json:"sessionMaxAge" form:"sessionMaxAge"` + ExpireDiff int `json:"expireDiff" form:"expireDiff"` + TrafficDiff int `json:"trafficDiff" form:"trafficDiff"` + TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"` + TgBotToken string `json:"tgBotToken" form:"tgBotToken"` + TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"` + TgRunTime string `json:"tgRunTime" form:"tgRunTime"` + TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"` + TgBotLoginNotify bool `json:"tgBotLoginNotify" form:"tgBotLoginNotify"` + TgCpu int `json:"tgCpu" form:"tgCpu"` + TgLang string `json:"tgLang" form:"tgLang"` + TimeLocation string `json:"timeLocation" form:"timeLocation"` + SecretEnable bool `json:"secretEnable" form:"secretEnable"` + SubEnable bool `json:"subEnable" form:"subEnable"` + SubListen string `json:"subListen" form:"subListen"` + SubPort int `json:"subPort" form:"subPort"` + SubPath string `json:"subPath" form:"subPath"` + SubDomain string `json:"subDomain" form:"subDomain"` + SubCertFile string `json:"subCertFile" form:"subCertFile"` + SubKeyFile string `json:"subKeyFile" form:"subKeyFile"` + SubUpdates int `json:"subUpdates" form:"subUpdates"` + SubEncrypt bool `json:"subEncrypt" form:"subEncrypt"` + SubShowInfo bool `json:"subShowInfo" form:"subShowInfo"` } func (s *AllSetting) CheckValid() error { @@ -107,13 +104,7 @@ func (s *AllSetting) CheckValid() error { s.WebBasePath += "/" } - xrayConfig := &xray.Config{} - err := json.Unmarshal([]byte(s.XrayTemplateConfig), xrayConfig) - if err != nil { - return common.NewError("xray template config invalid:", err) - } - - _, err = time.LoadLocation(s.TimeLocation) + _, err := time.LoadLocation(s.TimeLocation) if err != nil { return common.NewError("time location not exist:", s.TimeLocation) } -- cgit v1.2.3 From 6a404ed6e8abeacbc6eb44537e87684521480d20 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 4 Dec 2023 23:35:42 +0330 Subject: remove unused structure Co-Authored-By: Alireza Ahmadi --- web/entity/entity.go | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'web/entity') diff --git a/web/entity/entity.go b/web/entity/entity.go index 1c90305e..2c7b39ca 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -14,16 +14,6 @@ type Msg struct { Obj interface{} `json:"obj"` } -type Pager struct { - Current int `json:"current"` - PageSize int `json:"page_size"` - Total int `json:"total"` - OrderBy string `json:"order_by"` - Desc bool `json:"desc"` - Key string `json:"key"` - List interface{} `json:"list"` -} - type AllSetting struct { WebListen string `json:"webListen" form:"webListen"` WebDomain string `json:"webDomain" form:"webDomain"` -- cgit v1.2.3 From 5e47b4e94925c2272a7f0a4cc355cede72c671a4 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Fri, 8 Dec 2023 17:18:51 +0100 Subject: pagination and sub URI support #1300 --- web/entity/entity.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'web/entity') diff --git a/web/entity/entity.go b/web/entity/entity.go index 2c7b39ca..94f0171f 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -22,6 +22,7 @@ type AllSetting struct { WebKeyFile string `json:"webKeyFile" form:"webKeyFile"` WebBasePath string `json:"webBasePath" form:"webBasePath"` SessionMaxAge int `json:"sessionMaxAge" form:"sessionMaxAge"` + PageSize int `json:"pageSize" form:"pageSize"` ExpireDiff int `json:"expireDiff" form:"expireDiff"` TrafficDiff int `json:"trafficDiff" form:"trafficDiff"` TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"` @@ -44,6 +45,7 @@ type AllSetting struct { SubUpdates int `json:"subUpdates" form:"subUpdates"` SubEncrypt bool `json:"subEncrypt" form:"subEncrypt"` SubShowInfo bool `json:"subShowInfo" form:"subShowInfo"` + SubURI string `json:"subURI" form:"subURI"` } func (s *AllSetting) CheckValid() error { @@ -93,6 +95,12 @@ func (s *AllSetting) CheckValid() error { if !strings.HasSuffix(s.WebBasePath, "/") { s.WebBasePath += "/" } + if !strings.HasPrefix(s.SubPath, "/") { + s.SubPath = "/" + s.SubPath + } + if !strings.HasSuffix(s.SubPath, "/") { + s.SubPath += "/" + } _, err := time.LoadLocation(s.TimeLocation) if err != nil { -- cgit v1.2.3 From c980a06969c9595f0b0b7d5db301f2413506eb6f Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Fri, 8 Dec 2023 20:31:17 +0100 Subject: customizable remark #1300 --- web/entity/entity.go | 1 + 1 file changed, 1 insertion(+) (limited to 'web/entity') diff --git a/web/entity/entity.go b/web/entity/entity.go index 94f0171f..d00f51e1 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -25,6 +25,7 @@ type AllSetting struct { PageSize int `json:"pageSize" form:"pageSize"` ExpireDiff int `json:"expireDiff" form:"expireDiff"` TrafficDiff int `json:"trafficDiff" form:"trafficDiff"` + RemarkModel string `json:"remarkModel" form:"remarkModel"` TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"` TgBotToken string `json:"tgBotToken" form:"tgBotToken"` TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"` -- cgit v1.2.3