mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
remove warning for access log
because you can't see the iplimit when there is no path for access log :D
This commit is contained in:
parent
272457740f
commit
2e1461e6dc
1 changed files with 4 additions and 13 deletions
|
@ -37,7 +37,7 @@ func (j *CheckClientIpJob) Run() {
|
|||
|
||||
shouldClearAccessLog := false
|
||||
f2bInstalled := j.checkFail2BanInstalled()
|
||||
isAccessLogAvailable := j.checkAccessLogAvailable(f2bInstalled)
|
||||
isAccessLogAvailable := j.checkAccessLogAvailable()
|
||||
|
||||
if j.hasLimitIp() {
|
||||
if f2bInstalled && isAccessLogAvailable {
|
||||
|
@ -49,7 +49,7 @@ func (j *CheckClientIpJob) Run() {
|
|||
}
|
||||
}
|
||||
|
||||
if shouldClearAccessLog || isAccessLogAvailable && time.Now().Unix()-j.lastClear > 3600 {
|
||||
if shouldClearAccessLog || (isAccessLogAvailable && time.Now().Unix()-j.lastClear > 3600) {
|
||||
j.clearAccessLog()
|
||||
}
|
||||
}
|
||||
|
@ -174,27 +174,18 @@ func (j *CheckClientIpJob) checkFail2BanInstalled() bool {
|
|||
return err == nil
|
||||
}
|
||||
|
||||
func (j *CheckClientIpJob) checkAccessLogAvailable(handleWarning bool) bool {
|
||||
func (j *CheckClientIpJob) checkAccessLogAvailable() bool {
|
||||
isAvailable := true
|
||||
warningMsg := ""
|
||||
accessLogPath, err := xray.GetAccessLogPath()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// access log is not available if it is set to 'none' or an empty string
|
||||
switch accessLogPath {
|
||||
case "none":
|
||||
warningMsg = "Access log is set to 'none', check your Xray Configs"
|
||||
isAvailable = false
|
||||
case "":
|
||||
warningMsg = "Access log doesn't exist in your Xray Configs"
|
||||
case "none", "":
|
||||
isAvailable = false
|
||||
}
|
||||
|
||||
if handleWarning && warningMsg != "" {
|
||||
logger.Warning(warningMsg)
|
||||
}
|
||||
return isAvailable
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue