Fix build

This commit is contained in:
nicolas.dorier 2019-10-03 17:37:10 +09:00
parent 8d0d80e086
commit aaa05eb5ec
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
4 changed files with 7 additions and 16 deletions

View File

@ -61,7 +61,6 @@ namespace BTCPayServer.Hosting
public static IServiceCollection AddBTCPayServer(this IServiceCollection services, IConfiguration configuration) public static IServiceCollection AddBTCPayServer(this IServiceCollection services, IConfiguration configuration)
{ {
#if NETCOREAPP21 #if NETCOREAPP21
services.AddSingleton<IConfigureOptions<MvcJsonOptions>, MVCConfigureOptions>();
services.AddSingleton<MvcNewtonsoftJsonOptions>(); services.AddSingleton<MvcNewtonsoftJsonOptions>();
#else #else
services.AddSingleton<MvcNewtonsoftJsonOptions>(o => o.GetRequiredService<IOptions<MvcNewtonsoftJsonOptions>>().Value); services.AddSingleton<MvcNewtonsoftJsonOptions>(o => o.GetRequiredService<IOptions<MvcNewtonsoftJsonOptions>>().Value);
@ -334,14 +333,4 @@ namespace BTCPayServer.Hosting
return app; return app;
} }
} }
#if NETCOREAPP21
class MVCConfigureOptions : IConfigureOptions<MvcJsonOptions>
{
public void Configure(MvcJsonOptions options)
{
new NBXplorer.Serializer(null).ConfigureSerializer(options.SerializerSettings);
}
}
#endif
} }

View File

@ -21,8 +21,6 @@ using BTCPayServer.HostedServices;
#if NETCOREAPP21 #if NETCOREAPP21
using IHostApplicationLifetime = Microsoft.AspNetCore.Hosting.IApplicationLifetime; using IHostApplicationLifetime = Microsoft.AspNetCore.Hosting.IApplicationLifetime;
#else
using Microsoft.AspNetCore.Hosting;
#endif #endif
namespace BTCPayServer.Payments.Bitcoin namespace BTCPayServer.Payments.Bitcoin

View File

@ -18,7 +18,7 @@ using NBitpayClient;
using NBitpayClient.Extensions; using NBitpayClient.Extensions;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using BTCPayServer.Logging; using BTCPayServer.Logging;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using BTCPayServer.Data; using BTCPayServer.Data;
@ -95,7 +95,7 @@ namespace BTCPayServer.Security.Bitpay
private async Task<(string StoreId, bool SuccessAuth)> CheckBitId(HttpContext httpContext, string sig, string id, List<Claim> claims) private async Task<(string StoreId, bool SuccessAuth)> CheckBitId(HttpContext httpContext, string sig, string id, List<Claim> claims)
{ {
httpContext.Request.EnableRewind(); httpContext.Request.EnableBuffering();
string storeId = null; string storeId = null;
string body = string.Empty; string body = string.Empty;

View File

@ -1,13 +1,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Hosting.Internal;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
#if NETCOREAPP21 #if NETCOREAPP21
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
using Microsoft.AspNetCore.Hosting.Internal;
#else #else
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
#endif #endif
@ -34,7 +34,11 @@ namespace BTCPayServer.Services
public LanguageService(IWebHostEnvironment environment) public LanguageService(IWebHostEnvironment environment)
{ {
#if NETCOREAPP21
var path = (environment as HostingEnvironment)?.WebRootPath; var path = (environment as HostingEnvironment)?.WebRootPath;
#else
var path = environment.WebRootPath;
#endif
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
{ {
//test environment //test environment