diff --git a/Danmu.sln.DotSettings.user b/Danmu.sln.DotSettings.user
index f4083dc..8cf72f2 100644
--- a/Danmu.sln.DotSettings.user
+++ b/Danmu.sln.DotSettings.user
@@ -19,6 +19,7 @@
<Assembly Path="C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.15\System.Private.CoreLib.dll" />
<Assembly Path="C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.2\System.Net.Http.dll" />
<Assembly Path="C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.2\System.Private.CoreLib.dll" />
+ <Assembly Path="C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.3\Microsoft.Extensions.Http.dll" />
</AssemblyExplorer>
True
True
diff --git a/Danmu/Danmu.csproj b/Danmu/Danmu.csproj
index 144f58b..0aa375d 100644
--- a/Danmu/Danmu.csproj
+++ b/Danmu/Danmu.csproj
@@ -56,6 +56,8 @@
-
+
+ Never
+
diff --git a/Danmu/Properties/PublishProfiles/FolderProfile.pubxml b/Danmu/Properties/PublishProfiles/FolderProfile.pubxml
index 8644030..aacdd1c 100644
--- a/Danmu/Properties/PublishProfiles/FolderProfile.pubxml
+++ b/Danmu/Properties/PublishProfiles/FolderProfile.pubxml
@@ -14,11 +14,10 @@
False
netcoreapp3.1
b9c588d4-1f1b-47c6-8dfd-8434978890a7
- true
+ false
bin\Release-Win\netcoreapp3.1\publish\
- False
+ True
win-x64
- True
- True
+ False
\ No newline at end of file
diff --git a/Danmu/Startup.cs b/Danmu/Startup.cs
index a5ae86e..e9fc8df 100644
--- a/Danmu/Startup.cs
+++ b/Danmu/Startup.cs
@@ -56,6 +56,7 @@ public void ConfigureServices(IServiceCollection services)
//Http请求
+ services.AddHttpClient();
services.AddHttpClient(Gzip).ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler
{AutomaticDecompression = DecompressionMethods.GZip});
services.AddHttpClient(Deflate).ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler
@@ -151,7 +152,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
#if DEBUG
spa.Options.SourcePath = "ClientApp";
- spa.UseVueCli("serve",18081);
+ spa.UseVueCli("serve", 18081);
#endif
});
}
diff --git a/Danmu/TrimmerRoots.xml b/Danmu/TrimmerRoots.xml
deleted file mode 100644
index 4931e4e..0000000
--- a/Danmu/TrimmerRoots.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Danmu/Utils/BiliBili/BiliBiliHelp.Http.cs b/Danmu/Utils/BiliBili/BiliBiliHelp.Http.cs
index 960b74f..4c20f8b 100644
--- a/Danmu/Utils/BiliBili/BiliBiliHelp.Http.cs
+++ b/Danmu/Utils/BiliBili/BiliBiliHelp.Http.cs
@@ -1,4 +1,5 @@
using System;
+using System.Net.Http;
using System.Threading.Tasks;
using Danmu.Utils.Common;
using static Danmu.Utils.Global.VariableDictionary;
@@ -17,8 +18,8 @@ private async Task GetBiliBiliPageRawAsync(string url)
var key = Md5.GetMd5(url);
return await _cache.GetOrCreateHttpCacheAsync(key, TimeSpan.FromMinutes(_setting.CidCacheTime), async () =>
{
- var httpClient = _httpClientFactory.CreateClient(Deflate);
- var response = await httpClient.GetAsync(url);
+ var client = _httpClientFactory.CreateClient(Deflate);
+ var response = await client.GetAsync(url);
if (response.IsSuccessStatusCode) return await response.Content.ReadAsByteArrayAsync();
return new byte[0];
});
@@ -35,10 +36,11 @@ private async Task GetDanmuRawAsync(string url, bool useCookie = false)
var key = Md5.GetMd5(url);
return await _cache.GetOrCreateHttpCacheAsync(key, TimeSpan.FromMinutes(_setting.DanmuCacheTime), async () =>
{
- var deflateClient = _httpClientFactory.CreateClient(Deflate);
+ var request = new HttpRequestMessage(HttpMethod.Get, url);
if (useCookie && !string.IsNullOrEmpty(_setting.Cookie))
- deflateClient.DefaultRequestHeaders.Add("Cookie", _setting.Cookie);
- var response = await deflateClient.GetAsync(url);
+ request.Headers.Add("Cookie", _setting.Cookie);
+ var client = _httpClientFactory.CreateClient(Deflate);
+ var response = await client.SendAsync(request);
if (response.IsSuccessStatusCode) return await response.Content.ReadAsByteArrayAsync();
return new byte[0];
});
diff --git a/Danmu/Utils/BiliBili/BiliBiliHelp.cs b/Danmu/Utils/BiliBili/BiliBiliHelp.cs
index 4a9767e..d3e5fa6 100644
--- a/Danmu/Utils/BiliBili/BiliBiliHelp.cs
+++ b/Danmu/Utils/BiliBili/BiliBiliHelp.cs
@@ -17,10 +17,10 @@ public partial class BiliBiliHelp
private readonly IHttpClientFactory _httpClientFactory;
private readonly BiliBiliSetting _setting;
- public BiliBiliHelp(AppConfiguration appConfiguration, IHttpClientFactory httpClientFactory,
+ public BiliBiliHelp(AppConfiguration appConfiguration, IHttpClientFactory clientFactory,
CacheDao biliBiliCache)
{
- _httpClientFactory = httpClientFactory;
+ _httpClientFactory = clientFactory;
_setting = appConfiguration.GetAppSetting().BiliBiliSetting;
_canGetHistory = !string.IsNullOrEmpty(_setting.Cookie);
_cache = biliBiliCache;
diff --git a/Danmu/runtimeconfig.template.json b/Danmu/runtimeconfig.template.json
new file mode 100644
index 0000000..646313b
--- /dev/null
+++ b/Danmu/runtimeconfig.template.json
@@ -0,0 +1,5 @@
+{
+ "configProperties": {
+ "System.Net.Http.SocketsHttpHandler.Http2Support": true
+ }
+}
\ No newline at end of file