diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj
index 8df8e2162..512877e7a 100644
--- a/BTCPayServer/BTCPayServer.csproj
+++ b/BTCPayServer/BTCPayServer.csproj
@@ -2,7 +2,7 @@
Exe
netcoreapp2.0
- 1.0.1.72
+ 1.0.1.73
NU1701,CA1816,CA1308,CA1810,CA2208
diff --git a/BTCPayServer/Configuration/BTCPayServerOptions.cs b/BTCPayServer/Configuration/BTCPayServerOptions.cs
index da0954bd0..25f5b55b1 100644
--- a/BTCPayServer/Configuration/BTCPayServerOptions.cs
+++ b/BTCPayServer/Configuration/BTCPayServerOptions.cs
@@ -92,11 +92,14 @@ namespace BTCPayServer.Configuration
PostgresConnectionString = conf.GetOrDefault("postgres", null);
BundleJsCss = conf.GetOrDefault("bundlejscss", true);
ExternalUrl = conf.GetOrDefault("externalurl", null);
+
+ RootPath = conf.GetOrDefault("rootpath", "/");
+
var old = conf.GetOrDefault("internallightningnode", null);
if(old != null)
throw new ConfigException($"internallightningnode should not be used anymore, use btclightning instead");
}
-
+ public string RootPath { get; set; }
public Dictionary InternalLightningByCryptoCode { get; set; } = new Dictionary();
public BTCPayNetworkProvider NetworkProvider { get; set; }
diff --git a/BTCPayServer/Configuration/DefaultConfiguration.cs b/BTCPayServer/Configuration/DefaultConfiguration.cs
index 769bce1f6..a25fb5bbd 100644
--- a/BTCPayServer/Configuration/DefaultConfiguration.cs
+++ b/BTCPayServer/Configuration/DefaultConfiguration.cs
@@ -31,6 +31,9 @@ namespace BTCPayServer.Configuration
app.Option("--regtest | -regtest", $"Use regtest (Deprecated, use --network instead)", CommandOptionType.BoolValue);
app.Option("--chains | -c", $"Chains to support comma separated (default: btc, available: {chains})", CommandOptionType.SingleValue);
app.Option("--postgres", $"Connection string to postgres database (default: sqlite is used)", CommandOptionType.SingleValue);
+ app.Option("--externalurl", $"The expected external url of this service, to use if BTCPay is behind a reverse proxy (default: empty, use the incoming HTTP request to figure out)", CommandOptionType.SingleValue);
+ app.Option("--bundlejscss", $"Bundle javascript and css files for better performance (default: true)", CommandOptionType.SingleValue);
+ app.Option("--rootpath", "The root path in the URL to access BTCPay (default: /)", CommandOptionType.SingleValue);
foreach (var network in provider.GetAll())
{
var crypto = network.CryptoCode.ToLowerInvariant();
@@ -38,8 +41,6 @@ namespace BTCPayServer.Configuration
app.Option($"--{crypto}explorercookiefile", $"Path to the cookie file (default: {network.NBXplorerNetwork.DefaultSettings.DefaultCookieFile})", CommandOptionType.SingleValue);
app.Option($"--{crypto}lightning", $"Easy configuration of lightning for the server adnistrator: Must be a unix socket of CLightning (lightning-rpc) or URL to a charge server (default: empty)", CommandOptionType.SingleValue);
}
- app.Option("--externalurl", $"The expected external url of this service, to use if BTCPay is behind a reverse proxy (default: empty, use the incoming HTTP request to figure out)", CommandOptionType.SingleValue);
- app.Option("--bundlejscss", $"Bundle javascript and css files for better performance (default: true)", CommandOptionType.SingleValue);
return app;
}
diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs
index 703634b0a..e9745d637 100644
--- a/BTCPayServer/Controllers/InvoiceController.UI.cs
+++ b/BTCPayServer/Controllers/InvoiceController.UI.cs
@@ -443,11 +443,14 @@ namespace BTCPayServer.Controllers
StatusMessage = null;
if (store.Role != StoreRoles.Owner)
{
- StatusMessage = "Error: You need to be owner of this store to create an invoice";
+ ModelState.AddModelError(nameof(model.StoreId), "You need to be owner of this store to create an invoice");
+ return View(model);
}
+
if (store.GetSupportedPaymentMethods(_NetworkProvider).Count() == 0)
{
- StatusMessage = "Error: You need to configure the derivation scheme in order to create an invoice";
+ ModelState.AddModelError(nameof(model.StoreId), "You need to configure the derivation scheme in order to create an invoice");
+ return View(model);
}
if(StatusMessage != null)
diff --git a/BTCPayServer/Controllers/StoresController.cs b/BTCPayServer/Controllers/StoresController.cs
index b7eed501f..ea26acb86 100644
--- a/BTCPayServer/Controllers/StoresController.cs
+++ b/BTCPayServer/Controllers/StoresController.cs
@@ -197,8 +197,8 @@ namespace BTCPayServer.Controllers
vm.LightningMaxValue = storeBlob.LightningMaxValue?.ToString() ?? "";
vm.OnChainMinValue = storeBlob.OnChainMinValue?.ToString() ?? "";
vm.AllowCoinConversion = storeBlob.AllowCoinConversion;
- vm.CustomCSS = storeBlob.CustomCSS;
- vm.CustomLogo = storeBlob.CustomLogo;
+ vm.CustomCSS = storeBlob.CustomCSS?.AbsoluteUri;
+ vm.CustomLogo = storeBlob.CustomLogo?.AbsoluteUri;
return View(vm);
}
@@ -245,8 +245,8 @@ namespace BTCPayServer.Controllers
blob.AllowCoinConversion = model.AllowCoinConversion;
blob.LightningMaxValue = lightningMaxValue;
blob.OnChainMinValue = onchainMinValue;
- blob.CustomLogo = model.CustomLogo;
- blob.CustomCSS = model.CustomCSS;
+ blob.CustomLogo = string.IsNullOrWhiteSpace(model.CustomLogo) ? null : new Uri(model.CustomLogo, UriKind.Absolute);
+ blob.CustomCSS = string.IsNullOrWhiteSpace(model.CustomCSS) ? null : new Uri(model.CustomCSS, UriKind.Absolute);
if (store.SetStoreBlob(blob))
{
needUpdate = true;
diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs
index afa361675..fe3792f5b 100644
--- a/BTCPayServer/Hosting/Startup.cs
+++ b/BTCPayServer/Hosting/Startup.cs
@@ -147,7 +147,25 @@ namespace BTCPayServer.Hosting
IApplicationBuilder app,
IHostingEnvironment env,
IServiceProvider prov,
+ BTCPayServerOptions options,
ILoggerFactory loggerFactory)
+ {
+ Logs.Configure(loggerFactory);
+ Logs.Configuration.LogInformation($"Root Path: {options.RootPath}");
+ if (options.RootPath.Equals("/", StringComparison.OrdinalIgnoreCase))
+ {
+ ConfigureCore(app, env, prov, loggerFactory);
+ }
+ else
+ {
+ app.Map(options.RootPath, appChild =>
+ {
+ ConfigureCore(appChild, env, prov, loggerFactory);
+ });
+ }
+ }
+
+ private static void ConfigureCore(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider prov, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
@@ -155,9 +173,6 @@ namespace BTCPayServer.Hosting
app.UseBrowserLink();
}
-
- Logs.Configure(loggerFactory);
-
//App insight do not that by itself...
loggerFactory.AddApplicationInsights(prov, LogLevel.Information);
diff --git a/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs b/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs
index d12df9101..06bbe2c3c 100644
--- a/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs
+++ b/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs
@@ -37,10 +37,10 @@ namespace BTCPayServer.Models.StoreViewModels
[Display(Name = "Link to a custom CSS stylesheet")]
[Url]
- public Uri CustomCSS { get; set; }
+ public string CustomCSS { get; set; }
[Display(Name = "Link to a custom logo")]
[Url]
- public Uri CustomLogo { get; set; }
+ public string CustomLogo { get; set; }
public void SetCryptoCurrencies(ExplorerClientProvider explorerProvider, string defaultCrypto)
{