Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2023-10-18 12:52:07 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2023-10-18 12:52:07 +0300
commitb0aaece6eb1f7c31a2eaa7870aa990151df84c04 (patch)
tree3816e8eb537462a765ca20d24caaadcfea31d592 /web/service
parentc0ef791f01f601d278f1c4ca3380d6b7716ca9e1 (diff)
remove iran.dat
so after this you need to click on "reset to default configuration"
Diffstat (limited to 'web/service')
-rw-r--r--web/service/config.json1
-rw-r--r--web/service/server.go47
2 files changed, 9 insertions, 39 deletions
diff --git a/web/service/config.json b/web/service/config.json
index 57dfa323..c846d590 100644
--- a/web/service/config.json
+++ b/web/service/config.json
@@ -1,7 +1,6 @@
{
"log": {
"loglevel": "warning",
- "access": "./access.log",
"error": "./error.log"
},
"api": {
diff --git a/web/service/server.go b/web/service/server.go
index a56be10d..d88fa098 100644
--- a/web/service/server.go
+++ b/web/service/server.go
@@ -376,50 +376,21 @@ func (s *ServerService) UpdateXray(version string) error {
return err
}
- downloadFile := func(fileName string, url string) error {
- os.Remove(fileName)
- file, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDWR|os.O_TRUNC, fs.ModePerm)
- if err != nil {
- return err
- }
- defer file.Close()
- resp, err := http.Get(url)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
- if resp.StatusCode != http.StatusOK {
- return fmt.Errorf("download file failed: %s", resp.Status)
- }
- _, err = io.Copy(file, resp.Body)
+ err = copyZipFile("xray", xray.GetBinaryPath())
+ if err != nil {
return err
}
-
- copyFiles := map[string]string{
- "xray": xray.GetBinaryPath(),
- "geosite.dat": xray.GetGeositePath(),
- "geoip.dat": xray.GetGeoipPath(),
- }
-
- downloadFiles := map[string]string{
- xray.GetIranPath(): "https://github.com/MasterKia/iran-hosted-domains/releases/latest/download/iran.dat",
- }
-
- for fileName, filePath := range copyFiles {
- err := copyZipFile(fileName, filePath)
- if err != nil {
- return err
- }
+ err = copyZipFile("geosite.dat", xray.GetGeositePath())
+ if err != nil {
+ return err
}
-
- for fileName, filePath := range downloadFiles {
- err := downloadFile(fileName, filePath)
- if err != nil {
- return err
- }
+ err = copyZipFile("geoip.dat", xray.GetGeoipPath())
+ if err != nil {
+ return err
}
return nil
+
}
func (s *ServerService) GetLogs(count string, level string, syslog string) []string {