2020-09-13 21:31:05 -03:00
|
|
|
from quart import g, abort, render_template
|
2020-05-03 15:57:05 +02:00
|
|
|
from http import HTTPStatus
|
2020-04-03 19:59:40 +01:00
|
|
|
|
|
|
|
from lnbits.decorators import check_user_exists, validate_uuids
|
2020-04-10 22:04:48 +01:00
|
|
|
|
2020-11-21 18:04:39 -03:00
|
|
|
from . import tpos_ext
|
2020-04-10 22:04:48 +01:00
|
|
|
from .crud import get_tpos
|
2020-02-25 00:45:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
@tpos_ext.route("/")
|
2020-04-03 19:59:40 +01:00
|
|
|
@validate_uuids(["usr"], required=True)
|
|
|
|
@check_user_exists()
|
2020-09-13 21:31:05 -03:00
|
|
|
async def index():
|
|
|
|
return await render_template("tpos/index.html", user=g.user)
|
2020-02-25 00:45:21 +00:00
|
|
|
|
|
|
|
|
2020-04-10 22:04:48 +01:00
|
|
|
@tpos_ext.route("/<tpos_id>")
|
2020-09-13 21:31:05 -03:00
|
|
|
async def tpos(tpos_id):
|
2020-11-21 18:04:39 -03:00
|
|
|
tpos = await get_tpos(tpos_id)
|
|
|
|
if not tpos:
|
|
|
|
abort(HTTPStatus.NOT_FOUND, "TPoS does not exist.")
|
2020-04-17 20:39:23 +02:00
|
|
|
|
2020-09-13 21:31:05 -03:00
|
|
|
return await render_template("tpos/tpos.html", tpos=tpos)
|