From 77fbddf488ef03e64c2b3aa99a2981f0db2b42e3 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 27 Feb 2023 13:25:45 +0800 Subject: [PATCH] Improve subscription update without proxy --- v2rayN/v2rayN/Handler/DownloadHandle.cs | 4 +++- v2rayN/v2rayN/Handler/UpdateHandle.cs | 28 ++++++++++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/v2rayN/v2rayN/Handler/DownloadHandle.cs b/v2rayN/v2rayN/Handler/DownloadHandle.cs index 0c1e24e2..da4d85f7 100644 --- a/v2rayN/v2rayN/Handler/DownloadHandle.cs +++ b/v2rayN/v2rayN/Handler/DownloadHandle.cs @@ -188,9 +188,11 @@ namespace v2rayN.Handler try { Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); + var webProxy = GetWebProxy(blProxy); var client = new HttpClient(new SocketsHttpHandler() { - Proxy = GetWebProxy(blProxy) + Proxy = webProxy, + UseProxy = webProxy != null }); if (Utils.IsNullOrEmpty(userAgent)) diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs index 8075eef6..7914c2d3 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandle.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs @@ -164,14 +164,14 @@ namespace v2rayN.Handler Task.Run(async () => { //Turn off system proxy - bool bSysProxyType = false; - if (!blProxy && config.sysProxyType == ESysProxyType.ForcedChange) - { - bSysProxyType = true; - config.sysProxyType = ESysProxyType.ForcedClear; - SysProxyHandle.UpdateSysProxy(config, false); - Thread.Sleep(3000); - } + //bool bSysProxyType = false; + //if (!blProxy && config.sysProxyType == ESysProxyType.ForcedChange) + //{ + // bSysProxyType = true; + // config.sysProxyType = ESysProxyType.ForcedClear; + // SysProxyHandle.UpdateSysProxy(config, false); + // Thread.Sleep(3000); + //} foreach (var item in subItem) { @@ -235,12 +235,12 @@ namespace v2rayN.Handler } _updateFunc(false, "-------------------------------------------------------"); } - //restore system proxy - if (bSysProxyType) - { - config.sysProxyType = ESysProxyType.ForcedChange; - SysProxyHandle.UpdateSysProxy(config, false); - } + ////restore system proxy + //if (bSysProxyType) + //{ + // config.sysProxyType = ESysProxyType.ForcedChange; + // SysProxyHandle.UpdateSysProxy(config, false); + //} _updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}"); });