split resources out

This commit is contained in:
lza_menace 2023-04-04 00:00:37 -07:00
parent 726d2766e8
commit 2fb28e90fb
16 changed files with 532 additions and 481 deletions

27
xmrnodes/filters.py Normal file
View file

@ -0,0 +1,27 @@
from datetime import datetime
import arrow
from flask import Blueprint
from urllib.parse import urlencode
bp = Blueprint("filters", "filters")
@bp.app_template_filter("humanize")
def humanize(d):
t = arrow.get(d, "UTC")
return t.humanize()
@bp.app_template_filter("hours_elapsed")
def hours_elapsed(d):
now = datetime.utcnow()
diff = now - d
return diff.total_seconds() / 60 / 60
@bp.app_template_filter("pop_arg")
def trim_arg(all_args, arg_to_trim):
d = all_args.to_dict()
d.pop(arg_to_trim)
return urlencode(d)