2020-12-01 19:54:16 +00:00
|
|
|
from quart import g, abort, render_template
|
|
|
|
from http import HTTPStatus
|
|
|
|
|
|
|
|
from lnbits.decorators import check_user_exists, validate_uuids
|
|
|
|
|
2020-12-01 20:29:21 +00:00
|
|
|
from . import watchonly_ext
|
2020-12-01 19:54:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
@watchonly_ext.route("/")
|
|
|
|
@validate_uuids(["usr"], required=True)
|
|
|
|
@check_user_exists()
|
|
|
|
async def index():
|
|
|
|
return await render_template("watchonly/index.html", user=g.user)
|
|
|
|
|
|
|
|
|
2020-12-04 09:59:42 +00:00
|
|
|
@watchonly_ext.route("/<charge_id>")
|
2020-12-04 10:07:59 +00:00
|
|
|
async def display(charge_id):
|
2021-04-04 13:28:46 +01:00
|
|
|
link = get_payment(charge_id) or abort(
|
2021-04-09 00:41:19 +01:00
|
|
|
HTTPStatus.NOT_FOUND, "Charge link does not exist."
|
|
|
|
)
|
2020-12-01 19:54:16 +00:00
|
|
|
|
2021-04-04 13:28:46 +01:00
|
|
|
return await render_template("watchonly/display.html", link=link)
|