public IActionResult LNDGRPCServices(string cryptoCode, int index, uint? nonce) { var external = GetExternalLNDConnectionString(cryptoCode, index); if (external == null) return NotFound(); var model = new LNDGRPCServicesViewModel(); model.Host = $"{external.BaseUri.DnsSafeHost}:{external.BaseUri.Port}"; model.SSL = external.BaseUri.Scheme == "https"; if (external.CertificateThumbprint != null) { model.CertificateThumbprint = Encoders.Hex.EncodeData(external.CertificateThumbprint); } if (external.Macaroon != null) { model.Macaroon = Encoders.Hex.EncodeData(external.Macaroon); } if (nonce != null) { var configKey = GetConfigKey("lnd-grpc", cryptoCode, index, nonce.Value); var lnConfig = _LnConfigProvider.GetConfig(configKey); if (lnConfig != null) { model.QRCodeLink = $"{this.Request.GetAbsoluteRoot().WithTrailingSlash()}lnd-config/{configKey}/lnd.config"; model.QRCode = $"config={model.QRCodeLink}"; } } return View(model); }
public IActionResult LNDGRPCServices(string cryptoCode, ulong?secret) { if (!_Options.InternalLightningByCryptoCode.TryGetValue(cryptoCode.ToUpperInvariant(), out var connectionString)) { return(NotFound()); } var model = new LNDGRPCServicesViewModel(); var external = GetExternalLNDConnectionString(connectionString); model.Host = external.BaseUri.DnsSafeHost; model.Port = external.BaseUri.Port; model.SSL = external.BaseUri.Scheme == "https"; if (external.CertificateThumbprint != null) { model.CertificateThumbprint = Encoders.Hex.EncodeData(external.CertificateThumbprint); } if (external.Macaroon != null) { model.Macaroon = Encoders.Hex.EncodeData(external.Macaroon); } if (secret != null) { var lnConfig = _LnConfigProvider.GetConfig(secret.Value); if (lnConfig != null) { model.QRCode = $"config={this.Request.GetAbsoluteRoot().WithTrailingSlash()}lnd-config/{secret.Value}/lnd.config"; } } return(View(model)); }
public IActionResult LNDGRPCServices(string cryptoCode, int index, uint?nonce) { if (!_dashBoard.IsFullySynched(cryptoCode, out var unusud)) { StatusMessage = $"Error: {cryptoCode} is not fully synched"; return(RedirectToAction(nameof(Services))); } var external = GetExternalLNDConnectionString(cryptoCode, index); if (external == null) { return(NotFound()); } var model = new LNDGRPCServicesViewModel(); model.Host = $"{external.BaseUri.DnsSafeHost}:{external.BaseUri.Port}"; model.SSL = external.BaseUri.Scheme == "https"; if (external.CertificateThumbprint != null) { model.CertificateThumbprint = Encoders.Hex.EncodeData(external.CertificateThumbprint); } if (external.Macaroon != null) { model.Macaroon = Encoders.Hex.EncodeData(external.Macaroon); } if (nonce != null) { var configKey = GetConfigKey("lnd-grpc", cryptoCode, index, nonce.Value); var lnConfig = _LnConfigProvider.GetConfig(configKey); if (lnConfig != null) { model.QRCodeLink = $"{this.Request.GetAbsoluteRoot().WithTrailingSlash()}lnd-config/{configKey}/lnd.config"; model.QRCode = $"config={model.QRCodeLink}"; } } return(View(model)); }