diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index e89f3cd4..9361b978 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -332,7 +332,13 @@ namespace v2rayN.Handler coreExes = new List { "sing-box-client", "sing-box" }, arguments = "run", coreUrl = Global.singboxCoreUrl, - redirectInfo = true, + redirectInfo = true, + coreReleaseApiUrl = Global.singboxCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl), + coreDownloadUrl32 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-386.zip", + coreDownloadUrl64 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip", + coreDownloadUrlArm64 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip", + match = "sing-box", + versionArg = "version", }); } diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs index 2f0ee736..df23537f 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandle.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs @@ -403,7 +403,10 @@ namespace v2rayN.Handler break; case ECoreType.clash: case ECoreType.clash_meta: - version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value; + version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value; + break; + case ECoreType.sing_box: + version = Regex.Match(echo, $"([0-9.]+)").Groups[1].Value; break; } return version; @@ -468,15 +471,35 @@ namespace v2rayN.Handler switch (RuntimeInformation.ProcessArchitecture) { case Architecture.Arm64: - url = string.Format(coreInfo.coreDownloadUrlArm64, version); + url = coreInfo.coreDownloadUrlArm64; break; case Architecture.X86: - url = string.Format(coreInfo.coreDownloadUrl32, version); + url = coreInfo.coreDownloadUrl32; break; default: - url = string.Format(coreInfo.coreDownloadUrl64, version); + url = coreInfo.coreDownloadUrl64; break; } + url = string.Format(url, version); + break; + } + case ECoreType.sing_box: + { + curVersion = "v" + getCoreVersion(type); + message = string.Format(ResUI.IsLatestCore, curVersion); + switch (RuntimeInformation.ProcessArchitecture) + { + case Architecture.Arm64: + url = coreInfo.coreDownloadUrlArm64; + break; + case Architecture.X86: + url = coreInfo.coreDownloadUrl32; + break; + default: + url = coreInfo.coreDownloadUrl64; + break; + } + url = string.Format(url, version, version.Replace("v", "")); break; } case ECoreType.v2rayN: diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index c29ca041..a285c49e 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -133,6 +133,7 @@ namespace v2rayN.ViewModels public ReactiveCommand CheckUpdateXrayCoreCmd { get; } public ReactiveCommand CheckUpdateClashCoreCmd { get; } public ReactiveCommand CheckUpdateClashMetaCoreCmd { get; } + public ReactiveCommand CheckUpdateSingBoxCoreCmd { get; } public ReactiveCommand CheckUpdateGeoCmd { get; } @@ -472,6 +473,10 @@ namespace v2rayN.ViewModels { CheckUpdateCore(ECoreType.clash_meta); }); + CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() => + { + CheckUpdateCore(ECoreType.sing_box); + }); CheckUpdateGeoCmd = ReactiveCommand.Create(() => { CheckUpdateGeo(); diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index 9d6de362..b7690e5b 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -229,6 +229,11 @@ Height="{StaticResource MenuItemHeight}" Header="Clash.Meta Core" /> + + vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateClashMetaCore).DisposeWith(disposables); + this.BindCommand(ViewModel, vm => vm.CheckUpdateSingBoxCoreCmd, v => v.menuCheckUpdateSingBoxCore).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.CheckUpdateGeoCmd, v => v.menuCheckUpdateGeo).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);