db wrong name

This commit is contained in:
arcbtc 2023-12-28 17:22:54 +00:00
parent 7b5a2a1e54
commit ea75373532
12 changed files with 9 additions and 12 deletions

View file

@ -1,13 +1,10 @@
import asyncio import asyncio
from fastapi import APIRouter, Request, Response from fastapi import APIRouter
from fastapi.routing import APIRoute
from lnbits.db import Database from lnbits.db import Database
from lnbits.helpers import template_renderer from lnbits.helpers import template_renderer
from lnbits.tasks import catch_everything_and_restart from lnbits.tasks import catch_everything_and_restart
from typing import Callable
from fastapi.responses import JSONResponse
db = Database("ext_tempextension") db = Database("ext_tempextension")
@ -22,7 +19,7 @@ temp_static_files = [
} }
] ]
def template_renderer(): def temp_renderer():
return template_renderer(["temp/templates"]) return template_renderer(["temp/templates"])
from .lnurl import * from .lnurl import *

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,7 +1,7 @@
{ {
"name": "Temp", "name": "Temp",
"short_description": "Minimal extension to build on", "short_description": "Minimal extension to build on",
"tile": "/tempextension/static/image/temp.png", "tile": "/temp/static/image/temp.png",
"contributors": ["arcbtc"], "contributors": ["arcbtc"],
"min_lnbits_version": "0.0.1" "min_lnbits_version": "0.0.1"
} }

View file

@ -6,7 +6,7 @@ async def m001_initial(db):
""" """
await db.execute( await db.execute(
""" """
CREATE TABLE tempextension.tempextension ( CREATE TABLE tempextension.temp (
id TEXT PRIMARY KEY, id TEXT PRIMARY KEY,
wallet TEXT NOT NULL, wallet TEXT NOT NULL,
name TEXT NOT NULL, name TEXT NOT NULL,
@ -24,6 +24,6 @@ async def m002_addtip_wallet(db):
""" """
await db.execute( await db.execute(
""" """
ALTER TABLE tempextension.tempextension ADD lnurlwithdrawamount INTEGER DEFAULT 0; ALTER TABLE tempextension.temp ADD lnurlwithdrawamount INTEGER DEFAULT 0;
""" """
) )

View file

@ -9,7 +9,7 @@ from lnbits.core.models import User
from lnbits.decorators import check_user_exists from lnbits.decorators import check_user_exists
from lnbits.settings import settings from lnbits.settings import settings
from . import temp_ext, template_renderer from . import temp_ext, temp_renderer
from .crud import get_temp from .crud import get_temp
temps = Jinja2Templates(directory="temps") temps = Jinja2Templates(directory="temps")
@ -24,7 +24,7 @@ temps = Jinja2Templates(directory="temps")
@temp_ext.get("/", response_class=HTMLResponse) @temp_ext.get("/", response_class=HTMLResponse)
async def index(request: Request, user: User = Depends(check_user_exists)): async def index(request: Request, user: User = Depends(check_user_exists)):
return template_renderer().TempResponse( return temp_renderer().TemplateResponse(
"temp/index.html", {"request": request, "user": user.dict()} "temp/index.html", {"request": request, "user": user.dict()}
) )
@ -38,7 +38,7 @@ async def temp(request: Request, temp_id):
raise HTTPException( raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="Temp does not exist." status_code=HTTPStatus.NOT_FOUND, detail="Temp does not exist."
) )
return template_renderer().TempResponse( return temp_renderer().TemplateResponse(
"temp/temp.html", "temp/temp.html",
{ {
"request": request, "request": request,
@ -85,4 +85,4 @@ async def manifest(temp_id: str):
"url": "/temp/" + temp_id, "url": "/temp/" + temp_id,
} }
], ],
} }