mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Fix proxy for github update
This commit is contained in:
@@ -16,10 +16,14 @@ namespace Wox.Core
|
|||||||
[Conditional("RELEASE")]
|
[Conditional("RELEASE")]
|
||||||
public static async void UpdateApp()
|
public static async void UpdateApp()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var client = new WebClient {Proxy = HttpRequest.WebProxy(HttpProxy.Instance)};
|
||||||
|
var downloader = new FileDownloader(client);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// todo 5/9 the return value of UpdateApp() is NULL, fucking useless!
|
// todo 5/9 the return value of UpdateApp() is NULL, fucking useless!
|
||||||
using (var updater= await UpdateManager.GitHubUpdateManager(Infrastructure.Wox.Github))
|
using (var updater= await UpdateManager.GitHubUpdateManager(Infrastructure.Wox.Github, urlDownloader:downloader))
|
||||||
{
|
{
|
||||||
await updater.UpdateApp();
|
await updater.UpdateApp();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Wox.Infrastructure.Http
|
|||||||
{
|
{
|
||||||
public static class HttpRequest
|
public static class HttpRequest
|
||||||
{
|
{
|
||||||
private static WebProxy GetWebProxy(IHttpProxy proxy)
|
public static WebProxy WebProxy(IHttpProxy proxy)
|
||||||
{
|
{
|
||||||
if (proxy != null && proxy.Enabled && !string.IsNullOrEmpty(proxy.Server))
|
if (proxy != null && proxy.Enabled && !string.IsNullOrEmpty(proxy.Server))
|
||||||
{
|
{
|
||||||
@@ -43,7 +43,7 @@ namespace Wox.Infrastructure.Http
|
|||||||
HttpWebRequest request = WebRequest.CreateHttp(url);
|
HttpWebRequest request = WebRequest.CreateHttp(url);
|
||||||
request.Method = "GET";
|
request.Method = "GET";
|
||||||
request.Timeout = 10 * 1000;
|
request.Timeout = 10 * 1000;
|
||||||
request.Proxy = GetWebProxy(proxy);
|
request.Proxy = WebProxy(proxy);
|
||||||
request.UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko";
|
request.UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko";
|
||||||
HttpWebResponse response;
|
HttpWebResponse response;
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user