2023-01-06 14:37:49 +00:00
|
|
|
import asyncio
|
2022-06-01 12:53:47 +01:00
|
|
|
from fastapi import APIRouter
|
2023-01-06 10:57:15 +00:00
|
|
|
from fastapi.staticfiles import StaticFiles
|
2022-06-01 12:53:47 +01:00
|
|
|
|
|
|
|
from lnbits.db import Database
|
|
|
|
from lnbits.helpers import template_renderer
|
2023-01-06 14:37:49 +00:00
|
|
|
from lnbits.tasks import catch_everything_and_restart
|
2022-06-01 12:53:47 +01:00
|
|
|
|
|
|
|
db = Database("ext_example")
|
|
|
|
|
2022-06-01 14:53:05 +02:00
|
|
|
example_ext: APIRouter = APIRouter(prefix="/example", tags=["example"])
|
2022-06-01 12:53:47 +01:00
|
|
|
|
2023-01-06 10:57:15 +00:00
|
|
|
example_static_files = [
|
|
|
|
{
|
|
|
|
"path": "/example/static",
|
|
|
|
"app": StaticFiles(packages=[("lnbits", "extensions/example/static")]),
|
|
|
|
"name": "example_static",
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2022-06-01 12:53:47 +01:00
|
|
|
|
|
|
|
def example_renderer():
|
|
|
|
return template_renderer(["lnbits/extensions/example/templates"])
|
|
|
|
|
2023-01-06 14:37:49 +00:00
|
|
|
from .tasks import wait_for_paid_invoices
|
|
|
|
from .views import *
|
|
|
|
from .views_api import *
|
2022-06-01 12:53:47 +01:00
|
|
|
|
2023-01-06 14:37:49 +00:00
|
|
|
def tpos_start():
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|