Improve subscription update without proxy

pull/3374/head
2dust 2023-02-27 13:25:45 +08:00
parent bf396f8802
commit 77fbddf488
2 changed files with 17 additions and 15 deletions

View File

@ -188,9 +188,11 @@ namespace v2rayN.Handler
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().guiItem.enableSecurityProtocolTls13);
var webProxy = GetWebProxy(blProxy);
var client = new HttpClient(new SocketsHttpHandler() var client = new HttpClient(new SocketsHttpHandler()
{ {
Proxy = GetWebProxy(blProxy) Proxy = webProxy,
UseProxy = webProxy != null
}); });
if (Utils.IsNullOrEmpty(userAgent)) if (Utils.IsNullOrEmpty(userAgent))

View File

@ -164,14 +164,14 @@ namespace v2rayN.Handler
Task.Run(async () => Task.Run(async () =>
{ {
//Turn off system proxy //Turn off system proxy
bool bSysProxyType = false; //bool bSysProxyType = false;
if (!blProxy && config.sysProxyType == ESysProxyType.ForcedChange) //if (!blProxy && config.sysProxyType == ESysProxyType.ForcedChange)
{ //{
bSysProxyType = true; // bSysProxyType = true;
config.sysProxyType = ESysProxyType.ForcedClear; // config.sysProxyType = ESysProxyType.ForcedClear;
SysProxyHandle.UpdateSysProxy(config, false); // SysProxyHandle.UpdateSysProxy(config, false);
Thread.Sleep(3000); // Thread.Sleep(3000);
} //}
foreach (var item in subItem) foreach (var item in subItem)
{ {
@ -235,12 +235,12 @@ namespace v2rayN.Handler
} }
_updateFunc(false, "-------------------------------------------------------"); _updateFunc(false, "-------------------------------------------------------");
} }
//restore system proxy ////restore system proxy
if (bSysProxyType) //if (bSysProxyType)
{ //{
config.sysProxyType = ESysProxyType.ForcedChange; // config.sysProxyType = ESysProxyType.ForcedChange;
SysProxyHandle.UpdateSysProxy(config, false); // SysProxyHandle.UpdateSysProxy(config, false);
} //}
_updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}"); _updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
}); });