From f1023e08e10a0114dbdeca5afc891e337a95dc9a Mon Sep 17 00:00:00 2001 From: DHR60 <192860629+DHR60@users.noreply.github.com> Date: Tue, 13 Oct 2026 12:36:41 +0000 Subject: [PATCH] Fix (#10344) * chore. update core urls * Fix clash delay --- v2rayN/ServiceLib/Global.cs | 6 ++-- .../ViewModels/ClashProxiesViewModel.cs | 32 +++++++++++++++---- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index 4f9154ab..eaedc701 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -656,10 +656,10 @@ public class Global { ECoreType.Xray, "XTLS/Xray-core" }, { ECoreType.sing_box, "SagerNet/sing-box" }, { ECoreType.mihomo, "MetaCubeX/mihomo" }, - { ECoreType.hysteria, "apernet/hysteria" }, - { ECoreType.hysteria2, "apernet/hysteria" }, + { ECoreType.hysteria, "HyNetworks/hysteria" }, + { ECoreType.hysteria2, "HyNetworks/hysteria" }, { ECoreType.naiveproxy, "klzgrad/naiveproxy" }, - { ECoreType.tuic, "EAimTY/tuic" }, + { ECoreType.tuic, "tuic-protocol/tuic" }, { ECoreType.juicity, "juicity/juicity" }, { ECoreType.brook, "txthinking/brook" }, { ECoreType.overtls, "ShadowsocksR-Live/overtls" }, diff --git a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs index d3e192c9..7d61dc50 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs @@ -2,7 +2,7 @@ namespace ServiceLib.ViewModels; public partial class ClashProxiesViewModel : MyReactiveObject { - private readonly int _delayTimeout = 99999999; + private const int _delayTimeout = 99999999; private ClashItem _clashItem = new(); public ClashProxiesViewModel() @@ -235,6 +235,11 @@ public partial class ClashProxiesViewModel : MyReactiveObject { return; } + var dicCurrentDetails = new Dictionary(); + foreach (var item in ProxyDetails) + { + dicCurrentDetails.TryAdd(item.Name, item); + } var lstDetails = new List(); foreach (var item in proxy.all) { @@ -243,15 +248,29 @@ public partial class ClashProxiesViewModel : MyReactiveObject { continue; } - var delay = proxy2.history?.Count > 0 ? proxy2.history.Last().delay : -1; + var delay = -1; + var hasData = false; + + if (proxy2.history is { Count: > 0 }) + { + delay = proxy2.history.Last().delay; + hasData = true; + } + else if (dicCurrentDetails.TryGetValue(item, out var detail)) + { + delay = detail.Delay; + hasData = true; + } + + var isValidDelay = delay is > 0 and not _delayTimeout; lstDetails.Add(new ClashProxyModel { IsActive = item == proxy.now, Name = item, Type = proxy2.type, - Delay = delay <= 0 ? _delayTimeout : delay, - DelayName = delay <= 0 ? string.Empty : $"{delay}ms", + Delay = isValidDelay ? delay : _delayTimeout, + DelayName = !hasData ? string.Empty : (isValidDelay ? $"{delay}ms" : "-1"), }); } // sort @@ -362,8 +381,9 @@ public partial class ClashProxiesViewModel : MyReactiveObject { return; } - detail.Delay = Convert.ToInt32(result.Delay); - detail.DelayName = $"{detail.Delay}ms"; + var isValid = int.TryParse(result.Delay, out var delay) && delay > 0 && delay != _delayTimeout; + detail.Delay = isValid ? delay : _delayTimeout; + detail.DelayName = isValid ? $"{delay}ms" : "-1"; await Task.CompletedTask; }