feature: option page - set proxy

This commit is contained in:
2020-05-09 22:32:02 +08:00
parent f42705d1d2
commit bdee786f3a
12 changed files with 266 additions and 10 deletions

View File

@@ -439,12 +439,16 @@ namespace Pixiview.Utils
{
App.DebugPrint($"GET: {url}");
var uri = new Uri(url);
var proxy = Configs.Proxy;
var handler = new HttpClientHandler
{
Proxy = Configs.Proxy,
UseProxy = true,
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
};
if (proxy != null)
{
handler.Proxy = proxy;
handler.UseProxy = true;
}
var client = new HttpClient(handler)
{
BaseAddress = new Uri($"{uri.Scheme}://{uri.Host}")
@@ -468,7 +472,11 @@ namespace Pixiview.Utils
public static class Configs
{
public static readonly WebProxy Proxy = new WebProxy("router.tsanie.us", 8088);
public const string IsProxiedKey = "isProxied";
public const string HostKey = "host";
public const string PortKey = "port";
public static WebProxy Proxy;
public const int MaxThreads = 3;
public const string Referer = "https://www.pixiv.net/";