mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-03-15 12:20:21 +01:00
Converted views
This commit is contained in:
parent
d3d24abb17
commit
bbdb96f4ac
21 changed files with 177 additions and 112 deletions
|
@ -25,7 +25,10 @@ from ..crud import (
|
||||||
save_balance_notify,
|
save_balance_notify,
|
||||||
)
|
)
|
||||||
from ..services import redeem_lnurl_withdraw, pay_invoice
|
from ..services import redeem_lnurl_withdraw, pay_invoice
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@core_app.get("/favicon.ico")
|
@core_app.get("/favicon.ico")
|
||||||
async def favicon():
|
async def favicon():
|
||||||
|
@ -35,10 +38,8 @@ async def favicon():
|
||||||
|
|
||||||
|
|
||||||
@core_app.get("/")
|
@core_app.get("/")
|
||||||
async def home():
|
async def home(request: Request, lightning: str = None):
|
||||||
return await render_template(
|
return templates.TemplateResponse("core/index.html", {"request": request, "lnurl": lightning})
|
||||||
"core/index.html", lnurl=request.args.get("lightning", None)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@core_app.get("/extensions")
|
@core_app.get("/extensions")
|
||||||
|
@ -61,8 +62,7 @@ async def extensions():
|
||||||
await update_user_extension(
|
await update_user_extension(
|
||||||
user_id=g.user.id, extension=extension_to_disable, active=False
|
user_id=g.user.id, extension=extension_to_disable, active=False
|
||||||
)
|
)
|
||||||
|
return await templates.TemplateResponse("core/extensions.html", {"request": request, "user": get_user(g.user.id)})
|
||||||
return await render_template("core/extensions.html", user=await get_user(g.user.id))
|
|
||||||
|
|
||||||
|
|
||||||
@core_app.get("/wallet")
|
@core_app.get("/wallet")
|
||||||
|
|
|
@ -6,17 +6,18 @@ from . import bleskomat_ext
|
||||||
|
|
||||||
from .exchange_rates import exchange_rate_providers_serializable, fiat_currencies
|
from .exchange_rates import exchange_rate_providers_serializable, fiat_currencies
|
||||||
from .helpers import get_callback_url
|
from .helpers import get_callback_url
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@bleskomat_ext.get("/")
|
@bleskomat_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
bleskomat_vars = {
|
bleskomat_vars = {
|
||||||
"callback_url": get_callback_url(),
|
"callback_url": get_callback_url(),
|
||||||
"exchange_rate_providers": exchange_rate_providers_serializable,
|
"exchange_rate_providers": exchange_rate_providers_serializable,
|
||||||
"fiat_currencies": fiat_currencies,
|
"fiat_currencies": fiat_currencies,
|
||||||
}
|
}
|
||||||
return await render_template(
|
return await templates.TemplateResponse("bleskomat/index.html", {"request": request, "user":g.user, "bleskomat_vars":bleskomat_vars})
|
||||||
"bleskomat/index.html", user=g.user, bleskomat_vars=bleskomat_vars
|
|
||||||
)
|
|
||||||
|
|
|
@ -10,23 +10,24 @@ from functools import wraps
|
||||||
import trio
|
import trio
|
||||||
import shortuuid
|
import shortuuid
|
||||||
from . import copilot_ext
|
from . import copilot_ext
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@copilot_ext.route("/")
|
@copilot_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("copilot/index.html", user=g.user)
|
return await templates.TemplateResponse("copilot/index.html", {"request": request, "user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@copilot_ext.route("/cp/")
|
@copilot_ext.route("/cp/")
|
||||||
async def compose():
|
async def compose(request: Request):
|
||||||
return await render_template("copilot/compose.html")
|
return await templates.TemplateResponse("copilot/compose.html", {"request": request})
|
||||||
|
|
||||||
|
|
||||||
@copilot_ext.route("/pn/")
|
@copilot_ext.route("/pn/")
|
||||||
async def panel():
|
async def panel(request: Request):
|
||||||
return await render_template("copilot/panel.html")
|
return await templates.TemplateResponse("copilot/panel.html", {"request": request})
|
||||||
|
|
||||||
|
|
||||||
##################WEBSOCKET ROUTES########################
|
##################WEBSOCKET ROUTES########################
|
||||||
|
|
|
@ -6,46 +6,51 @@ from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import events_ext
|
from . import events_ext
|
||||||
from .crud import get_ticket, get_event
|
from .crud import get_ticket, get_event
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@events_ext.route("/")
|
@events_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("events/index.html", user=g.user)
|
return templates.TemplateResponse("events/index.html", {"user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@events_ext.route("/<event_id>")
|
@events_ext.route("/<event_id>")
|
||||||
async def display(event_id):
|
async def display(request: Request, event_id):
|
||||||
event = await get_event(event_id)
|
event = await get_event(event_id)
|
||||||
if not event:
|
if not event:
|
||||||
abort(HTTPStatus.NOT_FOUND, "Event does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "Event does not exist.")
|
||||||
|
|
||||||
if event.amount_tickets < 1:
|
if event.amount_tickets < 1:
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"events/error.html",
|
"events/error.html",
|
||||||
event_name=event.name,
|
{"request":request,
|
||||||
event_error="Sorry, tickets are sold out :(",
|
"event_name":event.name,
|
||||||
|
"event_error":"Sorry, tickets are sold out :("}
|
||||||
)
|
)
|
||||||
datetime_object = datetime.strptime(event.closing_date, "%Y-%m-%d").date()
|
datetime_object = datetime.strptime(event.closing_date, "%Y-%m-%d").date()
|
||||||
if date.today() > datetime_object:
|
if date.today() > datetime_object:
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"events/error.html",
|
"events/error.html",
|
||||||
event_name=event.name,
|
{"request":request,
|
||||||
event_error="Sorry, ticket closing date has passed :(",
|
"event_name":event.name,
|
||||||
|
"event_error":"Sorry, ticket closing date has passed :("}
|
||||||
)
|
)
|
||||||
|
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"events/display.html",
|
"events/display.html",
|
||||||
event_id=event_id,
|
{"request":request,
|
||||||
event_name=event.name,
|
"event_id":event_id,
|
||||||
event_info=event.info,
|
"event_name":event.name,
|
||||||
event_price=event.price_per_ticket,
|
"event_info":event.info,
|
||||||
|
"event_price":event.price_per_ticket}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@events_ext.route("/ticket/<ticket_id>")
|
@events_ext.route("/ticket/<ticket_id>")
|
||||||
async def ticket(ticket_id):
|
async def ticket(request: Request, ticket_id):
|
||||||
ticket = await get_ticket(ticket_id)
|
ticket = await get_ticket(ticket_id)
|
||||||
if not ticket:
|
if not ticket:
|
||||||
abort(HTTPStatus.NOT_FOUND, "Ticket does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "Ticket does not exist.")
|
||||||
|
@ -54,23 +59,25 @@ async def ticket(ticket_id):
|
||||||
if not event:
|
if not event:
|
||||||
abort(HTTPStatus.NOT_FOUND, "Event does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "Event does not exist.")
|
||||||
|
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"events/ticket.html",
|
"events/ticket.html",
|
||||||
ticket_id=ticket_id,
|
{"request":request,
|
||||||
ticket_name=event.name,
|
"ticket_id":ticket_id,
|
||||||
ticket_info=event.info,
|
"ticket_name":event.name,
|
||||||
|
"ticket_info":event.info}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@events_ext.route("/register/<event_id>")
|
@events_ext.route("/register/<event_id>")
|
||||||
async def register(event_id):
|
async def register(request: Request, event_id):
|
||||||
event = await get_event(event_id)
|
event = await get_event(event_id)
|
||||||
if not event:
|
if not event:
|
||||||
abort(HTTPStatus.NOT_FOUND, "Event does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "Event does not exist.")
|
||||||
|
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"events/register.html",
|
"events/register.html",
|
||||||
event_id=event_id,
|
{"request":request,
|
||||||
event_name=event.name,
|
"event_id":event_id,
|
||||||
wallet_id=event.wallet,
|
"event_name":event.name,
|
||||||
|
"wallet_id":event.wallet}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
from quart import g, render_template
|
from quart import g, render_template
|
||||||
|
|
||||||
from lnbits.decorators import check_user_exists, validate_uuids
|
from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
from . import example_ext
|
from . import example_ext
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@example_ext.route("/")
|
@example_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("example/index.html", user=g.user)
|
return await templates.TemplateResponse("example/index.html", {"request": request, "user":g.user})
|
||||||
|
|
|
@ -3,10 +3,13 @@ from quart import g, render_template
|
||||||
from lnbits.decorators import check_user_exists, validate_uuids
|
from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import hivemind_ext
|
from . import hivemind_ext
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@hivemind_ext.route("/")
|
@hivemind_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("hivemind/index.html", user=g.user)
|
return await templates.TemplateResponse("hivemind/index.html", {"request": request, "user":g.user})
|
||||||
|
|
|
@ -10,17 +10,20 @@ import json
|
||||||
from . import jukebox_ext
|
from . import jukebox_ext
|
||||||
from .crud import get_jukebox
|
from .crud import get_jukebox
|
||||||
from .views_api import api_get_jukebox_device_check
|
from .views_api import api_get_jukebox_device_check
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@jukebox_ext.get("/")
|
@jukebox_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("jukebox/index.html", user=g.user)
|
return await templates.TemplateResponse("jukebox/index.html", {"request": request,"user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@jukebox_ext.get("/<juke_id>")
|
@jukebox_ext.get("/<juke_id>")
|
||||||
async def connect_to_jukebox(juke_id):
|
async def connect_to_jukebox(request: Request, juke_id):
|
||||||
jukebox = await get_jukebox(juke_id)
|
jukebox = await get_jukebox(juke_id)
|
||||||
if not jukebox:
|
if not jukebox:
|
||||||
return "error"
|
return "error"
|
||||||
|
@ -31,7 +34,7 @@ async def connect_to_jukebox(juke_id):
|
||||||
if device["id"] == jukebox.sp_device.split("-")[1]:
|
if device["id"] == jukebox.sp_device.split("-")[1]:
|
||||||
deviceConnected = True
|
deviceConnected = True
|
||||||
if deviceConnected:
|
if deviceConnected:
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"jukebox/jukebox.html",
|
"jukebox/jukebox.html",
|
||||||
playlists=jukebox.sp_playlists.split(","),
|
playlists=jukebox.sp_playlists.split(","),
|
||||||
juke_id=juke_id,
|
juke_id=juke_id,
|
||||||
|
@ -39,4 +42,4 @@ async def connect_to_jukebox(juke_id):
|
||||||
inkey=jukebox.inkey,
|
inkey=jukebox.inkey,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return await render_template("jukebox/error.html")
|
return await templates.TemplateResponse("jukebox/error.html",{"request": request})
|
||||||
|
|
|
@ -7,13 +7,16 @@ from lnbits.core.crud import get_wallet_payment
|
||||||
|
|
||||||
from . import livestream_ext
|
from . import livestream_ext
|
||||||
from .crud import get_track, get_livestream_by_track
|
from .crud import get_track, get_livestream_by_track
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@livestream_ext.route("/")
|
@livestream_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("livestream/index.html", user=g.user)
|
return await templates.TemplateResponse("livestream/index.html", {"request": request,"user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@livestream_ext.route("/track/<track_id>")
|
@livestream_ext.route("/track/<track_id>")
|
||||||
|
|
|
@ -2,10 +2,13 @@ from quart import render_template, g
|
||||||
|
|
||||||
from lnbits.decorators import check_user_exists, validate_uuids
|
from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
from . import lndhub_ext
|
from . import lndhub_ext
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@lndhub_ext.route("/")
|
@lndhub_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def lndhub_index():
|
async def lndhub_index(request: Request):
|
||||||
return await render_template("lndhub/index.html", user=g.user)
|
return await templates.TemplateResponse("lndhub/index.html", {"request": request,"user":g.user})
|
||||||
|
|
|
@ -6,29 +6,33 @@ from http import HTTPStatus
|
||||||
|
|
||||||
from . import lnticket_ext
|
from . import lnticket_ext
|
||||||
from .crud import get_form
|
from .crud import get_form
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@lnticket_ext.route("/")
|
@lnticket_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("lnticket/index.html", user=g.user)
|
return await templates.TemplateResponse("lnticket/index.html", {"request": request,"user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@lnticket_ext.route("/<form_id>")
|
@lnticket_ext.route("/<form_id>")
|
||||||
async def display(form_id):
|
async def display(request: Request, form_id):
|
||||||
form = await get_form(form_id)
|
form = await get_form(form_id)
|
||||||
if not form:
|
if not form:
|
||||||
abort(HTTPStatus.NOT_FOUND, "LNTicket does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "LNTicket does not exist.")
|
||||||
|
|
||||||
wallet = await get_wallet(form.wallet)
|
wallet = await get_wallet(form.wallet)
|
||||||
|
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"lnticket/display.html",
|
"lnticket/display.html",
|
||||||
form_id=form.id,
|
{"request": request,
|
||||||
form_name=form.name,
|
"form_id":form.id,
|
||||||
form_desc=form.description,
|
"form_name":form.name,
|
||||||
form_amount=form.amount,
|
"form_desc":form.description,
|
||||||
form_flatrate=form.flatrate,
|
"form_amount":form.amount,
|
||||||
form_wallet=wallet.inkey,
|
"form_flatrate":form.flatrate,
|
||||||
|
"form_wallet":wallet.inkey}
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,28 +5,31 @@ from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import lnurlp_ext
|
from . import lnurlp_ext
|
||||||
from .crud import get_pay_link
|
from .crud import get_pay_link
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@lnurlp_ext.route("/")
|
@lnurlp_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("lnurlp/index.html", user=g.user)
|
return await templates.TemplateResponse("lnurlp/index.html", {"request": request, "user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@lnurlp_ext.route("/<link_id>")
|
@lnurlp_ext.route("/<link_id>")
|
||||||
async def display(link_id):
|
async def display(request: Request,link_id):
|
||||||
link = await get_pay_link(link_id)
|
link = await get_pay_link(link_id)
|
||||||
if not link:
|
if not link:
|
||||||
abort(HTTPStatus.NOT_FOUND, "Pay link does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "Pay link does not exist.")
|
||||||
|
|
||||||
return await render_template("lnurlp/display.html", link=link)
|
return await templates.TemplateResponse("lnurlp/display.html", {"request": request, "link":link})
|
||||||
|
|
||||||
|
|
||||||
@lnurlp_ext.route("/print/<link_id>")
|
@lnurlp_ext.route("/print/<link_id>")
|
||||||
async def print_qr(link_id):
|
async def print_qr(request: Request,link_id):
|
||||||
link = await get_pay_link(link_id)
|
link = await get_pay_link(link_id)
|
||||||
if not link:
|
if not link:
|
||||||
abort(HTTPStatus.NOT_FOUND, "Pay link does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "Pay link does not exist.")
|
||||||
|
|
||||||
return await render_template("lnurlp/print_qr.html", link=link)
|
return await templates.TemplateResponse("lnurlp/print_qr.html", {"request": request, "link":link})
|
||||||
|
|
|
@ -5,7 +5,10 @@ from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
from pyngrok import conf, ngrok
|
from pyngrok import conf, ngrok
|
||||||
from . import ngrok_ext
|
from . import ngrok_ext
|
||||||
from os import getenv
|
from os import getenv
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
def log_event_callback(log):
|
def log_event_callback(log):
|
||||||
string = str(log)
|
string = str(log)
|
||||||
|
@ -26,5 +29,5 @@ ngrok_tunnel = ngrok.connect(port)
|
||||||
@ngrok_ext.get("/")
|
@ngrok_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("ngrok/index.html", ngrok=string5, user=g.user)
|
return await templates.TemplateResponse("ngrok/index.html", {"request": request, "ngrok":string5, "user":g.user})
|
||||||
|
|
|
@ -9,17 +9,20 @@ from lnbits.core.crud import get_standalone_payment
|
||||||
|
|
||||||
from . import offlineshop_ext
|
from . import offlineshop_ext
|
||||||
from .crud import get_item, get_shop
|
from .crud import get_item, get_shop
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@offlineshop_ext.get("/")
|
@offlineshop_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("offlineshop/index.html", user=g.user)
|
return await templates.TemplateResponse("offlineshop/index.html", {"request": request,"user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@offlineshop_ext.get("/print")
|
@offlineshop_ext.get("/print")
|
||||||
async def print_qr_codes():
|
async def print_qr_codes(request: Request):
|
||||||
items = []
|
items = []
|
||||||
for item_id in request.args.get("items").split(","):
|
for item_id in request.args.get("items").split(","):
|
||||||
item = await get_item(item_id)
|
item = await get_item(item_id)
|
||||||
|
@ -32,7 +35,7 @@ async def print_qr_codes():
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return await render_template("offlineshop/print.html", items=items)
|
return await templates.TemplateResponse("offlineshop/print.html", {"request": request,"items":items})
|
||||||
|
|
||||||
|
|
||||||
@offlineshop_ext.get("/confirmation")
|
@offlineshop_ext.get("/confirmation")
|
||||||
|
|
|
@ -5,18 +5,21 @@ from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import paywall_ext
|
from . import paywall_ext
|
||||||
from .crud import get_paywall
|
from .crud import get_paywall
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@paywall_ext.route("/")
|
@paywall_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("paywall/index.html", user=g.user)
|
return await templates.TemplateResponse("paywall/index.html", {"request": request,"user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@paywall_ext.route("/<paywall_id>")
|
@paywall_ext.route("/<paywall_id>")
|
||||||
async def display(paywall_id):
|
async def display(request: Request, paywall_id):
|
||||||
paywall = await get_paywall(paywall_id) or abort(
|
paywall = await get_paywall(paywall_id) or abort(
|
||||||
HTTPStatus.NOT_FOUND, "Paywall does not exist."
|
HTTPStatus.NOT_FOUND, "Paywall does not exist."
|
||||||
)
|
)
|
||||||
return await render_template("paywall/display.html", paywall=paywall)
|
return await templates.TemplateResponse("paywall/display.html", {"request": request,"paywall":paywall})
|
||||||
|
|
|
@ -6,17 +6,21 @@ from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
from . import satspay_ext
|
from . import satspay_ext
|
||||||
from .crud import get_charge
|
from .crud import get_charge
|
||||||
|
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@satspay_ext.route("/")
|
@satspay_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("satspay/index.html", user=g.user)
|
return await templates.TemplateResponse("satspay/index.html", {"request":request, "user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@satspay_ext.route("/<charge_id>")
|
@satspay_ext.route("/<charge_id>")
|
||||||
async def display(charge_id):
|
async def display(request: Request, charge_id):
|
||||||
charge = await get_charge(charge_id) or abort(
|
charge = await get_charge(charge_id) or abort(
|
||||||
HTTPStatus.NOT_FOUND, "Charge link does not exist."
|
HTTPStatus.NOT_FOUND, "Charge link does not exist."
|
||||||
)
|
)
|
||||||
return await render_template("satspay/display.html", charge=charge)
|
return await templates.TemplateResponse("satspay/display.html", {"request":request, "charge":charge})
|
||||||
|
|
|
@ -3,10 +3,13 @@ from quart import g, render_template
|
||||||
from lnbits.decorators import check_user_exists, validate_uuids
|
from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import splitpayments_ext
|
from . import splitpayments_ext
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@splitpayments_ext.get("/")
|
@splitpayments_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("splitpayments/index.html", user=g.user)
|
return await templates.TemplateResponse("splitpayments/index.html", {"request":request, "user":g.user})
|
||||||
|
|
|
@ -5,24 +5,28 @@ from http import HTTPStatus
|
||||||
|
|
||||||
from . import streamalerts_ext
|
from . import streamalerts_ext
|
||||||
from .crud import get_service
|
from .crud import get_service
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@streamalerts_ext.get("/")
|
@streamalerts_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
"""Return the extension's settings page"""
|
"""Return the extension's settings page"""
|
||||||
return await render_template("streamalerts/index.html", user=g.user)
|
return await templates.TemplateResponse("streamalerts/index.html", {"request":request, "user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@streamalerts_ext.get("/<state>")
|
@streamalerts_ext.get("/<state>")
|
||||||
async def donation(state):
|
async def donation(request: Request, state):
|
||||||
"""Return the donation form for the Service corresponding to state"""
|
"""Return the donation form for the Service corresponding to state"""
|
||||||
service = await get_service(0, by_state=state)
|
service = await get_service(0, by_state=state)
|
||||||
if not service:
|
if not service:
|
||||||
abort(HTTPStatus.NOT_FOUND, "Service does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "Service does not exist.")
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"streamalerts/display.html",
|
"streamalerts/display.html",
|
||||||
twitchuser=service.twitchuser,
|
{"request":request,
|
||||||
service=service.id
|
"twitchuser":service.twitchuser,
|
||||||
|
"service":service.id}
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,17 +5,20 @@ from http import HTTPStatus
|
||||||
|
|
||||||
from . import subdomains_ext
|
from . import subdomains_ext
|
||||||
from .crud import get_domain
|
from .crud import get_domain
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@subdomains_ext.get("/")
|
@subdomains_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("subdomains/index.html", user=g.user)
|
return await templates.TemplateResponse("subdomains/index.html", {"request":request,"user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@subdomains_ext.get("/<domain_id>")
|
@subdomains_ext.get("/<domain_id>")
|
||||||
async def display(domain_id):
|
async def display(request: Request, domain_id):
|
||||||
domain = await get_domain(domain_id)
|
domain = await get_domain(domain_id)
|
||||||
if not domain:
|
if not domain:
|
||||||
abort(HTTPStatus.NOT_FOUND, "Domain does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "Domain does not exist.")
|
||||||
|
@ -23,11 +26,12 @@ async def display(domain_id):
|
||||||
domain.allowed_record_types.replace('"', "").replace(" ", "").split(",")
|
domain.allowed_record_types.replace('"', "").replace(" ", "").split(",")
|
||||||
)
|
)
|
||||||
print(allowed_records)
|
print(allowed_records)
|
||||||
return await render_template(
|
return await templates.TemplateResponse(
|
||||||
"subdomains/display.html",
|
"subdomains/display.html",
|
||||||
domain_id=domain.id,
|
{"request":request,
|
||||||
domain_domain=domain.domain,
|
"domain_id":domain.id,
|
||||||
domain_desc=domain.description,
|
"domain_domain":domain.domain,
|
||||||
domain_cost=domain.cost,
|
"domain_desc":domain.description,
|
||||||
domain_allowed_record_types=allowed_records,
|
"domain_cost":domain.cost,
|
||||||
|
"domain_allowed_record_types":allowed_records}
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,19 +5,22 @@ from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import tpos_ext
|
from . import tpos_ext
|
||||||
from .crud import get_tpos
|
from .crud import get_tpos
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@tpos_ext.get("/")
|
@tpos_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("tpos/index.html", user=g.user)
|
return await templates.TemplateResponse("tpos/index.html", {"request":request,"user":g.user})
|
||||||
|
|
||||||
|
|
||||||
@tpos_ext.get("/{tpos_id}")
|
@tpos_ext.get("/{tpos_id}")
|
||||||
async def tpos(tpos_id):
|
async def tpos(request: Request, tpos_id):
|
||||||
tpos = await get_tpos(tpos_id)
|
tpos = await get_tpos(tpos_id)
|
||||||
if not tpos:
|
if not tpos:
|
||||||
abort(HTTPStatus.NOT_FOUND, "TPoS does not exist.")
|
abort(HTTPStatus.NOT_FOUND, "TPoS does not exist.")
|
||||||
|
|
||||||
return await render_template("tpos/tpos.html", tpos=tpos)
|
return await templates.TemplateResponse("tpos/tpos.html", {"request":request,"tpos":tpos})
|
||||||
|
|
|
@ -3,10 +3,13 @@ from quart import g, render_template
|
||||||
from lnbits.decorators import check_user_exists, validate_uuids
|
from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import usermanager_ext
|
from . import usermanager_ext
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@usermanager_ext.get("/")
|
@usermanager_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("usermanager/index.html", user=g.user)
|
return await render_template("usermanager/index.html", {"request":request,"user":g.user})
|
||||||
|
|
|
@ -4,11 +4,14 @@ from http import HTTPStatus
|
||||||
from lnbits.decorators import check_user_exists, validate_uuids
|
from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import watchonly_ext
|
from . import watchonly_ext
|
||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.templating import Jinja2Templates
|
||||||
|
|
||||||
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
@watchonly_ext.get("/")
|
@watchonly_ext.get("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index(request: Request):
|
||||||
return await render_template("watchonly/index.html", user=g.user)
|
return await render_template("watchonly/index.html", {"request":request,"user":g.user})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue