SyncAPI/sync_api.py

25 lines
913 B
Python

from os import makedirs, path
from modules.app import app
from modules.utils import configGet
from modules.extensions_loader import dynamic_import_from_src
from fastapi.responses import FileResponse
makedirs(configGet("data", "locations"), exist_ok=True)
for entry in [path.join(configGet("data", "locations"), "api_keys.json"), path.join(configGet("data", "locations"), "expired_keys.json")]:
mode = 'r' if path.exists(entry) else 'w'
with open(entry, mode) as f:
try:
f.write("[]")
except:
pass
@app.get("/favicon.ico", response_class=FileResponse, include_in_schema=False)
async def favicon():
return FileResponse("favicon.ico")
#=================================================================================
dynamic_import_from_src("extensions", star_import = True)
#=================================================================================