chore: code clean-up
This commit is contained in:
parent
babb58e7e9
commit
cd1e830947
3 changed files with 5 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import time
|
import time
|
||||||
from typing import *
|
from typing import List
|
||||||
|
|
||||||
from ..relay_manager import RelayManager
|
from ..relay_manager import RelayManager
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ class NostrRouter:
|
||||||
return
|
return
|
||||||
|
|
||||||
if json_data[0] == "CLOSE":
|
if json_data[0] == "CLOSE":
|
||||||
self.handle_client_close(json_data[1])
|
self._handle_client_close(json_data[1])
|
||||||
return
|
return
|
||||||
|
|
||||||
if json_data[0] == "EVENT":
|
if json_data[0] == "EVENT":
|
||||||
|
|
@ -180,7 +180,7 @@ class NostrRouter:
|
||||||
self.subscriptions.append(subscription_id_rewritten)
|
self.subscriptions.append(subscription_id_rewritten)
|
||||||
nostr.client.relay_manager.publish_message(request_rewritten)
|
nostr.client.relay_manager.publish_message(request_rewritten)
|
||||||
|
|
||||||
def handle_client_close(self, subscription_id):
|
def _handle_client_close(self, subscription_id):
|
||||||
subscription_id_rewritten = next((k for k, v in self.original_subscription_ids.items() if v == subscription_id), None)
|
subscription_id_rewritten = next((k for k, v in self.original_subscription_ids.items() if v == subscription_id), None)
|
||||||
if subscription_id_rewritten:
|
if subscription_id_rewritten:
|
||||||
nostr.client.relay_manager.close_subscription(subscription_id_rewritten)
|
nostr.client.relay_manager.close_subscription(subscription_id_rewritten)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from typing import List, Optional
|
from typing import Optional
|
||||||
|
|
||||||
from fastapi import Depends, WebSocket
|
from fastapi import Depends, WebSocket
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
@ -14,7 +14,6 @@ from .crud import add_relay, delete_relay, get_relays
|
||||||
from .helpers import normalize_public_key
|
from .helpers import normalize_public_key
|
||||||
from .models import Relay, RelayList, TestMessage, TestMessageResponse
|
from .models import Relay, RelayList, TestMessage, TestMessageResponse
|
||||||
from .nostr.key import EncryptedDirectMessage, PrivateKey
|
from .nostr.key import EncryptedDirectMessage, PrivateKey
|
||||||
from .nostr.relay import Relay as NostrRelay
|
|
||||||
from .services import NostrRouter, nostr
|
from .services import NostrRouter, nostr
|
||||||
|
|
||||||
# we keep this in
|
# we keep this in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue