remove pages and do flat, randomized list

levin
lza_menace 4 years ago
parent 5cda6ecf81
commit 1f932f880c

@ -5,6 +5,7 @@ import re
import logging
import click
from os import makedirs
from random import shuffle
from datetime import datetime, timedelta
from flask import Flask, request, redirect
from flask import render_template, flash, url_for
@ -27,18 +28,9 @@ app.secret_key = app.config["SECRET_KEY"]
@app.route("/", methods=["GET", "POST"])
def index():
form = SubmitNode()
itp = 10
page = request.args.get("page", 1)
try:
page = int(page)
except:
flash("Wow, wtf hackerman. Cool it.")
page = 1
nettype = request.args.get("nettype", "mainnet")
crypto = request.args.get("crypto", "monero")
onion = request.args.get("onion", False)
nodes = Node.select().where(
Node.validated==True
).where(
@ -51,13 +43,12 @@ def index():
if onion:
nodes = nodes.where(Node.is_tor==True)
paginated = nodes.paginate(page, itp)
total_pages = int(nodes.count() / itp) + 1
nodes = [n for n in nodes]
shuffle(nodes)
return render_template(
"index.html",
nodes=paginated,
page=page,
total_pages=total_pages,
nodes=nodes,
form=form
)

@ -69,3 +69,13 @@ input[type="text"] {
.current-page-btn {
background-color: #b8b8b8;
}
.xmrnodes {
width: 95%;
margin: auto;
font-size: .83em;
}
#nodes {
padding-top: 1em;
}

@ -41,16 +41,21 @@
{% endif %}
{% endwith %}
<div id="" class="center">
<br>
<a href="https://twitter.com/lza_menace" target="_blank">Contact me</a>
-
<a href="https://github.com/lalanza808/monero.fail" target="_blank">Source Code</a>
-
<a href="{{ url_for('resources') }}">Resources</a>
</div>
<!-- Page Content -->
{% block content %} {% endblock %}
<!-- Footer -->
<div id="footer" class="center">
<a href="https://twitter.com/lza_menace" target="_blank">Holler at me</a>
-
<a href="https://github.com/lalanza808/monero.fail" target="_blank">Source Code</a>
-
<a href="{{ url_for('resources') }}">Resources</a>
<a href="#">Go to top</a>
</div>
</body>

@ -29,61 +29,56 @@
<div id="nodes" class="pure-u-1 section">
<h2 class="center">Find a Node</h2>
<br>
{% if nodes %}
<table class="pure-table pure-table-horizontal pure-table-striped">
<thead>
<tr>
<th>URL</th>
<th>Available</th>
<th>Network</th>
<th>Height</th>
<th>Last Checked</th>
<th>History</th>
</tr>
</thead>
<tbody>
{% for node in nodes %}
<tr>
<td>{% if node.is_tor %}<img src="/static/images/tor.svg" width="15px">{% endif %}{{ node.url }}</td>
<td>
{% if node.available %}
<span class="dot glowing-green"></span>
{% else %}
<span class="dot glowing-red""></span>
{% endif %}
</td>
<td>{{ node.nettype }}</td>
<td>{{ node.last_height }}</td>
<td>{{ node.datetime_checked | humanize }}</td>
<td>{% for hc in node.healthchecks %}
{% if loop.index > loop.length - 6 %}
<span class="dot glowing-{% if hc.health %}green{% else %}red{% endif %}"></span>
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="page-btn">
{% for p in range(1, total_pages + 1) %}
<a href="/?page={{ p }}" class="pure-button btn {% if p == page %}current-page-btn{% endif %}">{{ p }}</a>
{% endfor %}
</div>
{% else %}
<p>No nodes in the database yet...</p>
{% endif %}
<br>
<div class="center" id="filters">
<a href="{% if 'crypto' in request.args %}{{ request.url }}&{% else %}/?{% endif %}nettype=mainnet"><button class="pure-button search-btn">Mainnet</button></a>
<a href="{% if 'crypto' in request.args %}{{ request.url }}&{% else %}/?{% endif %}nettype=testnet"><button class="pure-button search-btn">Testnet</button></a>
<a href="{% if 'crypto' in request.args %}{{ request.url }}&{% else %}/?{% endif %}nettype=stagenet"><button class="pure-button search-btn">Stagenet</button></a>
{% if 'onion' not in request.args %}<a href="{% if 'nettype' in request.args or 'crypto' in request.args %}{{ request.url }}&{% else %}/?{% endif %}onion=true"><button class="pure-button search-btn"><img src="/static/images/tor.svg" width=15px> Onion</button></a>{% endif %}
<a href="/?crypto=wownero"><button class="pure-button search-btn wownero"><img src="/static/images/wownero.svg" width=50px></button></a>
<br>
<a href="/"><button class="pure-button search-btn button-warning">Clear</button></a>
<a href="/"><button class="pure-button search-btn button-warning" style="border: dashed red;">x Clear</button></a>
</div>
<br>
{% if nodes %}
<div class="xmrnodes">
<table class="pure-table pure-table-horizontal pure-table-striped">
<thead>
<tr>
<th>URL</th>
<th>Available</th>
<th>Network</th>
<th>Height</th>
<th>Last Checked</th>
<th>History</th>
</tr>
</thead>
<tbody>
{% for node in nodes %}
<tr>
<td>{% if node.is_tor %}<img src="/static/images/tor.svg" width="15px">{% endif %}{{ node.url }}</td>
<td>
{% if node.available %}
<span class="dot glowing-green"></span>
{% else %}
<span class="dot glowing-red""></span>
{% endif %}
</td>
<td>{{ node.nettype }}</td>
<td>{{ node.last_height }}</td>
<td>{{ node.datetime_checked | humanize }}</td>
<td>{% for hc in node.healthchecks %}
{% if loop.index > loop.length - 6 %}
<span class="dot glowing-{% if hc.health %}green{% else %}red{% endif %}"></span>
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p>No nodes in the database yet...</p>
{% endif %}
</div>
</div>

@ -15,8 +15,8 @@
Try out these popular Monero projects:
</p>
<ul>
<li><a href="https://featherwallet.org/" target="_blank">Feather (desktop)</a></li>
<li><a href="https://www.getmonero.org/downloads/" target="_blank">Official Community Funded Monero Software (desktop)</a></li>
<li><a href="https://featherwallet.org/" target="_blank">Feather (desktop)</a></li>
<li><a href="https://cakewallet.com/" target="_blank">Cake Wallet (iOS, Android)</a></li>
<li><a href="https://www.monerujo.io/" target="_blank">Monerujo (Android)</a></li>
<li><a href="https://mymonero.com/" target="_blank">MyMonero (Desktop, Web)</a></li>

Loading…
Cancel
Save