When updating a subscription, only determine whether the alias already exists

pull/4711/head
2dust 2024-02-09 09:57:28 +08:00
parent ce94e0ba4d
commit 4a72e63d1c
9 changed files with 44 additions and 6 deletions

View File

@ -1098,7 +1098,8 @@ namespace v2rayN.Handler
//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

View File

@ -109,6 +109,7 @@ namespace v2rayN.Mode
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; }

View File

@ -2635,6 +2635,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Updating subscription, only determine remarks exists 的本地化字符串。
/// </summary>
public static string TbSettingsEnableUpdateSubOnlyRemarksExist {
get {
return ResourceManager.GetString("TbSettingsEnableUpdateSubOnlyRemarksExist", resourceCulture);
}
}
/// <summary>
/// 查找类似 Exception 的本地化字符串。
/// </summary>

View File

@ -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>

View File

@ -1186,4 +1186,7 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>真连接测试地址</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>更新订阅时只判断别名已存在否</value>
</data>
</root>

View File

@ -1159,4 +1159,7 @@
<data name="TbSettingsSpeedPingTestUrl" xml:space="preserve">
<value>真連接測試地址</value>
</data>
<data name="TbSettingsEnableUpdateSubOnlyRemarksExist" xml:space="preserve">
<value>更新订阅时只判断别名已存在否</value>
</data>
</root>

View File

@ -56,6 +56,7 @@ namespace v2rayN.ViewModels
[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; }
@ -150,6 +151,7 @@ namespace v2rayN.ViewModels
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;
@ -304,6 +306,7 @@ namespace v2rayN.ViewModels
_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;

View File

@ -526,7 +526,7 @@
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="4"
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
@ -534,6 +534,20 @@
Text="{x:Static resx:ResUI.TbSettingsKeepOlderDedupl}" />
<ToggleButton
x:Name="togKeepOlderDedupl"
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
HorizontalAlignment="Left" />
<TextBlock
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="4"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
@ -545,9 +559,9 @@
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsIgnoreGeoUpdateCore}" />
Text="{x:Static resx:ResUI.TbSettingsEnableAutoAdjustMainLvColWidth}" />
<ToggleButton
x:Name="togIgnoreGeoUpdateCore"
x:Name="togEnableAutoAdjustMainLvColWidth"
Grid.Row="5"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
@ -559,9 +573,9 @@
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableAutoAdjustMainLvColWidth}" />
Text="{x:Static resx:ResUI.TbSettingsEnableUpdateSubOnlyRemarksExist}" />
<ToggleButton
x:Name="togEnableAutoAdjustMainLvColWidth"
x:Name="togEnableUpdateSubOnlyRemarksExist"
Grid.Row="6"
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"

View File

@ -170,6 +170,7 @@ namespace v2rayN.Views
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);