Compare commits

...

19 Commits

Author SHA1 Message Date
0fce95b324 bump 2021-01-29 18:35:28 +09:00
f2ff44f48f Changelog 1.0.6.8 2021-01-29 18:34:43 +09:00
a313e7e001 Apply URL changes from code review
Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

Update BTCPayServer/Controllers/AccountController.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

Update BTCPayServer/Controllers/AccountController.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

Update BTCPayServer/Controllers/AccountController.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

Update BTCPayServer/Controllers/AccountController.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

Update BTCPayServer/Controllers/AccountController.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

Update BTCPayServer/Controllers/AccountController.cs

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
2021-01-29 18:33:23 +09:00
e26e7529dc Remove clipboard code from main-bundle
See https://github.com/btcpayserver/btcpayserver/issues/2139#issuecomment-768216462
2021-01-29 18:32:09 +09:00
fa95bbd00d Remove Tor URL from login and register page
Brave and Tor Browser now show availaibility of Tor automatically in the url box of the browser.
2021-01-29 18:32:09 +09:00
cce0f1b904 Remove allowtransparency from checkout overlay 2021-01-29 18:32:09 +09:00
987d09041d bump 2021-01-17 21:45:54 +09:00
df52d01a1d Revert "GreenField API: Configure Store Lightning Payment Method"
This reverts commit b40095f6039dbce20ee92b2da8cd4530c7b8b486.
2021-01-17 21:40:16 +09:00
07de4af581 Revert "Apply suggestions from code review"
This reverts commit 48b2e682bf758ad76b8a50ddcc4473a19f5b0836.
2021-01-17 21:39:20 +09:00
95c50dcc0d Changelog and new release (#2204)
* Changelog and new release

* Update Changelog.md
2021-01-17 19:14:36 +09:00
71a192d0ba Fix SQLite COnnection string setter 2021-01-17 10:02:59 +01:00
83dd80ae86 Prevent access to wallet features if derivation scheme isn't set (#2196) 2021-01-16 19:48:05 +09:00
ccfa85b5e0 fix compile errors 2021-01-16 09:22:07 +01:00
e59821caa1 GetInvoiceRaw used its own dbContext while calling code used a different one which causes the calling context not to track changes - thus nothing is saved. (#2197)
Co-authored-by: Salie Hendricks <salie@safarinow.com>
2021-01-16 09:00:19 +01:00
2215e5e069 Merge pull request #2194 from btcpayserver/gf/ln-payment-emthod
GreenField API: Configure Store Lightning Payment Method
2021-01-14 10:07:00 +01:00
48b2e682bf Apply suggestions from code review
Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
2021-01-14 09:19:16 +01:00
5750da574a Add info on how to run the altcoin docker-compose (#2193) 2021-01-13 19:26:53 +01:00
b40095f603 GreenField API: Configure Store Lightning Payment Method 2021-01-12 09:25:35 +01:00
ec11585223 Update Changelog 2021-01-11 23:46:17 +09:00
15 changed files with 102 additions and 59 deletions

View File

@ -1,9 +1,8 @@
using System.Reflection;
using BTCPayServer.Abstractions.Contracts;
using BTCPayServer.Abstractions.Models;
using BTCPayServer.Plugins.Test.Migrations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Options;
namespace BTCPayServer.Plugins.Test
{

View File

@ -63,4 +63,8 @@ The `./docker-lightning-channel-teardown.sh` script closes any existing lightnin
2. Run `docker-compose pull` (this will ensure you have the lastest images)
3. Run again with `docker-compose up dev`
How to run the Altcoin environment?
`docker-compose -f docker-compose.altcoins.yml up dev`
If you still have issues, try to restart docker.

View File

@ -66,6 +66,8 @@ namespace BTCPayServer.Controllers
[HttpGet]
[AllowAnonymous]
[Route("~/login", Order = 1)]
[Route("~/Account/Login", Order = 2)]
public async Task<IActionResult> Login(string returnUrl = null, string email = null)
{
@ -89,6 +91,8 @@ namespace BTCPayServer.Controllers
[HttpPost]
[AllowAnonymous]
[Route("~/login", Order = 1)]
[Route("~/Account/Login", Order = 2)]
[ValidateAntiForgeryToken]
[RateLimitsFilter(ZoneLimits.Login, Scope = RateLimitsScope.RemoteAddress)]
public async Task<IActionResult> Login(LoginViewModel model, string returnUrl = null)
@ -396,6 +400,8 @@ namespace BTCPayServer.Controllers
[HttpGet]
[AllowAnonymous]
[Route("~/register", Order = 1)]
[Route("~/Account/Register", Order = 2)]
[RateLimitsFilter(ZoneLimits.Register, Scope = RateLimitsScope.RemoteAddress)]
public async Task<IActionResult> Register(string returnUrl = null, bool logon = true)
{
@ -413,6 +419,8 @@ namespace BTCPayServer.Controllers
[HttpPost]
[AllowAnonymous]
[Route("~/register", Order = 1)]
[Route("~/Account/Register", Order = 2)]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Register(RegisterViewModel model, string returnUrl = null, bool logon = true)
{

View File

@ -75,9 +75,14 @@ namespace BTCPayServer.Controllers
{
var network = NetworkProvider.GetNetwork<BTCPayNetwork>(walletId.CryptoCode);
vm.CryptoCode = network.CryptoCode;
var derivationSchemeSettings = GetDerivationSchemeSettings(walletId);
if (derivationSchemeSettings == null)
return NotFound();
vm.NBXSeedAvailable = await CanUseHotWallet() && !string.IsNullOrEmpty(await ExplorerClientProvider.GetExplorerClient(network)
.GetMetadataAsync<string>(GetDerivationSchemeSettings(walletId).AccountDerivation,
WellknownMetadataKeys.Mnemonic));
.GetMetadataAsync<string>(derivationSchemeSettings.AccountDerivation, WellknownMetadataKeys.Mnemonic));
if (await vm.GetPSBT(network.NBitcoinNetwork) is PSBT psbt)
{
vm.Decoded = psbt.ToString();
@ -98,9 +103,13 @@ namespace BTCPayServer.Controllers
return await WalletPSBT(walletId, vm);
var network = NetworkProvider.GetNetwork<BTCPayNetwork>(walletId.CryptoCode);
vm.CryptoCode = network.CryptoCode;
var derivationSchemeSettings = GetDerivationSchemeSettings(walletId);
if (derivationSchemeSettings == null)
return NotFound();
vm.NBXSeedAvailable = await CanUseHotWallet() && !string.IsNullOrEmpty(await ExplorerClientProvider.GetExplorerClient(network)
.GetMetadataAsync<string>(GetDerivationSchemeSettings(walletId).AccountDerivation,
WellknownMetadataKeys.Mnemonic));
.GetMetadataAsync<string>(derivationSchemeSettings.AccountDerivation, WellknownMetadataKeys.Mnemonic));
var psbt = await vm.GetPSBT(network.NBitcoinNetwork);
if (psbt == null)
{
@ -127,7 +136,6 @@ namespace BTCPayServer.Controllers
return View(vm);
case "update":
var derivationSchemeSettings = GetDerivationSchemeSettings(walletId);
psbt = await ExplorerClientProvider.UpdatePSBT(derivationSchemeSettings, psbt);
if (psbt == null)
{

View File

@ -27,7 +27,10 @@ namespace BTCPayServer.Controllers
public IActionResult NewPullPayment([ModelBinder(typeof(WalletIdModelBinder))]
WalletId walletId)
{
return View(new NewPullPaymentModel()
if (GetDerivationSchemeSettings(walletId) == null)
return NotFound();
return View(new NewPullPaymentModel
{
Name = "",
Currency = "BTC",
@ -41,6 +44,9 @@ namespace BTCPayServer.Controllers
public async Task<IActionResult> NewPullPayment([ModelBinder(typeof(WalletIdModelBinder))]
WalletId walletId, NewPullPaymentModel model)
{
if (GetDerivationSchemeSettings(walletId) == null)
return NotFound();
model.Name ??= string.Empty;
model.Currency = model.Currency.ToUpperInvariant().Trim();
if (_currencyTable.GetCurrencyData(model.Currency, false) is null)
@ -99,7 +105,10 @@ namespace BTCPayServer.Controllers
.Where(p => p.State == PayoutState.Completed || p.State == PayoutState.InProgress)
})
.ToListAsync();
var vm = new PullPaymentsModel();
var vm = new PullPaymentsModel
{ HasDerivationSchemeSettings = GetDerivationSchemeSettings(walletId) != null };
foreach (var o in pps)
{
var pp = o.PullPayment;
@ -175,8 +184,9 @@ namespace BTCPayServer.Controllers
[ModelBinder(typeof(WalletIdModelBinder))]
WalletId walletId, PayoutsModel vm, CancellationToken cancellationToken)
{
if (vm is null)
if (vm is null || GetDerivationSchemeSettings(walletId) == null)
return NotFound();
var storeId = walletId.StoreId;
var paymentMethodId = new PaymentMethodId(walletId.CryptoCode, PaymentTypes.BTCLike);
var payoutIds = vm.WaitingForApproval.Where(p => p.Selected).Select(p => p.PayoutId).ToArray();

View File

@ -149,7 +149,7 @@ namespace BTCPayServer.Hosting
: Path.Combine(datadirs.Value.DataDir, sqliteFileName));
options.DatabaseType = DatabaseType.Sqlite;
options.ConnectionString = sqliteFileName;
options.ConnectionString = connStr;
}
else
{

View File

@ -28,6 +28,8 @@ namespace BTCPayServer.Models.WalletViewModels
}
public List<PullPaymentModel> PullPayments { get; set; } = new List<PullPaymentModel>();
public bool HasDerivationSchemeSettings { get; set; }
}
public class NewPullPaymentModel

View File

@ -413,7 +413,7 @@ namespace BTCPayServer.Services.Invoices
{
using (var context = _ContextFactory.CreateContext())
{
var invoiceData = await GetInvoiceRaw(invoiceId);
var invoiceData = await GetInvoiceRaw(invoiceId, context);
if (invoiceData == null || (storeId != null &&
!invoiceData.StoreDataId.Equals(storeId,
StringComparison.InvariantCultureIgnoreCase)))
@ -429,7 +429,7 @@ namespace BTCPayServer.Services.Invoices
{
using (var context = _ContextFactory.CreateContext())
{
var invoiceData = await GetInvoiceRaw(invoiceId);
var invoiceData = await GetInvoiceRaw(invoiceId, context);
if (invoiceData == null)
{
return false;
@ -472,8 +472,11 @@ namespace BTCPayServer.Services.Invoices
public async Task<InvoiceEntity> GetInvoice(string id, bool inludeAddressData = false)
{
var res = await GetInvoiceRaw(id, inludeAddressData);
return res == null ? null : ToEntity(res);
using (var context = _ContextFactory.CreateContext())
{
var res = await GetInvoiceRaw(id, context, inludeAddressData);
return res == null ? null : ToEntity(res);
}
}
public async Task<InvoiceEntity[]> GetInvoices(string[] invoiceIds)
{
@ -490,24 +493,21 @@ namespace BTCPayServer.Services.Invoices
}
}
private async Task<InvoiceData> GetInvoiceRaw(string id, bool inludeAddressData = false)
private async Task<InvoiceData> GetInvoiceRaw(string id, ApplicationDbContext dbContext, bool inludeAddressData = false)
{
using (var context = _ContextFactory.CreateContext())
{
IQueryable<Data.InvoiceData> query =
context
IQueryable<Data.InvoiceData> query =
dbContext
.Invoices
.Include(o => o.Payments);
if (inludeAddressData)
query = query.Include(o => o.HistoricalAddressInvoices).Include(o => o.AddressInvoices);
query = query.Where(i => i.Id == id);
if (inludeAddressData)
query = query.Include(o => o.HistoricalAddressInvoices).Include(o => o.AddressInvoices);
query = query.Where(i => i.Id == id);
var invoice = (await query.ToListAsync()).FirstOrDefault();
if (invoice == null)
return null;
var invoice = (await query.ToListAsync()).FirstOrDefault();
if (invoice == null)
return null;
return invoice;
}
return invoice;
}
private InvoiceEntity ToEntity(Data.InvoiceData invoice)

View File

@ -24,17 +24,8 @@
<div class="row justify-content-center mb-5">
<div class="col account-form">
<div class="modal-content border-0 p-3">
<div class="modal-header align-items-center border-0 py-2">
<div class="modal-header border-0 py-2">
<h4 class="modal-title">Sign In</h4>
@if (env.OnionUrl != null)
{
<div class="text-center">
<a href="@env.OnionUrl" target="_onion" class="btn btn-sm btn-outline-onion d-inline-flex align-items-center text-nowrap p-2" data-clipboard="@env.OnionUrl" style="min-width:117px;">
<img src="~/img/icons/onion-purple.svg" height="20" class="mr-2" asp-append-version="true" />
<span data-clipboard-confirm="Copied URL ✔">Copy Tor URL</span>
</a>
</div>
}
</div>
<div class="modal-body">
<form asp-route-returnurl="@ViewData["ReturnUrl"]" method="post">

View File

@ -28,17 +28,8 @@
<div class="row justify-content-center mb-5">
<div class="col account-form">
<div class="modal-content border-0 p-3">
<div class="modal-header align-items-center border-0 py-2">
<div class="modal-header border-0 py-2">
<h4 class="modal-title">Create account</h4>
@if (env.OnionUrl != null)
{
<div class="text-center">
<a href="@env.OnionUrl" target="_onion" class="btn btn-sm btn-outline-onion d-inline-flex align-items-center text-nowrap p-2" data-clipboard="@env.OnionUrl" style="min-width:117px;">
<img src="~/img/icons/onion-purple.svg" height="20" class="mr-2" asp-append-version="true" />
<span data-clipboard-confirm="Copied URL ✔">Copy Tor URL</span>
</a>
</div>
}
</div>
<div class="modal-body">
<form asp-route-returnUrl="@ViewData["ReturnUrl"]" asp-route-logon="true" method="post">

View File

@ -18,14 +18,17 @@
</div>
}
<div class="row button-row">
<div class="col-lg-12">
<a asp-action="NewPullPayment"
asp-route-walletId="@this.Context.GetRouteValue("walletId")"
class="btn btn-primary" role="button" id="NewPullPayment"><span class="fa fa-plus"></span> Create a new pull payment</a>
<a href="https://docs.btcpayserver.org/PullPayments/" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
@if (Model.HasDerivationSchemeSettings)
{
<div class="row button-row">
<div class="col-lg-12">
<a asp-action="NewPullPayment"
asp-route-walletId="@Context.GetRouteValue("walletId")"
class="btn btn-primary" role="button" id="NewPullPayment"><span class="fa fa-plus"></span> Create a new pull payment</a>
<a href="https://docs.btcpayserver.org/PullPayments/" target="_blank"><span class="fa fa-question-circle-o" title="More information..."></span></a>
</div>
</div>
</div>
}
<div class="row">
@foreach (var pp in Model.PullPayments)

View File

@ -21,7 +21,6 @@
"wwwroot/vendor/flatpickr/flatpickr.js",
"wwwroot/main/bootstrap/bootstrap.js",
"wwwroot/main/bootstrap4-creativestart/creative.js",
"wwwroot/js/copy-to-clipboard.js",
"wwwroot/main/site.js"
]
},

View File

@ -30,7 +30,6 @@
var iframe = document.createElement('iframe');
iframe.name = 'btcpay';
iframe.class = 'btcpay';
iframe.setAttribute('allowtransparency', 'true');
iframe.style.display = 'none';
iframe.style.border = 0;
iframe.style.position = 'fixed';
@ -39,6 +38,8 @@
iframe.style.height = '100%';
iframe.style.width = '100%';
iframe.style.zIndex = '2000';
// Removed, see https://github.com/btcpayserver/btcpayserver/issues/2139#issuecomment-768223263
// iframe.setAttribute('allowtransparency', 'true');
var origin = 'http://chat.btcpayserver.org join us there, and initialize this with your origin url through setApiUrlPrefix';
var scriptMatch = thisScript.match(scriptSrcRegex)

View File

@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.0.6.5</Version>
<Version>1.0.6.8</Version>
</PropertyGroup>
</Project>

View File

@ -1,5 +1,32 @@
# Changelog
## 1.0.6.8
This release is trying some improvement to decrease the chances of being falsy flagged by Google Safe Browsing.
* Remove Tor URL from login page (useless now thanks to the url bar link) @dennisreimann
* Remove allowtransparency from checkout overlay @dennisreimann
* Remove clipboard code from the login page (was used to copy the tor url) @dennisreimann
* Rename some pages from PascalCase to lowercase. (Register => register, Login => login) @dennisreimann
## 1.0.6.7
### Bug fixes:
* Reverted the new Greenfield API: Can configure lightning payment methods @NicolasDorier
## 1.0.6.6
### Bug fixes:
* Load correct connection string when using SQLite @Kukks
* Greenfeld API: Invoice Metadata update was not updating @saliehendricks
* Prevent access to wallet pags if wallet not set @dennisreimann
### New features
* Greenfield API: Can configure lightning payment methods @Kukks
## 1.0.6.5:
### Improvements:
@ -18,7 +45,7 @@
* Do not include Tor Location header when querying the modal checkout (see #2180) @Kukks
* Webhooks should not be randomly deleted anymore. @NicolasDorier
* Fix header not showing properly after login to BTCPay Server (see #2155) @dennisreimann
* Bug: Searching invoices was timing out if there was too much invoices @rockstardev @Kukks
### Miscellaneous: