From aaa05eb5ec8bb7a683029e51dadfa38421563fa3 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 3 Oct 2019 17:37:10 +0900 Subject: [PATCH] Fix build --- BTCPayServer/Hosting/BTCPayServerServices.cs | 11 ----------- BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs | 2 -- .../Security/Bitpay/BitpayAuthenticationHandler.cs | 4 ++-- BTCPayServer/Services/LanguageService.cs | 6 +++++- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs index 3c095d466..0fafbc5b4 100644 --- a/BTCPayServer/Hosting/BTCPayServerServices.cs +++ b/BTCPayServer/Hosting/BTCPayServerServices.cs @@ -61,7 +61,6 @@ namespace BTCPayServer.Hosting public static IServiceCollection AddBTCPayServer(this IServiceCollection services, IConfiguration configuration) { #if NETCOREAPP21 - services.AddSingleton, MVCConfigureOptions>(); services.AddSingleton(); #else services.AddSingleton(o => o.GetRequiredService>().Value); @@ -334,14 +333,4 @@ namespace BTCPayServer.Hosting return app; } } - -#if NETCOREAPP21 - class MVCConfigureOptions : IConfigureOptions - { - public void Configure(MvcJsonOptions options) - { - new NBXplorer.Serializer(null).ConfigureSerializer(options.SerializerSettings); - } - } -#endif } diff --git a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs index be3e08437..c1efc9d47 100644 --- a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs +++ b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs @@ -21,8 +21,6 @@ using BTCPayServer.HostedServices; #if NETCOREAPP21 using IHostApplicationLifetime = Microsoft.AspNetCore.Hosting.IApplicationLifetime; -#else -using Microsoft.AspNetCore.Hosting; #endif namespace BTCPayServer.Payments.Bitcoin diff --git a/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs b/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs index 6c0dbd1d1..694e6a39f 100644 --- a/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs +++ b/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs @@ -18,7 +18,7 @@ using NBitpayClient; using NBitpayClient.Extensions; using Newtonsoft.Json.Linq; using BTCPayServer.Logging; -using Microsoft.AspNetCore.Http.Internal; + using Microsoft.AspNetCore.Authentication; using System.Text.Encodings.Web; 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 claims) { - httpContext.Request.EnableRewind(); + httpContext.Request.EnableBuffering(); string storeId = null; string body = string.Empty; diff --git a/BTCPayServer/Services/LanguageService.cs b/BTCPayServer/Services/LanguageService.cs index 37af2b607..9ca153cae 100644 --- a/BTCPayServer/Services/LanguageService.cs +++ b/BTCPayServer/Services/LanguageService.cs @@ -1,13 +1,13 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.AspNetCore.Hosting.Internal; using Microsoft.Extensions.Hosting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; #if NETCOREAPP21 using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; +using Microsoft.AspNetCore.Hosting.Internal; #else using Microsoft.AspNetCore.Hosting; #endif @@ -34,7 +34,11 @@ namespace BTCPayServer.Services public LanguageService(IWebHostEnvironment environment) { +#if NETCOREAPP21 var path = (environment as HostingEnvironment)?.WebRootPath; +#else + var path = environment.WebRootPath; +#endif if (string.IsNullOrEmpty(path)) { //test environment