2 Commits c5bbb6b632 ... 2ce9c3cc81

Author SHA1 Message Date
  Alireza Ahmadi 2ce9c3cc81 fix core restart on client change (#2603) 5 days ago
  Azoo224 0a8bfc2725 Bash menu: "No Such File or Directory" While Installing Certs (#2602) 5 days ago
2 changed files with 22 additions and 12 deletions
  1. 15 11
      web/service/inbound.go
  2. 7 1
      x-ui.sh

+ 15 - 11
web/service/inbound.go

@@ -588,8 +588,12 @@ func (s *InboundService) DelInboundClient(inboundId int, clientId string) (bool,
 				logger.Debug("Client deleted by api:", email)
 				needRestart = false
 			} else {
-				logger.Debug("Unable to del client by api:", err1)
-				needRestart = true
+				if strings.Contains(err1.Error(), fmt.Sprintf("User %s not found.", email)) {
+					logger.Debug("User is already deleted. Nothing to do more...")
+				} else {
+					logger.Debug("Error in deleting client by api:", err1)
+					needRestart = true
+				}
 			}
 			s.xrayApi.Close()
 		}
@@ -713,10 +717,14 @@ func (s *InboundService) UpdateInboundClient(data *model.Inbound, clientId strin
 		if oldClients[clientIndex].Enable {
 			err1 := s.xrayApi.RemoveUser(oldInbound.Tag, oldEmail)
 			if err1 == nil {
-				logger.Debug("Old client deleted by api:", clients[0].Email)
+				logger.Debug("Old client deleted by api:", oldEmail)
 			} else {
-				logger.Debug("Error in deleting client by api:", err1)
-				needRestart = true
+				if strings.Contains(err1.Error(), fmt.Sprintf("User %s not found.", oldEmail)) {
+					logger.Debug("User is already deleted. Nothing to do more...")
+				} else {
+					logger.Debug("Error in deleting client by api:", err1)
+					needRestart = true
+				}
 			}
 		}
 		if clients[0].Enable {
@@ -1037,12 +1045,8 @@ func (s *InboundService) disableInvalidInbounds(tx *gorm.DB) (bool, int64, error
 			if err1 == nil {
 				logger.Debug("Inbound disabled by api:", tag)
 			} else {
-				if strings.Contains(err1.Error(), fmt.Sprintf("User %s not found.", tag)) {
-					logger.Debug("User is already disabled. Nothing to do more...")
-				} else {
-					logger.Debug("Error in disabling client by api:", err1)
-					needRestart = true
-				}
+				logger.Debug("Error in disabling inbound by api:", err1)
+				needRestart = true
 			}
 		}
 		s.xrayApi.Close()

+ 7 - 1
x-ui.sh

@@ -1183,8 +1183,14 @@ ssl_cert_issue_CF() {
         fi
 
         # Install the certificate
+        mkdir -p ${certPath}/${CF_Domain}
+        if [ $? -ne 0 ]; then
+            LOGE "Failed to create directory: ${certPath}/${CF_Domain}"
+            exit 1
+        fi
+
         ~/.acme.sh/acme.sh --installcert -d ${CF_Domain} -d *.${CF_Domain} \
-            --cert-file ${certPath}/${CF_Domain}/fullchain.pem \
+            --fullchain-file ${certPath}/${CF_Domain}/fullchain.pem \
             --key-file ${certPath}/${CF_Domain}/privkey.pem
 
         if [ $? -ne 0 ]; then