From 7147dadb2a48241e8f55613af3ec7deefbaf371e Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Tue, 19 Jan 2021 17:19:10 +0900 Subject: [PATCH] Remove dependency to DBriize --- BTCPayServer.Tests/StorageTests.cs | 8 +++---- BTCPayServer.Tests/UnitTest1.cs | 22 +++++-------------- BTCPayServer/BTCPayServer.csproj | 1 - .../Controllers/InvoiceController.UI.cs | 1 - BTCPayServer/Hosting/MigrationStartupTask.cs | 2 -- .../Services/Shopify/ShopifyApiClient.cs | 3 +-- 6 files changed, 10 insertions(+), 27 deletions(-) diff --git a/BTCPayServer.Tests/StorageTests.cs b/BTCPayServer.Tests/StorageTests.cs index 7b70655ec..d7ed784ef 100644 --- a/BTCPayServer.Tests/StorageTests.cs +++ b/BTCPayServer.Tests/StorageTests.cs @@ -10,7 +10,6 @@ using BTCPayServer.Storage.Services.Providers.AzureBlobStorage.Configuration; using BTCPayServer.Storage.Services.Providers.FileSystemStorage.Configuration; using BTCPayServer.Storage.ViewModels; using BTCPayServer.Tests.Logging; -using DBriize.Utils; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Xunit; @@ -212,10 +211,9 @@ namespace BTCPayServer.Tests Assert.NotNull(statusMessageModel); Assert.Equal(StatusMessageModel.StatusSeverity.Success, statusMessageModel.Severity); var index = statusMessageModel.Html.IndexOf("target='_blank'>"); - var url = statusMessageModel.Html.Substring(index).ReplaceMultiple(new Dictionary() - { - {"", string.Empty}, {"target='_blank'>", string.Empty} - }); + var url = statusMessageModel.Html.Substring(index) + .Replace("", string.Empty) + .Replace("target='_blank'>", string.Empty); //verify tmpfile is available and the same data = await net.DownloadStringTaskAsync(new Uri(url)); Assert.Equal(fileContent, data); diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 7fed2f47e..66d9cfb60 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -43,7 +43,6 @@ using BTCPayServer.Services.Rates; using BTCPayServer.Tests.Logging; using BTCPayServer.U2F.Models; using BTCPayServer.Validation; -using DBriize.Utils; using ExchangeSharp; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -263,21 +262,12 @@ namespace BTCPayServer.Tests ManageController.AddApiKeyViewModel.PermissionValueItem.PermissionDescriptions.Where(pair => !Policies.IsStorePolicy(pair.Key) && !Policies.IsServerPolicy(pair.Key)); - description = description.ReplaceMultiple(new Dictionary() - { - { - "#OTHERPERMISSIONS#", - string.Join("\n", otherPolicies.Select(pair => $"* `{pair.Key}`: {pair.Value.Title}")) - }, - { - "#SERVERPERMISSIONS#", - string.Join("\n", serverPolicies.Select(pair => $"* `{pair.Key}`: {pair.Value.Title}")) - }, - { - "#STOREPERMISSIONS#", - string.Join("\n", storePolicies.Select(pair => $"* `{pair.Key}`: {pair.Value.Title}")) - } - }); + description = description.Replace("#OTHERPERMISSIONS#", + string.Join("\n", otherPolicies.Select(pair => $"* `{pair.Key}`: {pair.Value.Title}"))) + .Replace("#SERVERPERMISSIONS#", + string.Join("\n", serverPolicies.Select(pair => $"* `{pair.Key}`: {pair.Value.Title}"))) + .Replace("#STOREPERMISSIONS#", + string.Join("\n", storePolicies.Select(pair => $"* `{pair.Key}`: {pair.Value.Title}"))); Logs.Tester.LogInformation(description); var sresp = Assert diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 7fd0974d2..561b8d327 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -60,7 +60,6 @@ - diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index fd9eb3caf..090dccac3 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -25,7 +25,6 @@ using BTCPayServer.Security; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Invoices.Export; using BTCPayServer.Services.Rates; -using DBriize.Utils; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/BTCPayServer/Hosting/MigrationStartupTask.cs b/BTCPayServer/Hosting/MigrationStartupTask.cs index 068b4a3a9..614dc5df8 100644 --- a/BTCPayServer/Hosting/MigrationStartupTask.cs +++ b/BTCPayServer/Hosting/MigrationStartupTask.cs @@ -13,8 +13,6 @@ using BTCPayServer.Logging; using BTCPayServer.Payments; using BTCPayServer.Services; using BTCPayServer.Services.Stores; -using DBriize; -using DBriize.Utils; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; diff --git a/BTCPayServer/Services/Shopify/ShopifyApiClient.cs b/BTCPayServer/Services/Shopify/ShopifyApiClient.cs index 4d1accd7d..c93dcac86 100644 --- a/BTCPayServer/Services/Shopify/ShopifyApiClient.cs +++ b/BTCPayServer/Services/Shopify/ShopifyApiClient.cs @@ -5,7 +5,6 @@ using System.Net.Http; using System.Text; using System.Threading.Tasks; using BTCPayServer.Services.Shopify.ApiModels; -using DBriize.Utils; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -30,7 +29,7 @@ namespace BTCPayServer.Services.Shopify _credentials = credentials; var bearer = $"{_credentials.ApiKey}:{_credentials.ApiPassword}"; - bearer = Encoding.UTF8.GetBytes(bearer).ToBase64String(); + bearer = NBitcoin.DataEncoders.Encoders.Base64.EncodeData(Encoding.UTF8.GetBytes(bearer)); _httpClient.DefaultRequestHeaders.Add("Authorization", "Basic " + bearer); }