feat: extracted
This commit is contained in:
parent
462770be40
commit
4b82905f78
12 changed files with 573 additions and 0 deletions
32
views.py
Normal file
32
views.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
from http import HTTPStatus
|
||||
|
||||
from fastapi import Depends, Request
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from starlette.exceptions import HTTPException
|
||||
from starlette.responses import HTMLResponse
|
||||
|
||||
from lnbits.core.models import User
|
||||
from lnbits.decorators import check_user_exists
|
||||
|
||||
from . import nostrrelay_ext, nostrrelay_renderer
|
||||
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
|
||||
|
||||
@nostrrelay_ext.get("/", response_class=HTMLResponse)
|
||||
async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||
return nostrrelay_renderer().TemplateResponse(
|
||||
"nostrrelay/index.html", {"request": request, "user": user.dict()}
|
||||
)
|
||||
|
||||
|
||||
@nostrrelay_ext.get("/public")
|
||||
async def nostrrelay(request: Request, nostrrelay_id):
|
||||
return nostrrelay_renderer().TemplateResponse(
|
||||
"nostrrelay/public.html",
|
||||
{
|
||||
"request": request,
|
||||
# "nostrrelay": relay,
|
||||
"web_manifest": f"/nostrrelay/manifest/{nostrrelay_id}.webmanifest",
|
||||
},
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue