refactor: extract relay_info_response
This commit is contained in:
parent
2d4e836676
commit
729f36e993
2 changed files with 15 additions and 9 deletions
12
helpers.py
12
helpers.py
|
|
@ -1,6 +1,7 @@
|
|||
from urllib.parse import urlparse
|
||||
|
||||
from bech32 import bech32_decode, convertbits
|
||||
from starlette.responses import JSONResponse
|
||||
|
||||
|
||||
def normalize_public_key(pubkey: str) -> str:
|
||||
|
|
@ -23,3 +24,14 @@ def normalize_public_key(pubkey: str) -> str:
|
|||
|
||||
def extract_domain(url: str) -> str:
|
||||
return urlparse(url).netloc
|
||||
|
||||
|
||||
def relay_info_response(relay_public_data: dict) -> JSONResponse:
|
||||
return JSONResponse(
|
||||
content=relay_public_data,
|
||||
headers={
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "GET",
|
||||
},
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue