feat: partial NIP11
This commit is contained in:
parent
9b9e2623be
commit
cbbabf2ce8
2 changed files with 23 additions and 0 deletions
13
views_api.py
13
views_api.py
|
|
@ -1,10 +1,12 @@
|
|||
from http import HTTPStatus
|
||||
|
||||
from fastapi import Query, WebSocket
|
||||
from fastapi.responses import JSONResponse
|
||||
from loguru import logger
|
||||
|
||||
from . import nostrrelay_ext
|
||||
from .client_manager import NostrClientConnection, NostrClientManager
|
||||
from .models import NostrRelayInfo
|
||||
|
||||
client_manager = NostrClientManager()
|
||||
|
||||
|
|
@ -20,6 +22,17 @@ async def websocket_endpoint(websocket: WebSocket):
|
|||
client_manager.remove_client(client)
|
||||
|
||||
|
||||
@nostrrelay_ext.get("/client", status_code=HTTPStatus.OK)
|
||||
async def api_nostrrelay_info():
|
||||
headers = {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "GET"
|
||||
}
|
||||
info = NostrRelayInfo()
|
||||
return JSONResponse(content=dict(info), headers=headers)
|
||||
|
||||
|
||||
@nostrrelay_ext.get("/api/v1/enable", status_code=HTTPStatus.OK)
|
||||
async def api_nostrrelay(enable: bool = Query(True)):
|
||||
return await enable_relay(enable)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue