Revert "feat: 增加json请求超时限制" (#4071)

Reverts MaaAssistantArknights/MaaAssistantArknights#4065
This commit is contained in:
DavidWang19
2023-03-25 21:23:00 +08:00
committed by GitHub
2 changed files with 8 additions and 9 deletions

View File

@@ -27,8 +27,6 @@ namespace MaaWpfGui.Helper
{
public const string RequestUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.76";
private const int TimeoutMs = 3000;
private static string s_proxy = Config.Get(Config.UpdateProxy, string.Empty);
public static string Proxy
@@ -37,18 +35,12 @@ namespace MaaWpfGui.Helper
{
s_proxy = value;
NormalClient = BuildNormalClient();
NormalClient.Timeout = TimeSpan.FromMilliseconds(TimeoutMs);
}
}
#nullable enable
public static HttpClient NormalClient { get; private set; } = BuildNormalClient();
static WebService()
{
NormalClient.Timeout = TimeSpan.FromMilliseconds(TimeoutMs);
}
private static HttpClient BuildNormalClient() => new HttpClient(new HttpClientHandler()
{
Proxy = string.IsNullOrWhiteSpace(s_proxy) ? null : new WebProxy(s_proxy),

View File

@@ -148,7 +148,13 @@ namespace MaaWpfGui
get => _filename;
set
{
SetAndNotify(ref _filename, value);
if (value == _filename)
{
return;
}
_filename = value;
NotifyOfPropertyChange(() => Filename);
ClearLog();
UpdateFilename();
}
@@ -218,6 +224,7 @@ namespace MaaWpfGui
{
ParseJsonAndShowInfo(jsonStr);
}
}
private async Task<string> RequestCopilotServer(int copilotID)