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:
authorfgsfds <4870330+fgsfds@users.noreply.github.com>2025-08-06 12:20:07 +0300
committerGitHub <noreply@github.com>2025-08-06 12:20:07 +0300
commit5e641ff9e80a6ec75ff2e3258737892689f8e109 (patch)
tree5d745ecf761bb2e41dff5eb84c86aa1801f10fb2 /web/service
parent58898e5758697c4c2d9a91704b3f2662adb7167d (diff)
Added Update all geofiles button (#3318)
* added Update all geofiles button * localized update all string
Diffstat (limited to 'web/service')
-rw-r--r--web/service/server.go44
1 files changed, 30 insertions, 14 deletions
diff --git a/web/service/server.go b/web/service/server.go
index ee13b268..8b1bc0a9 100644
--- a/web/service/server.go
+++ b/web/service/server.go
@@ -511,7 +511,7 @@ func (s *ServerService) GetXrayLogs(
line := strings.TrimSpace(scanner.Text())
if line == "" || strings.Contains(line, "api -> api") {
- //skipping empty lines and api calls
+ //skipping empty lines and api calls
continue
}
@@ -742,27 +742,43 @@ func (s *ServerService) UpdateGeofile(fileName string) error {
return nil
}
- var fileURL string
- for _, file := range files {
- if file.FileName == fileName {
- fileURL = file.URL
- break
+ var errorMessages []string
+
+ if fileName == "" {
+ for _, file := range files {
+ destPath := fmt.Sprintf("%s/%s", config.GetBinFolderPath(), file.FileName)
+
+ if err := downloadFile(file.URL, destPath); err != nil {
+ errorMessages = append(errorMessages, fmt.Sprintf("Error downloading Geofile '%s': %v", file.FileName, err))
+ }
}
- }
+ } else {
+ destPath := fmt.Sprintf("%s/%s", config.GetBinFolderPath(), fileName)
- if fileURL == "" {
- return common.NewErrorf("File '%s' not found in the list of Geofiles", fileName)
- }
+ var fileURL string
+ for _, file := range files {
+ if file.FileName == fileName {
+ fileURL = file.URL
+ break
+ }
+ }
- destPath := fmt.Sprintf("%s/%s", config.GetBinFolderPath(), fileName)
+ if fileURL == "" {
+ errorMessages = append(errorMessages, fmt.Sprintf("File '%s' not found in the list of Geofiles", fileName))
+ }
- if err := downloadFile(fileURL, destPath); err != nil {
- return common.NewErrorf("Error downloading Geofile '%s': %v", fileName, err)
+ if err := downloadFile(fileURL, destPath); err != nil {
+ errorMessages = append(errorMessages, fmt.Sprintf("Error downloading Geofile '%s': %v", fileName, err))
+ }
}
err := s.RestartXrayService()
if err != nil {
- return common.NewErrorf("Updated Geofile '%s' but Failed to start Xray: %v", fileName, err)
+ errorMessages = append(errorMessages, fmt.Sprintf("Updated Geofile '%s' but Failed to start Xray: %v", fileName, err))
+ }
+
+ if len(errorMessages) > 0 {
+ return common.NewErrorf("%s", strings.Join(errorMessages, "\r\n"))
}
return nil