mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Make .netcoreapp 3.0 build happy
This commit is contained in:
@@ -72,6 +72,7 @@
|
|||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp2.1'">
|
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp2.1'">
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0"></PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ namespace BTCPayServer.Controllers
|
|||||||
!transactionOutput.SubtractFeesFromOutput)
|
!transactionOutput.SubtractFeesFromOutput)
|
||||||
vm.AddModelError(model => model.Outputs[i].SubtractFeesFromOutput,
|
vm.AddModelError(model => model.Outputs[i].SubtractFeesFromOutput,
|
||||||
"You are sending your entire balance to the same destination, you should subtract the fees",
|
"You are sending your entire balance to the same destination, you should subtract the fees",
|
||||||
ModelState);
|
this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +402,7 @@ namespace BTCPayServer.Controllers
|
|||||||
foreach (var subtractFeesOutput in subtractFeesOutputsCount)
|
foreach (var subtractFeesOutput in subtractFeesOutputsCount)
|
||||||
{
|
{
|
||||||
vm.AddModelError(model => model.Outputs[subtractFeesOutput].SubtractFeesFromOutput,
|
vm.AddModelError(model => model.Outputs[subtractFeesOutput].SubtractFeesFromOutput,
|
||||||
"You can only subtract fees from one output", ModelState);
|
"You can only subtract fees from one output", this);
|
||||||
}
|
}
|
||||||
}else if (vm.CurrentBalance == transactionAmountSum && !substractFees)
|
}else if (vm.CurrentBalance == transactionAmountSum && !substractFees)
|
||||||
{
|
{
|
||||||
@@ -415,7 +415,7 @@ namespace BTCPayServer.Controllers
|
|||||||
for (var i = 0; i < vm.Outputs.Count; i++)
|
for (var i = 0; i < vm.Outputs.Count; i++)
|
||||||
{
|
{
|
||||||
vm.AddModelError(model => model.Outputs[i].Amount,
|
vm.AddModelError(model => model.Outputs[i].Amount,
|
||||||
"You are sending more than what you own", ModelState);
|
"You are sending more than what you own", this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace BTCPayServer
|
|||||||
!decimal.TryParse(match.Groups[1].Value, out var v))
|
!decimal.TryParse(match.Groups[1].Value, out var v))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var currency = match.Groups.Last().Value.ToUpperInvariant();
|
var currency = match.Groups[match.Groups.Count - 1].Value.ToUpperInvariant();
|
||||||
var currencyData = _CurrencyTable.GetCurrencyData(currency, false);
|
var currencyData = _CurrencyTable.GetCurrencyData(currency, false);
|
||||||
if (currencyData == null)
|
if (currencyData == null)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
#if NETCOREAPP21
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
|
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
|
||||||
|
#else
|
||||||
|
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace BTCPayServer
|
namespace BTCPayServer
|
||||||
{
|
{
|
||||||
public static class ModelStateExtensions
|
public static class ModelStateExtensions
|
||||||
{
|
{
|
||||||
public static void AddModelError<TModel, TProperty>(
|
|
||||||
this ModelStateDictionary modelState,
|
|
||||||
Expression<Func<TModel, TProperty>> ex,
|
|
||||||
string message
|
|
||||||
)
|
|
||||||
{
|
|
||||||
var key = ExpressionHelper.GetExpressionText(ex);
|
|
||||||
modelState.AddModelError(key, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddModelError<TModel, TProperty>(this TModel source,
|
public static void AddModelError<TModel, TProperty>(this TModel source,
|
||||||
Expression<Func<TModel, TProperty>> ex,
|
Expression<Func<TModel, TProperty>> ex,
|
||||||
string message,
|
string message,
|
||||||
ModelStateDictionary modelState)
|
Controller controller)
|
||||||
{
|
{
|
||||||
|
#if NETCOREAPP21
|
||||||
var key = ExpressionHelper.GetExpressionText(ex);
|
var key = ExpressionHelper.GetExpressionText(ex);
|
||||||
modelState.AddModelError(key, message);
|
#else
|
||||||
|
var provider = (ModelExpressionProvider)controller.HttpContext.RequestServices.GetService(typeof(ModelExpressionProvider));
|
||||||
|
var key = provider.GetExpressionText(ex);
|
||||||
|
#endif
|
||||||
|
controller.ModelState.AddModelError(key, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
|
||||||
using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal;
|
|
||||||
|
|
||||||
namespace BTCPayServer.Filters
|
namespace BTCPayServer.Filters
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
#if NETCOREAPP21
|
#if NETCOREAPP21
|
||||||
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
|
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
|
||||||
|
#else
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
#endif
|
#endif
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using NBitcoin;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc.Internal;
|
|
||||||
using NBXplorer.DerivationStrategy;
|
using NBXplorer.DerivationStrategy;
|
||||||
|
|
||||||
namespace BTCPayServer.ModelBinders
|
namespace BTCPayServer.ModelBinders
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
#if NETCOREAPP21
|
#if NETCOREAPP21
|
||||||
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
|
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
|
||||||
|
#else
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace BTCPayServer.Services
|
namespace BTCPayServer.Services
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@using Microsoft.EntityFrameworkCore.Internal
|
|
||||||
@using Microsoft.EntityFrameworkCore.Storage
|
|
||||||
@model BTCPayServer.Models.AppViewModels.ContributeToCrowdfund
|
@model BTCPayServer.Models.AppViewModels.ContributeToCrowdfund
|
||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
@@ -8,7 +6,7 @@
|
|||||||
<div class="card mb-4 perk expanded" id="@item.Id">
|
<div class="card mb-4 perk expanded" id="@item.Id">
|
||||||
@if (Model.ViewCrowdfundViewModel.DisplayPerksRanking && Model.ViewCrowdfundViewModel.PerkCount.ContainsKey(item.Id))
|
@if (Model.ViewCrowdfundViewModel.DisplayPerksRanking && Model.ViewCrowdfundViewModel.PerkCount.ContainsKey(item.Id))
|
||||||
{
|
{
|
||||||
<span class="btn btn-sm rounded-circle px-0 btn-primary perk-badge">#@(Model.ViewCrowdfundViewModel.Perks.IndexOf(item)+1)</span>
|
<span class="btn btn-sm rounded-circle px-0 btn-primary perk-badge">#@(Array.IndexOf(Model.ViewCrowdfundViewModel.Perks, item) + 1)</span>
|
||||||
}
|
}
|
||||||
@if (!string.IsNullOrEmpty(item.Image))
|
@if (!string.IsNullOrEmpty(item.Image))
|
||||||
{
|
{
|
||||||
@@ -31,12 +29,12 @@
|
|||||||
@item.Price.Value
|
@item.Price.Value
|
||||||
if (item.Custom)
|
if (item.Custom)
|
||||||
{
|
{
|
||||||
Safe.Raw("or more");
|
@Safe.Raw("or more");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (item.Custom)
|
else if (item.Custom)
|
||||||
{
|
{
|
||||||
Safe.Raw("Any amount");
|
@Safe.Raw("Any amount");
|
||||||
}
|
}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
<li>
|
<li>
|
||||||
@if (Model.LogFileOffset > 0)
|
@if (Model.LogFileOffset > 0)
|
||||||
{
|
{
|
||||||
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset - 5)"><<</a>
|
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset - 5)"><<</a>
|
||||||
}
|
}
|
||||||
Showing @Model.LogFileOffset - (@(Model.LogFileOffset+Model.LogFiles.Count)) of @Model.LogFileCount
|
Showing @Model.LogFileOffset - (@(Model.LogFileOffset+Model.LogFiles.Count)) of @Model.LogFileCount
|
||||||
@if ((Model.LogFileOffset+ Model.LogFiles.Count) < Model.LogFileCount)
|
@if ((Model.LogFileOffset+ Model.LogFiles.Count) < Model.LogFileCount)
|
||||||
{
|
{
|
||||||
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset + Model.LogFiles.Count)">>></a>
|
<a asp-action="LogsView" asp-route-offset="@(Model.LogFileOffset + Model.LogFiles.Count)">>></a>
|
||||||
}
|
}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user