-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviews.py
63 lines (54 loc) · 2 KB
/
views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse
from lnbits.core.models import User
from lnbits.decorators import check_user_exists
from lnbits.helpers import template_renderer
from lnbits.settings import settings
where39_generic_router: APIRouter = APIRouter()
def where39_renderer():
return template_renderer(["where39/templates"])
@where39_generic_router.get("/", response_class=HTMLResponse)
async def index(request: Request, user: User = Depends(check_user_exists)):
return where39_renderer().TemplateResponse(
"where39/index.html", {"request": request, "user": user.json()}
)
@where39_generic_router.get("/shared")
async def where39(request: Request):
return where39_renderer().TemplateResponse(
"where39/where39.html",
{
"request": request,
"web_manifest": "/where39/manifest/shared.webmanifest",
},
)
@where39_generic_router.get("/manifest/shared.webmanifest")
async def manifest():
return {
"short_name": settings.lnbits_site_title,
"name": "Where39 - " + settings.lnbits_site_title,
"icons": [
{
"src": (
settings.lnbits_custom_logo
if settings.lnbits_custom_logo
else "https://cdn.jsdelivr.net/gh/lnbits/[email protected]/docs/logos/lnbits.png"
),
"type": "image/png",
"sizes": "900x900",
}
],
"start_url": "/where39/shared",
"background_color": "#1F2234",
"description": "For dead drops and treasure hunts.",
"display": "standalone",
"scope": "/where39/shared",
"theme_color": "#1F2234",
"shortcuts": [
{
"name": "Where39 - " + settings.lnbits_site_title,
"short_name": "Where39",
"description": "Where39 - " + settings.lnbits_site_title,
"url": "/where39/shared",
}
],
}