feat: Display node IP addresses #84

This commit is contained in:
Christian Ditaputratama 2024-09-12 03:11:17 +07:00
parent f6b048b017
commit 7553ad8b45
No known key found for this signature in database
GPG key ID: 31D3D06D77950979
4 changed files with 14 additions and 5 deletions

View file

@ -21,6 +21,7 @@ declare global {
is_tor: boolean; is_tor: boolean;
is_available: boolean; is_available: boolean;
nettype: string; nettype: string;
ip_addresses: string;
} }
interface ApiResponse { interface ApiResponse {

View file

@ -16,6 +16,8 @@
export let hostname; export let hostname;
export let port; export let port;
export let ipv6_only; export let ipv6_only;
/** @type {string} */
export let ip_addresses;
/** /**
* @param {string} onionAddr * @param {string} onionAddr
@ -35,7 +37,7 @@
{#if is_tor} {#if is_tor}
<button <button
class="max-w-32 truncate text-orange-800 dark:text-orange-300" class="max-w-40 truncate text-orange-800 dark:text-orange-300"
on:click={() => modalAlert(hostname, port)} on:click={() => modalAlert(hostname, port)}
> >
👁 {hostname} 👁 {hostname}
@ -43,7 +45,12 @@
<span class="text-gray-700 dark:text-gray-400">(TOR)</span> <span class="text-gray-700 dark:text-gray-400">(TOR)</span>
{:else} {:else}
{formatHostname(hostname)}:<span class="text-indigo-800 dark:text-indigo-400">{port}</span><br /> {formatHostname(hostname)}:<span class="text-indigo-800 dark:text-indigo-400">{port}</span><br />
{#if ipv6_only} <div class="max-w-40 text-ellipsis overflow-x-auto md:overflow-hidden hover:overflow-visible">
<span class="text-rose-800 dark:text-rose-400">(IPv6 only)</span> <span class="whitespace-break-spaces text-gray-700 dark:text-gray-400"
{/if} >{ip_addresses.replace(/,/g, ', ')}</span
>
{#if ipv6_only}
<span class="text-rose-800 dark:text-rose-400">(IPv6 only)</span>
{/if}
</div>
{/if} {/if}

View file

@ -211,6 +211,7 @@
<tr> <tr>
<td <td
><HostPortCell ><HostPortCell
ip_addresses={row.ip_addresses}
is_tor={row.is_tor} is_tor={row.is_tor}
hostname={row.hostname} hostname={row.hostname}
port={row.port} port={row.port}

View file

@ -75,7 +75,7 @@
</tr> </tr>
<tr> <tr>
<td class="font-bold">Public IP</td> <td class="font-bold">Public IP</td>
<td>{nodeInfo?.ip}</td> <td>{nodeInfo?.ip_addresses}</td>
</tr> </tr>
<tr> <tr>
<td class="font-bold">Net Type</td> <td class="font-bold">Net Type</td>