diff --git a/web/controller/setting.go b/web/controller/setting.go index 248f3ee5..3aed69e6 100644 --- a/web/controller/setting.go +++ b/web/controller/setting.go @@ -3,7 +3,6 @@ package controller import ( "errors" "time" - "x-ui/util/common" "x-ui/web/entity" "x-ui/web/service" "x-ui/web/session" @@ -45,7 +44,6 @@ func (a *SettingController) initRouter(g *gin.RouterGroup) { g.GET("/getDefaultJsonConfig", a.getDefaultJsonConfig) g.POST("/updateUserSecret", a.updateSecret) g.POST("/getUserSecret", a.getUserSecret) - g.GET("/searchDatafiles", a.searchDatafiles) } func (a *SettingController) getAllSetting(c *gin.Context) { @@ -159,18 +157,3 @@ func (a *SettingController) getUserSecret(c *gin.Context) { jsonObj(c, user, nil) } } - -func (a *SettingController) searchDatafiles(c *gin.Context) { - searchString := c.Query("query") - if searchString == "" { - err := common.NewError("data query parameter is empty") - jsonMsg(c, "Invalid query:", err) - return - } - found, err := a.settingService.SearchDatafiles(searchString) - if err != nil { - jsonMsg(c, "Something went wrong!", err) - return - } - jsonObj(c, found, nil) -} diff --git a/web/html/xui/form/client.html b/web/html/xui/form/client.html index b655ba64..7bebddcb 100644 --- a/web/html/xui/form/client.html +++ b/web/html/xui/form/client.html @@ -32,7 +32,7 @@ - + @@ -45,7 +45,7 @@ - + Telegram ID diff --git a/web/html/xui/form/protocol/shadowsocks.html b/web/html/xui/form/protocol/shadowsocks.html index b59b4722..47198671 100644 --- a/web/html/xui/form/protocol/shadowsocks.html +++ b/web/html/xui/form/protocol/shadowsocks.html @@ -29,7 +29,7 @@ - + Telegram ID diff --git a/web/html/xui/form/protocol/vless.html b/web/html/xui/form/protocol/vless.html index 5c4624f4..16722490 100644 --- a/web/html/xui/form/protocol/vless.html +++ b/web/html/xui/form/protocol/vless.html @@ -16,7 +16,7 @@ - + @@ -29,7 +29,7 @@ - + Telegram ID diff --git a/web/html/xui/form/protocol/vmess.html b/web/html/xui/form/protocol/vmess.html index 786b770b..b54039af 100644 --- a/web/html/xui/form/protocol/vmess.html +++ b/web/html/xui/form/protocol/vmess.html @@ -21,7 +21,7 @@
- + @@ -34,7 +34,7 @@ - +
Telegram ID diff --git a/web/service/setting.go b/web/service/setting.go index 6635bf48..d3072252 100644 --- a/web/service/setting.go +++ b/web/service/setting.go @@ -1,12 +1,10 @@ package service import ( - "bufio" _ "embed" "encoding/json" "errors" "fmt" - "os" "reflect" "strconv" "strings" @@ -18,7 +16,6 @@ import ( "x-ui/util/random" "x-ui/util/reflect_util" "x-ui/web/entity" - "x-ui/xray" ) //go:embed config.json @@ -354,27 +351,3 @@ func (s *SettingService) UpdateAllSetting(allSetting *entity.AllSetting) error { } return common.Combine(errs...) } - -func (s *SettingService) SearchDatafiles(query string) (bool, error) { - // Open the file for reading - file, err := os.Open(xray.GetGeositePath()) - if err != nil { - return false, common.NewErrorf("Error opening geosite.dat: %v", err) - } - defer file.Close() - - // Create a scanner to read the file line-by-line - scanner := bufio.NewScanner(file) - for scanner.Scan() { - line := scanner.Text() - if strings.Contains(strings.ToLower(line), strings.ToLower(query)) { - return true, nil - } - } - - err = scanner.Err() - if err != nil { - return false, common.NewErrorf("Error while scanning geosite.dat: %v", err) - } - return false, nil -}