Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit a2faf48

Browse files
feat(back): add about.json
Co-authored-by: Ciznia <gabriel.hosquet@epitech.eu>
1 parent 2ae0a7f commit a2faf48

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

back/app/routes/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
routers = []
66
providers = (
7+
"about",
78
"auth",
89
"hello",
910
"workflow",

back/app/routes/about.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from fastapi import APIRouter, Request
2+
from fastapi.responses import JSONResponse
3+
4+
from .oauth_base import OAuthProvider
5+
import time
6+
7+
router = APIRouter(prefix="")
8+
9+
10+
@router.get("/about.json")
11+
async def about_json(request: Request):
12+
client = request.client
13+
client_ip = client.host if client else "unknown"
14+
services = OAuthProvider.services.keys()
15+
return JSONResponse(
16+
{
17+
"client": {
18+
"host": client_ip,
19+
},
20+
"server": {
21+
"current_time": int(time.time()),
22+
"services": [
23+
{
24+
"name": service_name,
25+
"actions": [
26+
],
27+
"reactions": [
28+
],
29+
} for service_name in services
30+
]
31+
},
32+
}
33+
)

0 commit comments

Comments
 (0)