mirror of
https://github.com/mempool/mempool.git
synced 2025-02-23 06:35:15 +01:00
Only show tor badge in node page if actually running on tor only
This commit is contained in:
parent
63417c9179
commit
6df731af58
2 changed files with 9 additions and 1 deletions
|
@ -85,9 +85,12 @@
|
||||||
{{ node.as_organization }} [ASN {{node.as_number}}]
|
{{ node.as_organization }} [ASN {{node.as_number}}]
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td *ngIf="!node.as_number">
|
<td *ngIf="clearnetSocketCount === 0 && torSocketCount > 0">
|
||||||
<span class="badge badge-success" placement="bottom" i18n="tor">Exclusively on Tor</span>
|
<span class="badge badge-success" placement="bottom" i18n="tor">Exclusively on Tor</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td *ngIf="node.sockets.length === 0">
|
||||||
|
<span i18n="unknown">Unknown</span>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -22,6 +22,8 @@ export class NodeComponent implements OnInit {
|
||||||
error: Error;
|
error: Error;
|
||||||
publicKey: string;
|
publicKey: string;
|
||||||
channelListLoading = false;
|
channelListLoading = false;
|
||||||
|
clearnetSocketCount = 0;
|
||||||
|
torSocketCount = 0;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private lightningApiService: LightningApiService,
|
private lightningApiService: LightningApiService,
|
||||||
|
@ -47,10 +49,13 @@ export class NodeComponent implements OnInit {
|
||||||
let label = '';
|
let label = '';
|
||||||
if (socket.match(/(?:[0-9]{1,3}\.){3}[0-9]{1,3}/)) {
|
if (socket.match(/(?:[0-9]{1,3}\.){3}[0-9]{1,3}/)) {
|
||||||
label = 'IPv4';
|
label = 'IPv4';
|
||||||
|
this.clearnetSocketCount++;
|
||||||
} else if (socket.indexOf('[') > -1) {
|
} else if (socket.indexOf('[') > -1) {
|
||||||
label = 'IPv6';
|
label = 'IPv6';
|
||||||
|
this.clearnetSocketCount++;
|
||||||
} else if (socket.indexOf('onion') > -1) {
|
} else if (socket.indexOf('onion') > -1) {
|
||||||
label = 'Tor';
|
label = 'Tor';
|
||||||
|
this.torSocketCount++;
|
||||||
}
|
}
|
||||||
socketsObject.push({
|
socketsObject.push({
|
||||||
label: label,
|
label: label,
|
||||||
|
|
Loading…
Add table
Reference in a new issue