parent
1378ac993d
commit
3e677afebc
1 changed files with 32 additions and 0 deletions
32
app/main.py
32
app/main.py
|
@ -12,6 +12,7 @@ from fastapi import Response
|
|||
from fastapi.exceptions import HTTPException
|
||||
from sqlalchemy.util import monkeypatch_proxied_specials
|
||||
from starlette.responses import JSONResponse
|
||||
from typing import Any
|
||||
|
||||
from loguru import logger
|
||||
|
||||
|
@ -86,3 +87,34 @@ async def wellknown_webfinger(resource: str) -> JSONResponse:
|
|||
media_type="application/jrd+json; charset=utf-8",
|
||||
headers={"Access-Control-Allow-Origin": "*"},
|
||||
)
|
||||
|
||||
@app.get("/.well-known/nodeinfo")
|
||||
async def well_known_nodeinfo() -> dict[str, Any]:
|
||||
return {
|
||||
"links": [
|
||||
{
|
||||
"rel": "http://nodeinfo.diaspora.software/ns/schema/2.0",
|
||||
"href": f"{BASE_URL}/nodeinfo/2.0",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@app.get("/nodeinfo/2.0")
|
||||
async def nodeinfo(
|
||||
db_session: AsyncSession = Depends(get_db_session),
|
||||
):
|
||||
return JSONResponse(
|
||||
{
|
||||
"version": "2.0",
|
||||
"software": {
|
||||
"name": "foxhole",
|
||||
"version": "0.0.1",
|
||||
},
|
||||
"protocols": ["activitypub"],
|
||||
"services": {"inbound": [], "outbound": []},
|
||||
"usage": {"users": {"total": 1}, "localPosts": 0}, #TODO
|
||||
"openRegistrations": False,
|
||||
"metadata": {},
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue