nostrrelay/__init__.py
Tiago Vasconcelos 473614f8be
allow custom path (#17)
* allow custom path

---------

Co-authored-by: dni  <office@dnilabs.com>
2023-09-26 16:56:21 +02:00

44 lines
1 KiB
Python

import asyncio
from typing import List
from fastapi import APIRouter
from lnbits.db import Database
from lnbits.helpers import template_renderer
from lnbits.tasks import catch_everything_and_restart
db = Database("ext_nostrrelay")
nostrrelay_ext: APIRouter = APIRouter(prefix="/nostrrelay", tags=["NostrRelay"])
nostrrelay_static_files = [
{
"path": "/nostrrelay/static",
"name": "nostrrelay_static",
}
]
nostrrelay_redirect_paths = [
{
"from_path": "/",
"redirect_to_path": "/api/v1/relay-info",
"header_filters": {"accept": "application/nostr+json"},
}
]
scheduled_tasks: List[asyncio.Task] = []
def nostrrelay_renderer():
return template_renderer(["nostrrelay/templates"])
from .tasks import wait_for_paid_invoices
from .views import * # noqa
from .views_api import * # noqa
def nostrrelay_start():
loop = asyncio.get_event_loop()
task = loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
scheduled_tasks.append(task)