Optimizing Subscription Update

This commit is contained in:
2dust
2023-03-22 13:59:55 +08:00
parent ad7914f5c2
commit 18d6e93907
3 changed files with 18 additions and 16 deletions

View File

@@ -75,9 +75,11 @@ namespace ClashN.Handler
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.Config.EnableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.Config.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 (string.IsNullOrEmpty(userAgent)) if (string.IsNullOrEmpty(userAgent))

View File

@@ -173,14 +173,14 @@ namespace ClashN.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 == SysProxyType.ForcedChange) //if (!blProxy && config.SysProxyType == SysProxyType.ForcedChange)
{ //{
bSysProxyType = true; // bSysProxyType = true;
config.SysProxyType = SysProxyType.ForcedClear; // config.SysProxyType = SysProxyType.ForcedClear;
SysProxyHandle.UpdateSysProxy(config, false); // SysProxyHandle.UpdateSysProxy(config, false);
Thread.Sleep(3000); // Thread.Sleep(3000);
} //}
if (profileItems == null) if (profileItems == null)
{ {
@@ -280,11 +280,11 @@ namespace ClashN.Handler
} }
//restore system proxy //restore system proxy
if (bSysProxyType) //if (bSysProxyType)
{ //{
config.SysProxyType = SysProxyType.ForcedChange; // config.SysProxyType = SysProxyType.ForcedChange;
SysProxyHandle.UpdateSysProxy(config, false); // SysProxyHandle.UpdateSysProxy(config, false);
} //}
_updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}"); _updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
}); });
} }

View File

@@ -14,14 +14,14 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" /> <PackageReference Include="MaterialDesignThemes" Version="4.7.1" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" /> <PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NHotkey" Version="2.1.0" /> <PackageReference Include="NHotkey" Version="2.1.0" />
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" /> <PackageReference Include="NHotkey.Wpf" Version="2.1.0" />
<PackageReference Include="QRCoder.Xaml" Version="1.4.3" /> <PackageReference Include="QRCoder.Xaml" Version="1.4.3" />
<PackageReference Include="TaskScheduler" Version="2.10.1" /> <PackageReference Include="TaskScheduler" Version="2.10.1" />
<PackageReference Include="YamlDotNet" Version="13.0.1" /> <PackageReference Include="YamlDotNet" Version="13.0.2" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" /> <PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
<PackageReference Include="ReactiveUI.Fody" Version="18.3.1" /> <PackageReference Include="ReactiveUI.Fody" Version="18.3.1" />
<PackageReference Include="ReactiveUI.Validation" Version="3.0.1" /> <PackageReference Include="ReactiveUI.Validation" Version="3.0.1" />