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:
authorHamidreza <70919649+hamid-gh98@users.noreply.github.com>2024-03-13 10:54:41 +0300
committerGitHub <noreply@github.com>2024-03-13 10:54:41 +0300
commit569c9428fb7924fb693605385f745e4bf524dc20 (patch)
treedba6587b61f2f845c422d7a4fe29d3c8b59da2e0 /web/service/setting.go
parent97489e743abe004a3d4865746c4c7f261aca4e10 (diff)
[iplimit] fix access log path in settings service (#2044)
* [iplimit] fix access log path in settings service better to avoid hardcoding the access log path to enhance flexibility. not all users prefer the default './access.log' * [iplimit] fix iplimit
Diffstat (limited to 'web/service/setting.go')
-rw-r--r--web/service/setting.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/web/service/setting.go b/web/service/setting.go
index 4a293dc0..9e740059 100644
--- a/web/service/setting.go
+++ b/web/service/setting.go
@@ -17,6 +17,7 @@ import (
"x-ui/util/random"
"x-ui/util/reflect_util"
"x-ui/web/entity"
+ "x-ui/xray"
)
//go:embed config.json
@@ -460,22 +461,11 @@ func (s *SettingService) SetWarp(data string) error {
}
func (s *SettingService) GetIpLimitEnable() (bool, error) {
- templateConfig, err := s.GetXrayConfigTemplate()
+ accessLogPath, err := xray.GetAccessLogPath()
if err != nil {
return false, err
}
-
- var xrayConfig map[string]interface{}
- err = json.Unmarshal([]byte(templateConfig), &xrayConfig)
- if err != nil {
- return false, err
- }
- if logConfig, ok := xrayConfig["log"].(map[string]interface{}); ok {
- if accessLogPath, ok := logConfig["access"].(string); ok {
- return accessLogPath == "./access.log", nil
- }
- }
- return false, nil
+ return (accessLogPath != "none" && accessLogPath != ""), nil
}
func (s *SettingService) UpdateAllSetting(allSetting *entity.AllSetting) error {