Created /check for UptimeRobot pinger

This commit is contained in:
Profitroll 2022-11-04 13:05:14 +01:00
parent 9a8d915166
commit 359f08c021

View File

@ -1,11 +1,15 @@
from os import path, sep from os import path, sep
from fastapi import FastAPI, HTTPException from fastapi import FastAPI, HTTPException
from fastapi.responses import FileResponse from fastapi.responses import FileResponse, JSONResponse
from starlette.status import HTTP_404_NOT_FOUND from starlette.status import HTTP_404_NOT_FOUND
from modules.utils import configGet from modules.utils import configGet
app = FastAPI(title="HoloUA Avatars API", docs_url=None, redoc_url=None, version="1.0") app = FastAPI(title="HoloUA Avatars API", docs_url=None, redoc_url=None, version="1.0")
@app.get("/check", response_class=JSONResponse, include_in_schema=False)
async def check():
return JSONResponse({"detail": "I'm alright, thank you"})
@app.get("/", response_class=FileResponse, include_in_schema=False) @app.get("/", response_class=FileResponse, include_in_schema=False)
async def favicon(avatar_id: str): async def favicon(avatar_id: str):
if path.exists(f'{configGet("cache", "locations")}{sep}avatars{sep}{avatar_id}'): if path.exists(f'{configGet("cache", "locations")}{sep}avatars{sep}{avatar_id}'):