diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 8bd6892d..b30d9ba2 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -889,7 +889,7 @@ namespace v2rayN.Handler return 0; } - private static bool CompareProfileItem(ProfileItem o, ProfileItem n, bool remarks) + public static bool CompareProfileItem(ProfileItem o, ProfileItem n, bool remarks) { if (o == null || n == null) { @@ -909,6 +909,12 @@ namespace v2rayN.Handler && (o.configType == EConfigType.Trojan || o.streamSecurity == n.streamSecurity) && o.flow == n.flow && o.sni == n.sni + && o.alpn == n.alpn + && o.allowInsecure == n.allowInsecure + && o.fingerprint == n.fingerprint + && o.publicKey == n.publicKey + && o.shortId == n.shortId + && o.spiderX == n.spiderX && (!remarks || o.remarks == n.remarks); } diff --git a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs index 84204192..2a6b1a23 100644 --- a/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/MainWindowViewModel.cs @@ -765,7 +765,23 @@ namespace v2rayN.ViewModels _subId = SelectedSub?.id; _config.subIndexId = _subId; - RefreshServers(); + // RefreshServers(); + + // 读取节点列表 lstModel + List lstModel = LoadProfilelist(); + + // lstModel 节点去重 不修改底层保存的节点数据 + List lstKeep = new(); + foreach (ProfileItemModel item in lstModel) + { + if (!lstKeep.Exists(i => ConfigHandler.CompareProfileItem(i, item, false))) + { + lstKeep.Add(item); + } + } + + // 向界面显示节点列表 lstModel + DisplayProfilelist(lstKeep); _updateView(EViewAction.ProfilesFocus); } @@ -784,9 +800,21 @@ namespace v2rayN.ViewModels } public void RefreshServers() + { + List lstModel = LoadProfilelist(); + + DisplayProfilelist(lstModel); + } + + private List LoadProfilelist() { List lstModel = LazyConfig.Instance.ProfileItems(_subId, _serverFilter); + return lstModel; + } + + private void DisplayProfilelist(List lstModel) + { ConfigHandler.SetDefaultServer(_config, lstModel); List lstServerStat = new();