mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-03-03 01:33:33 +03:00
remove search Data files
This commit is contained in:
parent
e64a9eeee6
commit
9e8ac8a087
@ -3,7 +3,6 @@ package controller
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
"x-ui/util/common"
|
|
||||||
"x-ui/web/entity"
|
"x-ui/web/entity"
|
||||||
"x-ui/web/service"
|
"x-ui/web/service"
|
||||||
"x-ui/web/session"
|
"x-ui/web/session"
|
||||||
@ -45,7 +44,6 @@ func (a *SettingController) initRouter(g *gin.RouterGroup) {
|
|||||||
g.GET("/getDefaultJsonConfig", a.getDefaultJsonConfig)
|
g.GET("/getDefaultJsonConfig", a.getDefaultJsonConfig)
|
||||||
g.POST("/updateUserSecret", a.updateSecret)
|
g.POST("/updateUserSecret", a.updateSecret)
|
||||||
g.POST("/getUserSecret", a.getUserSecret)
|
g.POST("/getUserSecret", a.getUserSecret)
|
||||||
g.GET("/searchDatafiles", a.searchDatafiles)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *SettingController) getAllSetting(c *gin.Context) {
|
func (a *SettingController) getAllSetting(c *gin.Context) {
|
||||||
@ -159,18 +157,3 @@ func (a *SettingController) getUserSecret(c *gin.Context) {
|
|||||||
jsonObj(c, user, nil)
|
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)
|
|
||||||
}
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="ID" v-if="inbound.protocol === Protocols.VMESS || inbound.protocol === Protocols.VLESS">
|
<a-form-item label="ID" v-if="inbound.protocol === Protocols.VMESS || inbound.protocol === Protocols.VLESS">
|
||||||
<a-icon @click="client.id = RandomUtil.randomUUID()" type="sync"> </a-icon>
|
<a-icon @click="client.id = RandomUtil.randomUUID()" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.id" style="width: 300px;"></a-input>
|
<a-input v-model.trim="client.id" style="width: 300px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email">
|
<a-form-item v-if="client.email">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
@ -45,7 +45,7 @@
|
|||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-input v-model.trim="client.subId"></a-input>
|
<a-input v-model.trim="client.subId"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email">
|
<a-form-item v-if="client.email">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
Telegram ID
|
Telegram ID
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-input v-model.trim="client.subId"></a-input>
|
<a-input v-model.trim="client.subId"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email">
|
<a-form-item v-if="client.email">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
Telegram ID
|
Telegram ID
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="ID">
|
<a-form-item label="ID">
|
||||||
<a-icon @click="client.id = RandomUtil.randomUUID()" type="sync"> </a-icon>
|
<a-icon @click="client.id = RandomUtil.randomUUID()" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.id" style="width: 300px;"></a-input>
|
<a-input v-model.trim="client.id" style="width: 300px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email">
|
<a-form-item v-if="client.email">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
@ -29,7 +29,7 @@
|
|||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-input v-model.trim="client.subId"></a-input>
|
<a-input v-model.trim="client.subId"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email">
|
<a-form-item v-if="client.email">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
Telegram ID
|
Telegram ID
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<a-form-item label="ID">
|
<a-form-item label="ID">
|
||||||
<a-icon @click="client.id = RandomUtil.randomUUID()" type="sync"> </a-icon>
|
<a-icon @click="client.id = RandomUtil.randomUUID()" type="sync"> </a-icon>
|
||||||
<a-input v-model.trim="client.id" style="width: 300px;"></a-input>
|
<a-input v-model.trim="client.id" style="width: 300px;"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email">
|
<a-form-item v-if="client.email">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
@ -34,7 +34,7 @@
|
|||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<a-input v-model.trim="client.subId"></a-input>
|
<a-input v-model.trim="client.subId"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email">
|
<a-form-item v-if="client.email">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
Telegram ID
|
Telegram ID
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -18,7 +16,6 @@ import (
|
|||||||
"x-ui/util/random"
|
"x-ui/util/random"
|
||||||
"x-ui/util/reflect_util"
|
"x-ui/util/reflect_util"
|
||||||
"x-ui/web/entity"
|
"x-ui/web/entity"
|
||||||
"x-ui/xray"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed config.json
|
//go:embed config.json
|
||||||
@ -354,27 +351,3 @@ func (s *SettingService) UpdateAllSetting(allSetting *entity.AllSetting) error {
|
|||||||
}
|
}
|
||||||
return common.Combine(errs...)
|
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
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user