2022-01-28 16:22:54 +00:00
|
|
|
import asyncio
|
|
|
|
|
|
|
|
from fastapi import APIRouter
|
|
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
|
2022-01-27 12:24:38 +00:00
|
|
|
from lnbits.db import Database
|
2022-01-28 16:22:54 +00:00
|
|
|
from lnbits.helpers import template_renderer
|
|
|
|
from lnbits.tasks import catch_everything_and_restart
|
2022-01-27 12:24:38 +00:00
|
|
|
|
|
|
|
db = Database("ext_diagonalley")
|
|
|
|
|
2022-01-28 16:22:54 +00:00
|
|
|
diagonalley_static_files = [
|
|
|
|
{
|
|
|
|
"path": "/diagonalley/static",
|
|
|
|
"app": StaticFiles(directory="lnbits/extensions/diagonalley/static"),
|
|
|
|
"name": "diagonalley_static",
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
diagonalley_ext: APIRouter = APIRouter(
|
|
|
|
prefix="/diagonalley", tags=["diagonalley"]
|
|
|
|
# "diagonalley", __name__, static_folder="static", template_folder="templates"
|
2022-01-27 12:24:38 +00:00
|
|
|
)
|
|
|
|
|
2022-01-28 16:22:54 +00:00
|
|
|
def diagonalley_renderer():
|
|
|
|
return template_renderer(["lnbits/extensions/diagonalley/templates"])
|
|
|
|
|
|
|
|
|
|
|
|
from .tasks import wait_for_paid_invoices
|
2022-01-27 12:24:38 +00:00
|
|
|
from .views import * # noqa
|
2022-01-28 16:22:54 +00:00
|
|
|
from .views_api import * # noqa
|
|
|
|
|
2022-01-27 12:24:38 +00:00
|
|
|
|
2022-01-28 16:22:54 +00:00
|
|
|
def diagonalley_start():
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|
2022-01-27 12:24:38 +00:00
|
|
|
|