utc only, arrow for some dates, monero only

pull/1/head
lza_menace 4 years ago
parent 13351e73bc
commit 73c608caac

@ -1,3 +1,4 @@
import arrow
import json
import requests
import re
@ -32,7 +33,7 @@ def index():
flash("Wow, wtf hackerman. Cool it.")
page = 1
nodes = Node.select().where(Node.available==True).order_by(
nodes = Node.select().where(Node.available==True).where(Node.is_monero==True).order_by(
Node.datetime_entered.desc()
)
paginated = nodes.paginate(page, itp)
@ -76,7 +77,7 @@ def add():
def validate():
nodes = Node.select().where(Node.validated == False)
for node in nodes:
now = datetime.now()
now = datetime.utcnow()
is_onion = node.url.split(":")[1].endswith(".onion")
logging.info(f"Attempting to validate {node.url}")
if is_onion:
@ -114,13 +115,10 @@ def validate():
logging.info("failed for reasons unknown")
node.delete_instance()
@app.route("/about")
def about():
return render_template("about.html")
@app.errorhandler(404)
def not_found(error):
return redirect("/")
@app.template_filter('humanize')
def humanize(d):
t = arrow.get(d, 'UTC')
return t.humanize()
if __name__ == "__main__":
app.run()

@ -14,7 +14,7 @@ class Node(Model):
validated = BooleanField(default=False)
nettype = CharField(null=True)
is_monero = BooleanField(default=False)
datetime_entered = DateTimeField(default=datetime.now)
datetime_entered = DateTimeField(default=datetime.utcnow)
datetime_checked = DateTimeField(default=None, null=True)
datetime_failed = DateTimeField(default=None, null=True)
fail_reason = CharField(null=True)

@ -37,7 +37,6 @@
<th>Tor</th>
<th>Available</th>
<th>Network</th>
<th>Is Monero</th>
<th>Last Checked</th>
</tr>
</thead>
@ -48,8 +47,7 @@
<td>{{ node.is_tor }}</td>
<td>{{ node.available }}</td>
<td>{{ node.nettype }}</td>
<td>{{ node.is_monero }}</td>
<td>{{ node.datetime_checked }}</td>
<td>{{ node.datetime_checked | humanize }}</td>
</tr>
{% endfor %}
</tbody>

Loading…
Cancel
Save