Skip to content

Commit c9a278b

Browse files
committed
Check for updates mihomo
1 parent 8ee5304 commit c9a278b

File tree

5 files changed

+17
-51
lines changed

5 files changed

+17
-51
lines changed

v2rayN/v2rayN/Handler/CoreHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Diagnostics;
22
using System.IO;
3-
using System.Reactive.Linq;
43
using System.Text;
54
using v2rayN.Enums;
65
using v2rayN.Handler.CoreConfig;

v2rayN/v2rayN/Handler/LazyConfig.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,11 @@ private void InitCoreInfo()
336336
arguments = "-f config.json",
337337
coreUrl = Global.MihomoCoreUrl,
338338
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
339+
coreDownloadUrl32 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip",
340+
coreDownloadUrl64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
341+
coreDownloadUrlArm64 = Global.ClashMetaCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
339342
match = "Mihomo",
343+
versionArg = "-v",
340344
redirectInfo = true,
341345
});
342346

v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,10 @@ public class MainWindowViewModel : ReactiveObject
150150

151151
//CheckUpdate
152152
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
153-
154-
//public ReactiveCommand<Unit, Unit> CheckUpdateV2flyCoreCmd { get; }
155-
156-
//public ReactiveCommand<Unit, Unit> CheckUpdateSagerNetCoreCmd { get; }
157153
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
158-
159-
//public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
160-
//public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
154+
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
161155
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
162-
163156
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
164-
165157
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
166158

167159
[Reactive]
@@ -520,29 +512,17 @@ public MainWindowViewModel(ISnackbarMessageQueue snackbarMessageQueue, Action<EV
520512
{
521513
CheckUpdateN();
522514
});
523-
//CheckUpdateV2flyCoreCmd = ReactiveCommand.Create(() =>
524-
//{
525-
// CheckUpdateCore(ECoreType.v2fly_v5);
526-
//});
527-
//CheckUpdateSagerNetCoreCmd = ReactiveCommand.Create(() =>
528-
//{
529-
// CheckUpdateCore(ECoreType.SagerNet);
530-
//});
531515
CheckUpdateXrayCoreCmd = ReactiveCommand.Create(() =>
532516
{
533-
CheckUpdateCore(ECoreType.Xray);
517+
CheckUpdateCore(ECoreType.Xray, null);
518+
});
519+
CheckUpdateClashMetaCoreCmd = ReactiveCommand.Create(() =>
520+
{
521+
CheckUpdateCore(ECoreType.mihomo, false);
534522
});
535-
//CheckUpdateClashCoreCmd = ReactiveCommand.Create(() =>
536-
//{
537-
// CheckUpdateCore(ECoreType.clash);
538-
//});
539-
//CheckUpdateClashMetaCoreCmd = ReactiveCommand.Create(() =>
540-
//{
541-
// CheckUpdateCore(ECoreType.clash_meta);
542-
//});
543523
CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() =>
544524
{
545-
CheckUpdateCore(ECoreType.sing_box);
525+
CheckUpdateCore(ECoreType.sing_box, null);
546526
});
547527
CheckUpdateGeoCmd = ReactiveCommand.Create(() =>
548528
{
@@ -1473,7 +1453,7 @@ void _updateUI(bool success, string msg)
14731453
(new UpdateHandle()).CheckUpdateGuiN(_config, _updateUI, _config.guiItem.checkPreReleaseUpdate);
14741454
}
14751455

1476-
private void CheckUpdateCore(ECoreType type)
1456+
private void CheckUpdateCore(ECoreType type, bool? preRelease)
14771457
{
14781458
void _updateUI(bool success, string msg)
14791459
{
@@ -1499,7 +1479,7 @@ void _updateUI(bool success, string msg)
14991479
}
15001480
}
15011481
}
1502-
(new UpdateHandle()).CheckUpdateCore(type, _config, _updateUI, _config.guiItem.checkPreReleaseUpdate);
1482+
(new UpdateHandle()).CheckUpdateCore(type, _config, _updateUI, preRelease ?? _config.guiItem.checkPreReleaseUpdate);
15031483
}
15041484

15051485
private void CheckUpdateGeo()

v2rayN/v2rayN/Views/MainWindow.xaml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
</Window.Resources>
3838

3939
<materialDesign:DialogHost
40-
Identifier="RootDialog"
4140
materialDesign:TransitionAssist.DisableTransitions="True"
41+
Identifier="RootDialog"
4242
SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}"
4343
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
4444
<Grid>
@@ -231,28 +231,14 @@
231231
x:Name="menuCheckUpdateN"
232232
Height="{StaticResource MenuItemHeight}"
233233
Header="V2rayN" />
234-
<!--<MenuItem
235-
x:Name="menuCheckUpdateV2flyCore"
236-
Height="{StaticResource MenuItemHeight}"
237-
Header="V2fly v5 Core" />
238-
<MenuItem
239-
x:Name="menuCheckUpdateSagerNetCore"
240-
Height="{StaticResource MenuItemHeight}"
241-
Header="SagerNet Core" />-->
242234
<MenuItem
243235
x:Name="menuCheckUpdateXrayCore"
244236
Height="{StaticResource MenuItemHeight}"
245237
Header="Xray Core" />
246-
<!--<Separator Margin="-40,5" />
247-
<MenuItem
248-
x:Name="menuCheckUpdateClashCore"
249-
Height="{StaticResource MenuItemHeight}"
250-
Header="Clash Core" />
251238
<MenuItem
252-
x:Name="menuCheckUpdateClashMetaCore"
239+
x:Name="menuCheckUpdateMihomoCore"
253240
Height="{StaticResource MenuItemHeight}"
254-
Header="Clash.Meta Core" />
255-
<Separator Margin="-40,5" />-->
241+
Header="Mihomo Core" />
256242
<MenuItem
257243
x:Name="menuCheckUpdateSingBoxCore"
258244
Height="{StaticResource MenuItemHeight}"

v2rayN/v2rayN/Views/MainWindow.xaml.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ public MainWindow()
144144

145145
//check update
146146
this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables);
147-
//this.BindCommand(ViewModel, vm => vm.CheckUpdateV2flyCoreCmd, v => v.menuCheckUpdateV2flyCore).DisposeWith(disposables);
148-
//this.BindCommand(ViewModel, vm => vm.CheckUpdateSagerNetCoreCmd, v => v.menuCheckUpdateSagerNetCore).DisposeWith(disposables);
149147
this.BindCommand(ViewModel, vm => vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables);
150-
//this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).DisposeWith(disposables);
151-
//this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateClashMetaCore).DisposeWith(disposables);
148+
this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateMihomoCore).DisposeWith(disposables);
152149
this.BindCommand(ViewModel, vm => vm.CheckUpdateSingBoxCoreCmd, v => v.menuCheckUpdateSingBoxCore).DisposeWith(disposables);
153150
this.BindCommand(ViewModel, vm => vm.CheckUpdateGeoCmd, v => v.menuCheckUpdateGeo).DisposeWith(disposables);
154151

0 commit comments

Comments
 (0)