diff --git a/frontend/src/app/lightning/node/node.component.html b/frontend/src/app/lightning/node/node.component.html
index c4d618dcf..b573346d9 100644
--- a/frontend/src/app/lightning/node/node.component.html
+++ b/frontend/src/app/lightning/node/node.component.html
@@ -45,6 +45,24 @@
+
+
+
+
Channels
diff --git a/frontend/src/app/lightning/node/node.component.ts b/frontend/src/app/lightning/node/node.component.ts
index 6949e1826..503cc1471 100644
--- a/frontend/src/app/lightning/node/node.component.ts
+++ b/frontend/src/app/lightning/node/node.component.ts
@@ -1,7 +1,7 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Observable } from 'rxjs';
-import { switchMap } from 'rxjs/operators';
+import { map, switchMap } from 'rxjs/operators';
import { LightningApiService } from '../lightning-api.service';
@Component({
@@ -14,6 +14,7 @@ export class NodeComponent implements OnInit {
node$: Observable;
statistics$: Observable;
publicKey$: Observable;
+ selectedSocketIndex = 0;
constructor(
private lightningApiService: LightningApiService,
@@ -25,7 +26,27 @@ export class NodeComponent implements OnInit {
.pipe(
switchMap((params: ParamMap) => {
return this.lightningApiService.getNode$(params.get('public_key'));
- })
+ }),
+ map((node) => {
+ const socketsObject = [];
+ for (const socket of node.sockets.split(',')) {
+ let label = '';
+ if (socket.match(/(?:[0-9]{1,3}\.){3}[0-9]{1,3}/)) {
+ label = 'IPv4';
+ } else if (socket.indexOf('[') > -1) {
+ label = 'IPv6';
+ } else if (socket.indexOf('onion') > -1) {
+ label = 'Tor';
+ }
+ socketsObject.push({
+ label: label,
+ socket: node.public_key + '@' + socket,
+ });
+ }
+ console.log(socketsObject);
+ node.socketsObject = socketsObject;
+ return node;
+ }),
);
this.statistics$ = this.activatedRoute.paramMap
@@ -36,4 +57,8 @@ export class NodeComponent implements OnInit {
);
}
+ changeSocket(index: number) {
+ this.selectedSocketIndex = index;
+ }
+
}
diff --git a/lightning-backend/src/tasks/node-sync.service.ts b/lightning-backend/src/tasks/node-sync.service.ts
index 1479ce13a..65ecec8c2 100644
--- a/lightning-backend/src/tasks/node-sync.service.ts
+++ b/lightning-backend/src/tasks/node-sync.service.ts
@@ -240,7 +240,7 @@ class NodeSyncService {
private async $saveNode(node: ILightningApi.Node): Promise {
try {
const updatedAt = this.utcDateToMysql(node.updated_at);
- const sockets = node.sockets.join(', ');
+ const sockets = node.sockets.join(',');
const query = `INSERT INTO nodes(
public_key,
first_seen,