Skip to content

Commit

Permalink
When updating a subscription, only determine whether the alias alread…
Browse files Browse the repository at this point in the history
…y exists
  • Loading branch information
2dust committed Feb 9, 2024
1 parent ce94e0b commit 4a72e63
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 6 deletions.
3 changes: 2 additions & 1 deletion v2rayN/v2rayN/Handler/ConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,8 @@ private static int AddBatchServers(Config config, string clipboardData, string s
//exist sub items
if (isSub && !Utils.IsNullOrEmpty(subid))
{
var existItem = lstOriSub?.FirstOrDefault(t => t.isSub == isSub && CompareProfileItem(t, profileItem, true));
var existItem = lstOriSub?.FirstOrDefault(t => t.isSub == isSub
&& config.uiItem.enableUpdateSubOnlyRemarksExist ? t.remarks == profileItem.remarks : CompareProfileItem(t, profileItem, true));
if (existItem != null)
{
//Check for duplicate indexId
Expand Down
1 change: 1 addition & 0 deletions v2rayN/v2rayN/Mode/ConfigItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public class GUIItem
public class UIItem
{
public bool enableAutoAdjustMainLvColWidth { get; set; }
public bool enableUpdateSubOnlyRemarksExist { get; set; }
public double mainWidth { get; set; }
public double mainHeight { get; set; }
public double mainGirdHeight1 { get; set; }
Expand Down
9 changes: 9 additions & 0 deletions v2rayN/v2rayN/Resx/ResUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions v2rayN/v2rayN/Resx/ResUI.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1189,4 +1189,7 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>Speed Ping Test Url</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>Updating subscription, only determine remarks exists</value>
</data>
</root>
3 changes: 3 additions & 0 deletions v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1186,4 +1186,7 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>真连接测试地址</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>更新订阅时只判断别名已存在否</value>
</data>
</root>
3 changes: 3 additions & 0 deletions v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1159,4 +1159,7 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>真連接測試地址</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>更新订阅时只判断别名已存在否</value>
</data>
</root>
3 changes: 3 additions & 0 deletions v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class OptionSettingViewModel : ReactiveObject
[Reactive] public bool KeepOlderDedupl { get; set; }
[Reactive] public bool IgnoreGeoUpdateCore { get; set; }
[Reactive] public bool EnableAutoAdjustMainLvColWidth { get; set; }
[Reactive] public bool EnableUpdateSubOnlyRemarksExist { get; set; }
[Reactive] public bool EnableSecurityProtocolTls13 { get; set; }
[Reactive] public bool AutoHideStartup { get; set; }
[Reactive] public bool EnableCheckPreReleaseUpdate { get; set; }
Expand Down Expand Up @@ -150,6 +151,7 @@ public OptionSettingViewModel(Window view)
KeepOlderDedupl = _config.guiItem.keepOlderDedupl;
IgnoreGeoUpdateCore = _config.guiItem.ignoreGeoUpdateCore;
EnableAutoAdjustMainLvColWidth = _config.uiItem.enableAutoAdjustMainLvColWidth;
EnableUpdateSubOnlyRemarksExist = _config.uiItem.enableUpdateSubOnlyRemarksExist;
EnableSecurityProtocolTls13 = _config.guiItem.enableSecurityProtocolTls13;
AutoHideStartup = _config.uiItem.autoHideStartup;
EnableCheckPreReleaseUpdate = _config.guiItem.checkPreReleaseUpdate;
Expand Down Expand Up @@ -304,6 +306,7 @@ private void SaveSetting()
_config.guiItem.keepOlderDedupl = KeepOlderDedupl;
_config.guiItem.ignoreGeoUpdateCore = IgnoreGeoUpdateCore;
_config.uiItem.enableAutoAdjustMainLvColWidth = EnableAutoAdjustMainLvColWidth;
_config.uiItem.enableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
_config.guiItem.enableSecurityProtocolTls13 = EnableSecurityProtocolTls13;
_config.uiItem.autoHideStartup = AutoHideStartup;
_config.guiItem.autoUpdateInterval = autoUpdateInterval;
Expand Down
24 changes: 19 additions & 5 deletions v2rayN/v2rayN/Views/OptionSettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -526,42 +526,56 @@
HorizontalAlignment="Left" />

<TextBlock
Grid.Row="4"
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
<ToggleButton
x:Name="togKeepOlderDedupl"
Grid.Row="4"
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
HorizontalAlignment="Left" />

<TextBlock
Grid.Row="5"
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsIgnoreGeoUpdateCore}" />
<ToggleButton
x:Name="togIgnoreGeoUpdateCore"
Grid.Row="5"
Grid.Row="4"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
HorizontalAlignment="Left" />

<TextBlock
Grid.Row="6"
Grid.Row="5"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableAutoAdjustMainLvColWidth}" />
<ToggleButton
x:Name="togEnableAutoAdjustMainLvColWidth"
Grid.Row="5"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
HorizontalAlignment="Left" />

<TextBlock
Grid.Row="6"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableUpdateSubOnlyRemarksExist}" />
<ToggleButton
x:Name="togEnableUpdateSubOnlyRemarksExist"
Grid.Row="6"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
Expand Down
1 change: 1 addition & 0 deletions v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public OptionSettingWindow()
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.IgnoreGeoUpdateCore, v => v.togIgnoreGeoUpdateCore.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableCheckPreReleaseUpdate, v => v.togEnableCheckPreReleaseUpdate.IsChecked).DisposeWith(disposables);
Expand Down

0 comments on commit 4a72e63

Please sign in to comment.