Skip to content

Commit

Permalink
Optimizing Subscription Update
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Mar 22, 2023
1 parent ad7914f commit 18d6e93
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
4 changes: 3 additions & 1 deletion clashN/clashN/Handler/DownloadHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ public void DownloadFileAsync(string url, bool blProxy, int downloadTimeout)
try
{
Utils.SetSecurityProtocol(LazyConfig.Instance.Config.EnableSecurityProtocolTls13);
var webProxy = GetWebProxy(blProxy);
var client = new HttpClient(new SocketsHttpHandler()
{
Proxy = GetWebProxy(blProxy)
Proxy = webProxy,
UseProxy = webProxy != null
});

if (string.IsNullOrEmpty(userAgent))
Expand Down
26 changes: 13 additions & 13 deletions clashN/clashN/Handler/UpdateHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ public void UpdateSubscriptionProcess(Config config, bool blProxy, List<ProfileI
Task.Run(async () =>
{
//Turn off system proxy
bool bSysProxyType = false;
if (!blProxy && config.SysProxyType == SysProxyType.ForcedChange)
{
bSysProxyType = true;
config.SysProxyType = SysProxyType.ForcedClear;
SysProxyHandle.UpdateSysProxy(config, false);
Thread.Sleep(3000);
}
//bool bSysProxyType = false;
//if (!blProxy && config.SysProxyType == SysProxyType.ForcedChange)
//{
// bSysProxyType = true;
// config.SysProxyType = SysProxyType.ForcedClear;
// SysProxyHandle.UpdateSysProxy(config, false);
// Thread.Sleep(3000);
//}

if (profileItems == null)
{
Expand Down Expand Up @@ -280,11 +280,11 @@ public void UpdateSubscriptionProcess(Config config, bool blProxy, List<ProfileI

}
//restore system proxy
if (bSysProxyType)
{
config.SysProxyType = SysProxyType.ForcedChange;
SysProxyHandle.UpdateSysProxy(config, false);
}
//if (bSysProxyType)
//{
// config.SysProxyType = SysProxyType.ForcedChange;
// SysProxyHandle.UpdateSysProxy(config, false);
//}
_updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
});
}
Expand Down
4 changes: 2 additions & 2 deletions clashN/clashN/clashN.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@


<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="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NHotkey" Version="2.1.0" />
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" />
<PackageReference Include="QRCoder.Xaml" Version="1.4.3" />
<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="ReactiveUI.Fody" Version="18.3.1" />
<PackageReference Include="ReactiveUI.Validation" Version="3.0.1" />
Expand Down

0 comments on commit 18d6e93

Please sign in to comment.