From 5edea648b4aa291718225661e33ff08062558bc9 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Wed, 12 Feb 2025 12:01:21 -0800 Subject: [PATCH] fix faulty logic in nodes api. show only available, include i2p nodes --- xmrnodes/routes/api.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xmrnodes/routes/api.py b/xmrnodes/routes/api.py index e74d659..a5d617c 100644 --- a/xmrnodes/routes/api.py +++ b/xmrnodes/routes/api.py @@ -8,21 +8,24 @@ bp = Blueprint('api', 'api') @bp.route("/nodes.json") def nodes_json(): nodes = Node.select().where( - Node.validated==True - ).where( + Node.validated==True, + Node.available==True, Node.nettype=="mainnet" ) xmr_nodes = [n for n in nodes if n.crypto == "monero"] wow_nodes = [n for n in nodes if n.crypto == "wownero"] return jsonify({ "monero": { - "clear": [n.url for n in xmr_nodes if n.is_tor == False], + "clear": [n.url for n in xmr_nodes if n.is_tor == False and n.is_i2p == False], "onion": [n.url for n in xmr_nodes if n.is_tor == True], + "i2p": [n.url for n in xmr_nodes if n.is_i2p == True], "web_compatible": [n.url for n in xmr_nodes if n.web_compatible == True], }, "wownero": { - "clear": [n.url for n in wow_nodes if n.is_tor == False], - "onion": [n.url for n in wow_nodes if n.is_tor == True] + "clear": [n.url for n in wow_nodes if n.is_tor == False and n.is_i2p == False], + "onion": [n.url for n in wow_nodes if n.is_tor == True], + "i2p": [n.url for n in wow_nodes if n.is_i2p == True], + "web_compatible": [n.url for n in wow_nodes if n.web_compatible == True], } })