mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-03 20:12:07 +03:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f85326cf0e |
@@ -229,7 +229,7 @@ public sealed class CoreInfoManager
|
||||
DownloadUrlLinuxLoong64 = urlSingbox + "/download/{0}/sing-box-{1}-linux-loong64.tar.gz",
|
||||
DownloadUrlOSX64 = urlSingbox + "/download/{0}/sing-box-{1}-darwin-amd64.tar.gz",
|
||||
DownloadUrlOSXArm64 = urlSingbox + "/download/{0}/sing-box-{1}-darwin-arm64.tar.gz",
|
||||
LockedMaxVersion = new SemanticVersion(1, 14, int.MaxValue),
|
||||
//LockedMaxVersion = new SemanticVersion(1, 14, int.MaxValue),
|
||||
Match = "sing-box",
|
||||
VersionArg = "version",
|
||||
},
|
||||
|
||||
@@ -134,7 +134,7 @@ public class TaskManager
|
||||
|
||||
var updateService = new UpdateService(_config, async (success, msg) => await Task.CompletedTask);
|
||||
|
||||
var msgs = await updateService.CheckHasUpdateOnlyAll(_config.CheckUpdateItem.CheckPreReleaseUpdate, _config.CheckUpdateItem.UpdateViaProxy);
|
||||
var msgs = await updateService.CheckHasUpdateOnlyAll(_config.CheckUpdateItem.UpdateViaProxy);
|
||||
foreach (var msg in msgs)
|
||||
{
|
||||
await _updateFunc?.Invoke(false, msg);
|
||||
|
||||
@@ -242,9 +242,9 @@ public class WebDavItem
|
||||
[Serializable]
|
||||
public class CheckUpdateItem
|
||||
{
|
||||
public bool CheckPreReleaseUpdate { get; set; }
|
||||
public bool UpdateViaProxy { get; set; } = true;
|
||||
public List<string>? SelectedCoreTypes { get; set; }
|
||||
public List<string>? CheckPreReleaseCoreTypes { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
@@ -3,6 +3,8 @@ namespace ServiceLib.Models.Dto;
|
||||
public partial class CheckUpdateModel : ReactiveObject
|
||||
{
|
||||
public bool? IsSelected { get; set; }
|
||||
public bool IsCheckPreRelease { get; set; }
|
||||
public bool ShowCheckPreRelease { get; set; }
|
||||
public ECoreType? CoreType { get; set; }
|
||||
[Reactive] public partial string? Remarks { get; set; }
|
||||
public string? FileName { get; set; }
|
||||
|
||||
@@ -111,7 +111,7 @@ public partial class UpdateService(Config config, Func<bool, string, Task> updat
|
||||
return await CheckUpdateAsync(downloadHandle, type, checkPreRelease, blProxy, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<List<string>> CheckHasUpdateOnlyAll(bool preRelease, bool blProxy = true, CancellationToken cancellationToken = default)
|
||||
public async Task<List<string>> CheckHasUpdateOnlyAll(bool blProxy = true, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var msgs = new List<string>();
|
||||
foreach (var type in CoreInfoManager.Instance.GetCheckUpdateCoreTypes())
|
||||
@@ -121,6 +121,7 @@ public partial class UpdateService(Config config, Func<bool, string, Task> updat
|
||||
continue;
|
||||
}
|
||||
|
||||
var preRelease = _config.CheckUpdateItem.CheckPreReleaseCoreTypes?.Contains(type.ToString()) ?? false;
|
||||
var result = await CheckHasUpdateOnly(type, preRelease, blProxy, cancellationToken);
|
||||
if (result.Success && result.Version != null)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
||||
public BulkObservableCollection<CheckUpdateModel> CheckUpdateModels { get; } = [];
|
||||
public ReactiveCommand<RxVoid, RxVoid> CheckUpdateCmd { get; }
|
||||
public ReactiveCommand<RxVoid, RxVoid> CheckOnlyCmd { get; }
|
||||
[Reactive] public partial bool EnableCheckPreReleaseUpdate { get; set; }
|
||||
|
||||
[Reactive] public partial bool EnableUpdateViaProxy { get; set; }
|
||||
|
||||
public CheckUpdateViewModel()
|
||||
@@ -33,12 +33,8 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
||||
_ = UpdateView(_v2rayN, ex.Message);
|
||||
});
|
||||
|
||||
EnableCheckPreReleaseUpdate = _config.CheckUpdateItem.CheckPreReleaseUpdate;
|
||||
EnableUpdateViaProxy = _config.CheckUpdateItem.UpdateViaProxy;
|
||||
|
||||
this.WhenAnyValue(x => x.EnableCheckPreReleaseUpdate)
|
||||
.SubscribeAsync(async _ => await OnCheckPreReleaseUpdateChanged());
|
||||
|
||||
this.WhenAnyValue(x => x.EnableUpdateViaProxy)
|
||||
.Subscribe(c => _ = OnUpdateViaProxyChanged());
|
||||
|
||||
@@ -73,6 +69,8 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
||||
return new()
|
||||
{
|
||||
IsSelected = false,
|
||||
IsCheckPreRelease = false,
|
||||
ShowCheckPreRelease = false,
|
||||
CoreType = coreType,
|
||||
IsGeoFile = false,
|
||||
Remarks = ResUI.menuCheckUpdate + $" ({ResUI.MsgNotSupport})",
|
||||
@@ -83,6 +81,8 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
||||
return new()
|
||||
{
|
||||
IsSelected = _config.CheckUpdateItem.SelectedCoreTypes?.Contains(coreType.ToString()) ?? true,
|
||||
IsCheckPreRelease = _config.CheckUpdateItem.CheckPreReleaseCoreTypes?.Contains(coreType.ToString()) ?? false,
|
||||
ShowCheckPreRelease = CoreInfoManager.Instance.GetCheckPreRelease(coreType, true),
|
||||
CoreType = coreType,
|
||||
IsGeoFile = false,
|
||||
Remarks = lastResult ?? ResUI.menuCheckUpdate,
|
||||
@@ -94,22 +94,14 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
||||
return new()
|
||||
{
|
||||
IsSelected = _config.CheckUpdateItem.SelectedCoreTypes?.Contains(_geo) ?? true,
|
||||
IsCheckPreRelease = false,
|
||||
ShowCheckPreRelease = false,
|
||||
CoreType = null,
|
||||
IsGeoFile = true,
|
||||
Remarks = ResUI.menuCheckUpdate,
|
||||
};
|
||||
}
|
||||
|
||||
private async Task OnCheckPreReleaseUpdateChanged()
|
||||
{
|
||||
if (_config.CheckUpdateItem.CheckPreReleaseUpdate == EnableCheckPreReleaseUpdate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_config.CheckUpdateItem.CheckPreReleaseUpdate = EnableCheckPreReleaseUpdate;
|
||||
await SaveSelectedCoreTypes();
|
||||
}
|
||||
|
||||
private async Task OnUpdateViaProxyChanged()
|
||||
{
|
||||
if (_config.CheckUpdateItem.UpdateViaProxy == EnableUpdateViaProxy)
|
||||
@@ -127,6 +119,11 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
||||
.Select(t => t.CoreTypeForStorage)
|
||||
.ToList();
|
||||
|
||||
_config.CheckUpdateItem.CheckPreReleaseCoreTypes =
|
||||
CheckUpdateModels.Where(t => t.IsCheckPreRelease == true)
|
||||
.Select(t => t.CoreTypeForStorage)
|
||||
.ToList();
|
||||
|
||||
await ConfigHandler.SaveConfig(_config);
|
||||
}
|
||||
|
||||
@@ -167,7 +164,7 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
||||
}
|
||||
|
||||
var updateService = new UpdateService(_config, async (success, msg) => await Task.CompletedTask);
|
||||
var result = await updateService.CheckHasUpdateOnly(item.CoreType.Value, EnableCheckPreReleaseUpdate, EnableUpdateViaProxy);
|
||||
var result = await updateService.CheckHasUpdateOnly(item.CoreType.Value, item.IsCheckPreRelease, EnableUpdateViaProxy);
|
||||
if (result.Success && result.Version != null)
|
||||
{
|
||||
await UpdateView(item.CoreType, string.Format(ResUI.MsgCheckUpdateHasNewVersion, item.CoreType, result.Version));
|
||||
@@ -213,15 +210,11 @@ public partial class CheckUpdateViewModel : MyReactiveObject
|
||||
await UpdateView(_v2rayN, ResUI.MsgNotSupport);
|
||||
continue;
|
||||
}
|
||||
await CheckUpdateN(EnableCheckPreReleaseUpdate);
|
||||
}
|
||||
else if (item.CoreType is ECoreType.Xray or ECoreType.sing_box)
|
||||
{
|
||||
await CheckUpdateCore(item, EnableCheckPreReleaseUpdate);
|
||||
await CheckUpdateN(item.IsCheckPreRelease);
|
||||
}
|
||||
else if (item.CoreType.HasValue)
|
||||
{
|
||||
await CheckUpdateCore(item, false);
|
||||
await CheckUpdateCore(item, item.IsCheckPreRelease);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,16 +35,6 @@
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left" />
|
||||
|
||||
<TextBlock
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
|
||||
<ToggleSwitch
|
||||
x:Name="togEnableCheckPreReleaseUpdate"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left" />
|
||||
|
||||
<Button
|
||||
x:Name="btnCheckOnly"
|
||||
Width="100"
|
||||
@@ -75,8 +65,8 @@
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Panel Width="500" VerticalAlignment="Center">
|
||||
<Grid ColumnDefinitions="1*,1*,3*" RowDefinitions="Auto">
|
||||
<Panel Width="680" VerticalAlignment="Center">
|
||||
<Grid ColumnDefinitions="1*,3*,1*,3*" RowDefinitions="Auto">
|
||||
<ToggleSwitch
|
||||
x:Name="togAutoRefresh"
|
||||
Grid.Column="0"
|
||||
@@ -84,13 +74,31 @@
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding IsSelected}" />
|
||||
<TextBlock
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
IsVisible="{Binding ShowCheckPreRelease}"
|
||||
Orientation="Horizontal">
|
||||
<ToggleSwitch
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
IsChecked="{Binding IsCheckPreRelease}"
|
||||
OffContent=""
|
||||
OnContent="" />
|
||||
<TextBlock
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding CoreTypeForStorage}" />
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
Grid.Column="3"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Remarks}"
|
||||
|
||||
@@ -10,7 +10,6 @@ public partial class CheckUpdateView : ReactiveUserControl<CheckUpdateViewModel>
|
||||
{
|
||||
this.OneWayBind(ViewModel, vm => vm.CheckUpdateModels, v => v.lstCheckUpdates.ItemsSource).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.EnableCheckPreReleaseUpdate, v => v.togEnableCheckPreReleaseUpdate.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.EnableUpdateViaProxy, v => v.togEnableUpdateViaProxy.IsChecked).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckOnlyCmd, v => v.btnCheckOnly).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateCmd, v => v.btnCheckUpdate).DisposeWith(disposables);
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
x:TypeArguments="vms:CheckUpdateViewModel"
|
||||
Style="{StaticResource ViewGlobal}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisConverter" />
|
||||
</UserControl.Resources>
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin8}"
|
||||
@@ -32,16 +34,6 @@
|
||||
Margin="{StaticResource Margin8}"
|
||||
HorizontalAlignment="Left" />
|
||||
|
||||
<TextBlock
|
||||
Margin="{StaticResource Margin8}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
|
||||
<ToggleButton
|
||||
x:Name="togEnableCheckPreReleaseUpdate"
|
||||
Margin="{StaticResource Margin8}"
|
||||
HorizontalAlignment="Left" />
|
||||
|
||||
<Button
|
||||
x:Name="btnCheckOnly"
|
||||
Width="100"
|
||||
@@ -71,7 +63,7 @@
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
Width="500"
|
||||
Width="660"
|
||||
Margin="{StaticResource Margin8}"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center">
|
||||
@@ -81,6 +73,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
@@ -91,12 +84,31 @@
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding IsSelected}" />
|
||||
<TextBlock
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource MarginLeftRight4}"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding ShowCheckPreRelease, Converter={StaticResource BoolToVisConverter}}">
|
||||
<ToggleButton
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
IsChecked="{Binding IsCheckPreRelease}" />
|
||||
<TextBlock
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ListItemTitle}"
|
||||
Text="{Binding CoreTypeForStorage}" />
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
Grid.Column="3"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ListItemSubTitle}"
|
||||
Text="{Binding Remarks}"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
|
||||
@@ -10,7 +10,6 @@ public partial class CheckUpdateView
|
||||
{
|
||||
this.OneWayBind(ViewModel, vm => vm.CheckUpdateModels, v => v.lstCheckUpdates.ItemsSource).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.EnableCheckPreReleaseUpdate, v => v.togEnableCheckPreReleaseUpdate.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.EnableUpdateViaProxy, v => v.togEnableUpdateViaProxy.IsChecked).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckOnlyCmd, v => v.btnCheckOnly).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateCmd, v => v.btnCheckUpdate).DisposeWith(disposables);
|
||||
|
||||
Reference in New Issue
Block a user