Some fixes and improvements (#1077)

* [refactor] api controller

* [update] use status code for jsonMsg and 401 to unauthorize

* [update] handle response status code via axios

* [lint] all .go files
This commit is contained in:
Hamidreza
2024-03-10 20:30:44 +03:30
committed by GitHub
parent e3c2b42048
commit b6ccb2e076
40 changed files with 135 additions and 142 deletions

View File

@@ -15,6 +15,7 @@ import (
"strconv"
"strings"
"time"
"x-ui/config"
"x-ui/database"
"x-ui/logger"
@@ -250,7 +251,6 @@ func (s *ServerService) GetXrayVersions() ([]string, error) {
}
func (s *ServerService) StopXrayService() (string error) {
err := s.xrayService.StopXray()
if err != nil {
logger.Error("stop xray failed:", err)
@@ -261,7 +261,6 @@ func (s *ServerService) StopXrayService() (string error) {
}
func (s *ServerService) RestartXrayService() (string error) {
s.xrayService.StopXray()
defer func() {
err := s.xrayService.RestartXray(true)
@@ -365,7 +364,6 @@ func (s *ServerService) UpdateXray(version string) error {
}
return nil
}
func (s *ServerService) GetLogs(count string, level string, syslog string) []string {