Add thunderhub integration

This commit is contained in:
nicolas.dorier
2020-05-20 04:58:07 +09:00
parent 74b6aa7353
commit 03d90f79ea
3 changed files with 12 additions and 3 deletions

View File

@@ -78,7 +78,7 @@ namespace BTCPayServer.Configuration
} }
} }
if (new []{ExternalServiceTypes.Charge, ExternalServiceTypes.RTL, ExternalServiceTypes.Spark, ExternalServiceTypes.Configurator}.Contains(serviceType)) if (new []{ExternalServiceTypes.Charge, ExternalServiceTypes.RTL, ExternalServiceTypes.ThunderHub, ExternalServiceTypes.Spark, ExternalServiceTypes.Configurator}.Contains(serviceType))
{ {
// Read access key from cookie file // Read access key from cookie file
if (connectionString.CookieFilePath != null) if (connectionString.CookieFilePath != null)
@@ -95,7 +95,7 @@ namespace BTCPayServer.Configuration
{ {
throw new System.IO.FileNotFoundException("Cookie file path not found", ex); throw new System.IO.FileNotFoundException("Cookie file path not found", ex);
} }
if (serviceType == ExternalServiceTypes.RTL || serviceType == ExternalServiceTypes.Configurator) if (serviceType == ExternalServiceTypes.RTL || serviceType == ExternalServiceTypes.Configurator || serviceType == ExternalServiceTypes.ThunderHub)
{ {
connectionString.AccessKey = cookieFileContent; connectionString.AccessKey = cookieFileContent;
} }

View File

@@ -36,6 +36,10 @@ namespace BTCPayServer.Configuration
$"Valid example: 'server=https://btcpay.example.com/rtl/btc/;cookiefile=/etc/clightning_bitcoin_rtl/.cookie'" + Environment.NewLine + $"Valid example: 'server=https://btcpay.example.com/rtl/btc/;cookiefile=/etc/clightning_bitcoin_rtl/.cookie'" + Environment.NewLine +
"Error: {1}", "Error: {1}",
"Ride the Lightning server"); "Ride the Lightning server");
Load(configuration, cryptoCode, "thunderhub", ExternalServiceTypes.ThunderHub, "Invalid setting {0}, " + Environment.NewLine +
$"Valid example: 'server=https://btcpay.example.com/thub/;cookiefile=/etc/clightning_bitcoin_rtl/.cookie'" + Environment.NewLine +
"Error: {1}",
"ThunderHub");
Load(configuration, cryptoCode, "clightningrest", ExternalServiceTypes.CLightningRest, "Invalid setting {0}, " + Environment.NewLine + Load(configuration, cryptoCode, "clightningrest", ExternalServiceTypes.CLightningRest, "Invalid setting {0}, " + Environment.NewLine +
$"Valid example: 'server=https://btcpay.example.com/clightning-rest/btc/;cookiefile=/etc/clightning_bitcoin_rtl/.cookie'" + Environment.NewLine + $"Valid example: 'server=https://btcpay.example.com/clightning-rest/btc/;cookiefile=/etc/clightning_bitcoin_rtl/.cookie'" + Environment.NewLine +
"Error: {1}", "Error: {1}",
@@ -102,6 +106,7 @@ namespace BTCPayServer.Configuration
LNDSeedBackup, LNDSeedBackup,
Spark, Spark,
RTL, RTL,
ThunderHub,
Charge, Charge,
P2P, P2P,
RPC, RPC,

View File

@@ -593,6 +593,7 @@ namespace BTCPayServer.Controllers
case ExternalServiceTypes.Charge: case ExternalServiceTypes.Charge:
return LightningChargeServices(service, connectionString, showQR); return LightningChargeServices(service, connectionString, showQR);
case ExternalServiceTypes.RTL: case ExternalServiceTypes.RTL:
case ExternalServiceTypes.ThunderHub:
case ExternalServiceTypes.Spark: case ExternalServiceTypes.Spark:
if (connectionString.AccessKey == null) if (connectionString.AccessKey == null)
{ {
@@ -602,7 +603,10 @@ namespace BTCPayServer.Controllers
LightningWalletServices vm = new LightningWalletServices(); LightningWalletServices vm = new LightningWalletServices();
vm.ShowQR = showQR; vm.ShowQR = showQR;
vm.WalletName = service.DisplayName; vm.WalletName = service.DisplayName;
vm.ServiceLink = $"{connectionString.Server}?access-key={connectionString.AccessKey}"; string tokenParam = "access-key";
if (service.Type == ExternalServiceTypes.ThunderHub)
tokenParam = "token";
vm.ServiceLink = $"{connectionString.Server}?{tokenParam}={connectionString.AccessKey}";
return View("LightningWalletServices", vm); return View("LightningWalletServices", vm);
case ExternalServiceTypes.CLightningRest: case ExternalServiceTypes.CLightningRest:
return LndServices(service, connectionString, nonce, "CLightningRestServices"); return LndServices(service, connectionString, nonce, "CLightningRestServices");