mirror of
https://github.com/2dust/v2rayN.git
synced 2025-05-02 21:28:51 +00:00
Add Check update for sing-box core
This commit is contained in:
parent
6b12549cd9
commit
0808ec1612
5 changed files with 45 additions and 5 deletions
|
@ -332,7 +332,13 @@ namespace v2rayN.Handler
|
||||||
coreExes = new List<string> { "sing-box-client", "sing-box" },
|
coreExes = new List<string> { "sing-box-client", "sing-box" },
|
||||||
arguments = "run",
|
arguments = "run",
|
||||||
coreUrl = Global.singboxCoreUrl,
|
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",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -403,7 +403,10 @@ namespace v2rayN.Handler
|
||||||
break;
|
break;
|
||||||
case ECoreType.clash:
|
case ECoreType.clash:
|
||||||
case ECoreType.clash_meta:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
|
@ -468,15 +471,35 @@ namespace v2rayN.Handler
|
||||||
switch (RuntimeInformation.ProcessArchitecture)
|
switch (RuntimeInformation.ProcessArchitecture)
|
||||||
{
|
{
|
||||||
case Architecture.Arm64:
|
case Architecture.Arm64:
|
||||||
url = string.Format(coreInfo.coreDownloadUrlArm64, version);
|
url = coreInfo.coreDownloadUrlArm64;
|
||||||
break;
|
break;
|
||||||
case Architecture.X86:
|
case Architecture.X86:
|
||||||
url = string.Format(coreInfo.coreDownloadUrl32, version);
|
url = coreInfo.coreDownloadUrl32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
url = string.Format(coreInfo.coreDownloadUrl64, version);
|
url = coreInfo.coreDownloadUrl64;
|
||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case ECoreType.v2rayN:
|
case ECoreType.v2rayN:
|
||||||
|
|
|
@ -133,6 +133,7 @@ namespace v2rayN.ViewModels
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -472,6 +473,10 @@ namespace v2rayN.ViewModels
|
||||||
{
|
{
|
||||||
CheckUpdateCore(ECoreType.clash_meta);
|
CheckUpdateCore(ECoreType.clash_meta);
|
||||||
});
|
});
|
||||||
|
CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() =>
|
||||||
|
{
|
||||||
|
CheckUpdateCore(ECoreType.sing_box);
|
||||||
|
});
|
||||||
CheckUpdateGeoCmd = ReactiveCommand.Create(() =>
|
CheckUpdateGeoCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
CheckUpdateGeo();
|
CheckUpdateGeo();
|
||||||
|
|
|
@ -229,6 +229,11 @@
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="Clash.Meta Core" />
|
Header="Clash.Meta Core" />
|
||||||
<Separator Margin="-40,5" />
|
<Separator Margin="-40,5" />
|
||||||
|
<MenuItem
|
||||||
|
x:Name="menuCheckUpdateSingBoxCore"
|
||||||
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
Header="SingBox Core" />
|
||||||
|
<Separator Margin="-40,5" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
x:Name="menuCheckUpdateGeo"
|
x:Name="menuCheckUpdateGeo"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
|
|
@ -129,6 +129,7 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).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.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.CheckUpdateGeoCmd, v => v.menuCheckUpdateGeo).DisposeWith(disposables);
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
|
||||||
|
|
Loading…
Reference in a new issue