diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d9c288f..27b72263 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,11 +47,11 @@ jobs: # Download dependencies if [ "${{ matrix.platform }}" == "amd64" ]; then - wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-64.zip + wget https://github.com/XTLS/Xray-core/releases/download/v1.8.1/Xray-linux-64.zip unzip Xray-linux-64.zip rm -f Xray-linux-64.zip else - wget https://github.com/mhsanaei/Xray-core/releases/latest/download/Xray-linux-arm64-v8a.zip + wget https://github.com/XTLS/Xray-core/releases/download/v1.8.1/Xray-linux-arm64-v8a.zip unzip Xray-linux-arm64-v8a.zip rm -f Xray-linux-arm64-v8a.zip fi diff --git a/DockerInit.sh b/DockerInit.sh index d1a5e40a..17bce0c2 100755 --- a/DockerInit.sh +++ b/DockerInit.sh @@ -18,7 +18,7 @@ esac mkdir -p build/bin cd build/bin -wget "https://github.com/mhsanaei/xray-core/releases/latest/download/Xray-linux-${ARCH}.zip" +wget "https://github.com/XTLS/Xray-core/releases/download/v1.8.1/Xray-linux-${ARCH}.zip" unzip "Xray-linux-${ARCH}.zip" rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat iran.dat mv xray "xray-linux-${FNAME}" diff --git a/web/service/server.go b/web/service/server.go index c5f4e264..3de5f3ff 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -224,7 +224,7 @@ func (s *ServerService) GetStatus(lastStatus *Status) *Status { } func (s *ServerService) GetXrayVersions() ([]string, error) { - url := "https://api.github.com/repos/MHSanaei/Xray-core/releases" + url := "https://api.github.com/repos/XTLS/Xray-core/releases" resp, err := http.Get(url) if err != nil { return nil, err @@ -243,14 +243,17 @@ func (s *ServerService) GetXrayVersions() ([]string, error) { if err != nil { return nil, err } - versions := make([]string, 0, len(releases)) + var versions []string for _, release := range releases { - versions = append(versions, release.TagName) + if release.TagName >= "v1.7.5" { + versions = append(versions, release.TagName) + } } return versions, nil } func (s *ServerService) StopXrayService() (string error) { + err := s.xrayService.StopXray() if err != nil { logger.Error("stop xray failed:", err) @@ -261,6 +264,7 @@ func (s *ServerService) StopXrayService() (string error) { } func (s *ServerService) RestartXrayService() (string error) { + s.xrayService.StopXray() defer func() { err := s.xrayService.RestartXray(true) @@ -289,7 +293,7 @@ func (s *ServerService) downloadXRay(version string) (string, error) { } fileName := fmt.Sprintf("Xray-%s-%s.zip", osName, arch) - url := fmt.Sprintf("https://github.com/MHSanaei/Xray-core/releases/download/%s/%s", version, fileName) + url := fmt.Sprintf("https://github.com/XTLS/Xray-core/releases/download/%s/%s", version, fileName) resp, err := http.Get(url) if err != nil { return "", err @@ -370,10 +374,6 @@ func (s *ServerService) UpdateXray(version string) error { if err != nil { return err } - err = copyZipFile("iran.dat", xray.GetIranPath()) - if err != nil { - return err - } return nil } @@ -417,6 +417,7 @@ func (s *ServerService) GetConfigJson() (interface{}, error) { if err != nil { return nil, err } + return jsonData, nil } diff --git a/xray/process.go b/xray/process.go index 0882c716..9bccffd9 100644 --- a/xray/process.go +++ b/xray/process.go @@ -40,14 +40,6 @@ func GetGeoipPath() string { return config.GetBinFolderPath() + "/geoip.dat" } -func GetIranPath() string { - return config.GetBinFolderPath() + "/iran.dat" -} - -func GetBlockedIPsPath() string { - return config.GetBinFolderPath() + "/BlockedIps" -} - func GetIPLimitLogPath() string { return config.GetLogFolder() + "/3xipl.log" } @@ -88,7 +80,6 @@ func stopProcess(p *Process) { p.Stop() } - type Process struct { *process } @@ -203,7 +194,7 @@ func (p *process) Start() (err error) { return common.NewErrorf("Failed to write configuration file: %v", err) } - cmd := exec.Command(GetBinaryPath(), "-c", configPath, "-restrictedIPsPath", GetBlockedIPsPath()) + cmd := exec.Command(GetBinaryPath(), "-c", configPath) p.cmd = cmd stdReader, err := cmd.StdoutPipe()