2024-10-30 07:23:45 +00:00
package views
2024-10-31 15:45:26 +00:00
import (
"fmt"
2024-10-31 21:13:52 +00:00
"github.com/ditatompel/xmr-remote-nodes/internal/ip"
2024-10-31 15:45:26 +00:00
"github.com/ditatompel/xmr-remote-nodes/internal/monero"
"github.com/ditatompel/xmr-remote-nodes/internal/paging"
2024-10-31 21:13:52 +00:00
"strings"
2024-10-31 15:45:26 +00:00
"time"
)
templ RemoteNodes(data monero.Nodes, q monero.QueryNodes, p paging.Pagination) {
2024-10-31 09:28:51 +00:00
<!-- Hero -->
<section class="relative overflow-hidden pt-6">
<!-- Gradients -->
<div aria-hidden="true" class="flex absolute -top-96 start-1/2 transform -translate-x-1/2">
<div class="bg-gradient-to-r blur-3xl w-[25rem] h-[44rem] rotate-[-60deg] transform -translate-x-[10rem] from-amber-800/30 to-orange-800/40"></div>
<div class="bg-gradient-to-tl blur-3xl w-[90rem] h-[50rem] rounded-fulls origin-top-left -rotate-12 -translate-x-[15rem] from-orange-900/60 via-orange-900/40 to-amber-900/80"></div>
</div>
<!-- End Gradients -->
<div class="relative z-10">
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-10 lg:py-16">
<div class="text-center">
<!-- Title -->
<div class="mt-5">
<h1 class="block font-extrabold text-4xl md:text-5xl lg:text-6xl text-neutral-200">Public Monero Remote Nodes List</h1>
</div>
<!-- End Title -->
<div class="mt-5">
<p class="text-lg text-neutral-300"><strong>Monero remote node</strong> is a device on the internet running the Monero software with full copy of the Monero blockchain that doesn't run on the same local machine where the Monero wallet is located.</p>
</div>
<hr class="mt-6"/>
</div>
<div class="max-w-3xl text-center mx-auto mt-8 prose prose-invert">
<p>Remote node can be used by people who, for their own reasons (usually because of hardware requirements, disk space, or technical abilities), cannot/don't want to run their own node and prefer to relay on one publicly available on the Monero network.</p>
<p>Using an open node will allow to make a transaction instantaneously, without the need to download the blockchain and sync to the Monero network first, but at the cost of the control over your privacy. the <strong>Monero community suggests to <span class="font-extrabold text-2xl underline decoration-double decoration-2 decoration-pink-500">always run and use your own node</span></strong> to obtain the maximum possible privacy and to help decentralize the network.</p>
</div>
</div>
</div>
</section>
<!-- End Hero -->
2024-10-31 15:45:26 +00:00
<div class="flex flex-col max-w-6xl mx-auto mb-10">
<div class="min-w-full inline-block align-middle">
@TableNodes(data, q, p)
</div>
</div>
}
templ TableNodes(data monero.Nodes, q monero.QueryNodes, p paging.Pagination) {
<div id="tbl_nodes" class="bg-neutral-800 border border-neutral-700 rounded-xl shadow-sm overflow-hidden">
<div class="px-6 py-4 grid gap-3 md:flex md:justify-between md:items-center border-b border-neutral-700">
@DtRowPerPage("/remote-nodes", "#tbl_nodes", q.Limit, q)
</div>
<div class="overflow-x-auto">
2024-10-31 16:08:05 +00:00
<table class="dt">
2024-10-31 15:45:26 +00:00
<thead>
<tr>
<th scope="col">Host:Port</th>
<th scope="col">Nettype</th>
<th scope="col">Protocol</th>
<th scope="col">Country</th>
<th scope="col">Status</th>
<th scope="col">Estimate Fee</th>
<th scope="col">Uptime</th>
<th scope="col">Check</th>
</tr>
</thead>
<tbody>
for _, row := range data.Items {
<tr>
2024-10-31 21:13:52 +00:00
<td>
@cellHostPort(row.IPAddresses, row.Hostname, row.Port, row.IsTor, row.IPv6Only)
</td>
2024-10-31 20:05:29 +00:00
<td>
@cellNettype(row.Nettype, row.Height)
</td>
2024-11-01 12:50:56 +00:00
<td>
@cellProtocol(row.Protocol, row.CORSCapable)
</td>
2024-10-31 15:45:26 +00:00
<td>{ row.CountryCode }</td>
<td>{ fmt.Sprintf("%d", row.EstimateFee) }</td>
<td>{ time.Unix(row.LastChecked, 0).Format("2006-01-02 15:04") }</td>
</tr>
}
</tbody>
</table>
</div>
<div class="px-6 py-4 grid gap-3 md:flex md:justify-between md:items-center border-t border-neutral-700">
@DtRowCount(p.CurrentPage, data.RowsPerPage, data.TotalRows)
@DtPagination("/remote-nodes", "#tbl_nodes", q, p)
</div>
</div>
2024-10-30 07:23:45 +00:00
}
2024-10-31 20:05:29 +00:00
2024-10-31 21:13:52 +00:00
templ cellHostPort(ips, hostname string, port uint, isTor, ipv6Only bool) {
if isTor {
<!-- TODO: Add modal -->
<button class="max-w-40 truncate text-orange-400">
👁 { hostname }
</button>
<br/>
.onion:<span class="text-indigo-400">{ fmt.Sprintf("%d", port) }</span>
<span class="text-neutral-400">(TOR)</span>
} else {
{ ip.FormatHostname(hostname) }:<span class="text-indigo-400">{ fmt.Sprintf("%d", port) }</span>
<br/>
<div class="max-w-40 text-ellipsis overflow-x-auto md:overflow-hidden hover:overflow-visible">
<span class="whitespace-break-spaces text-gray-400">{ strings.ReplaceAll(ips, ",", " ") }</span>
if ipv6Only {
<span class="text-rose-400">(IPv6 only)</span>
}
</div>
}
}
2024-10-31 20:05:29 +00:00
templ cellNettype(nettype string, height uint) {
switch nettype {
case "stagenet":
<span class="font-semibold uppercase text-sky-500">{ nettype }</span>
case "testnet":
<span class="font-semibold uppercase text-rose-500">{ nettype }</span>
default:
<span class="font-semibold uppercase text-green-500">{ nettype }</span>
}
<br/>
{ fmt.Sprintf("%d", height) }
}
2024-11-01 12:50:56 +00:00
templ cellProtocol(protocol string, cors bool) {
switch protocol {
case "http":
<span class="font-semibold uppercase text-sky-500">{ protocol }</span>
default:
<span class="font-semibold uppercase text-green-500">{ protocol }</span>
}
if cors {
<br/>
(CORS 💪)
}
}