From e9577b9bcf5c7cbce0b13629f6298d5c62675a9d Mon Sep 17 00:00:00 2001 From: ditatompel Date: Sat, 4 May 2024 22:53:03 +0700 Subject: [PATCH] Follow the monero RPC response This commit change database name and MoneroNode struct: - `NodeVersion` to `Version` - `LastHeight` to `Height` This commit also add `Status` to the MoneroNode struct. --- cmd/probe.go | 10 ++++++++-- frontend/src/routes/(front)/remote-nodes/+page.svelte | 2 +- internal/repo/monero.go | 9 +++++---- tools/resources/database/structure.sql | 4 ++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cmd/probe.go b/cmd/probe.go index a1e596c..48785a6 100644 --- a/cmd/probe.go +++ b/cmd/probe.go @@ -162,6 +162,8 @@ func (p *proberClient) fetchNode(node repo.MoneroNode) (repo.MoneroNode, error) return node, err } + fmt.Println(string(body)) + reportNode := struct { repo.MoneroNode `json:"result"` }{} @@ -170,12 +172,16 @@ func (p *proberClient) fetchNode(node repo.MoneroNode) (repo.MoneroNode, error) // TODO: Post report to server return node, err } - node.IsAvailable = true + if reportNode.Status == "OK" { + node.IsAvailable = true + } node.NetType = reportNode.NetType node.AdjustedTime = reportNode.AdjustedTime node.DatabaseSize = reportNode.DatabaseSize node.Difficulty = reportNode.Difficulty - node.NodeVersion = reportNode.NodeVersion + node.Version = reportNode.Version + + fmt.Println(prettyPrint(reportNode)) if resp.Header.Get("Access-Control-Allow-Origin") == "*" || resp.Header.Get("Access-Control-Allow-Origin") == "https://xmr.ditatompel.com" { node.CorsCapable = true diff --git a/frontend/src/routes/(front)/remote-nodes/+page.svelte b/frontend/src/routes/(front)/remote-nodes/+page.svelte index 36100ab..7dae6cb 100644 --- a/frontend/src/routes/(front)/remote-nodes/+page.svelte +++ b/frontend/src/routes/(front)/remote-nodes/+page.svelte @@ -256,7 +256,7 @@ port={row.port} /> - +