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-05 12:20:03 +02:00
|
|
|
|
|
|
|
from lnbits.decorators import check_user_exists, validate_uuids
|
|
|
|
|
2020-11-21 18:04:39 -03:00
|
|
|
from . import paywall_ext
|
2020-04-05 12:20:03 +02:00
|
|
|
from .crud import get_paywall
|
|
|
|
|
|
|
|
|
|
|
|
@paywall_ext.route("/")
|
|
|
|
@validate_uuids(["usr"], required=True)
|
|
|
|
@check_user_exists()
|
2020-09-13 21:31:05 -03:00
|
|
|
async def index():
|
|
|
|
return await render_template("paywall/index.html", user=g.user)
|
2020-04-05 12:20:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
@paywall_ext.route("/<paywall_id>")
|
2020-09-13 21:31:05 -03:00
|
|
|
async def display(paywall_id):
|
2021-03-24 00:40:32 -03:00
|
|
|
paywall = await get_paywall(paywall_id) or abort(
|
|
|
|
HTTPStatus.NOT_FOUND, "Paywall does not exist."
|
|
|
|
)
|
2020-09-13 21:31:05 -03:00
|
|
|
return await render_template("paywall/display.html", paywall=paywall)
|