fix: revert NostrClientManagerinit place
This commit is contained in:
parent
43dc3e85ce
commit
5339dde64a
2 changed files with 5 additions and 4 deletions
|
|
@ -22,12 +22,11 @@ def nostrrelay_renderer():
|
||||||
return template_renderer(["lnbits/extensions/nostrrelay/templates"])
|
return template_renderer(["lnbits/extensions/nostrrelay/templates"])
|
||||||
|
|
||||||
|
|
||||||
from .client_manager import NostrClientManager
|
|
||||||
from .models import NostrRelay
|
from .models import NostrRelay
|
||||||
from .views import * # noqa
|
from .views import * # noqa
|
||||||
from .views_api import * # noqa
|
from .views_api import * # noqa
|
||||||
|
|
||||||
client_manager = NostrClientManager()
|
|
||||||
|
|
||||||
settings.lnbits_relay_information = {
|
settings.lnbits_relay_information = {
|
||||||
"name": "LNbits Nostr Relay",
|
"name": "LNbits Nostr Relay",
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ from lnbits.decorators import (
|
||||||
from lnbits.helpers import urlsafe_short_hash
|
from lnbits.helpers import urlsafe_short_hash
|
||||||
|
|
||||||
from . import client_manager, nostrrelay_ext
|
from . import client_manager, nostrrelay_ext
|
||||||
from .client_manager import NostrClientConnection
|
from .client_manager import NostrClientConnection, NostrClientManager
|
||||||
from .crud import (
|
from .crud import (
|
||||||
create_relay,
|
create_relay,
|
||||||
delete_all_events,
|
delete_all_events,
|
||||||
|
|
@ -28,11 +28,13 @@ from .crud import (
|
||||||
)
|
)
|
||||||
from .models import NostrRelay
|
from .models import NostrRelay
|
||||||
|
|
||||||
|
client_manager = NostrClientManager()
|
||||||
|
|
||||||
@nostrrelay_ext.websocket("/{relay_id}")
|
@nostrrelay_ext.websocket("/{relay_id}")
|
||||||
async def websocket_endpoint(relay_id: str, websocket: WebSocket):
|
async def websocket_endpoint(relay_id: str, websocket: WebSocket):
|
||||||
client = NostrClientConnection(relay_id=relay_id, websocket=websocket)
|
client = NostrClientConnection(relay_id=relay_id, websocket=websocket)
|
||||||
if not (await client_manager.add_client(client)):
|
client_accepted = await client_manager.add_client(client)
|
||||||
|
if not client_accepted:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue