lnbits-legend/lnbits/extensions/nostradmin/views.py

26 lines
813 B
Python
Raw Normal View History

2022-02-07 13:22:43 +00:00
from http import HTTPStatus
from fastapi import Request
from fastapi.param_functions import Query
from fastapi.params import Depends
from fastapi.templating import Jinja2Templates
from starlette.exceptions import HTTPException
from starlette.responses import HTMLResponse
2022-02-08 13:13:36 +00:00
from . import nostradmin_ext, nostr_renderer
2022-02-07 13:22:43 +00:00
from lnbits.core.crud import update_payment_status
from lnbits.core.models import User
from lnbits.core.views.api import api_payment
from lnbits.decorators import check_user_exists
2022-02-08 13:13:36 +00:00
2022-02-07 13:22:43 +00:00
templates = Jinja2Templates(directory="templates")
2022-02-08 13:13:36 +00:00
@nostradmin_ext.get("/", response_class=HTMLResponse)
2022-02-07 13:22:43 +00:00
async def index(request: Request, user: User = Depends(check_user_exists)):
return nostr_renderer().TemplateResponse(
2022-02-08 10:35:20 +00:00
"nostradmin/index.html", {"request": request, "user": user.dict()}
2022-02-07 13:22:43 +00:00
)