14 lines
662 B
Python
14 lines
662 B
Python
|
from os import path, sep
|
||
|
from fastapi import FastAPI, HTTPException
|
||
|
from fastapi.responses import FileResponse
|
||
|
from starlette.status import HTTP_404_NOT_FOUND
|
||
|
from modules.utils import configGet
|
||
|
|
||
|
app = FastAPI(title="HoloUA Avatars API", docs_url=None, redoc_url=None, version="1.0")
|
||
|
|
||
|
@app.get("/", response_class=FileResponse, include_in_schema=False)
|
||
|
async def favicon(avatar_id: str):
|
||
|
if path.exists(f'{configGet("cache", "locations")}{sep}avatars{sep}{avatar_id}'):
|
||
|
return FileResponse(f'{configGet("cache", "locations")}{sep}avatars{sep}{avatar_id}')
|
||
|
else:
|
||
|
raise HTTPException(status_code=HTTP_404_NOT_FOUND, detail="File not found")
|