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
{
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))

View File

@ -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}");
});