mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-11-29 07:35:10 +08:00
fix: mount bug.
This commit is contained in:
@@ -36,7 +36,12 @@ def create_app() -> FastAPI:
|
||||
|
||||
|
||||
app = create_app()
|
||||
app.mount("/posters", StaticFiles(directory="data/posters"), name="posters")
|
||||
|
||||
|
||||
@app.get("/posters/{path:path}", tags=["posters"])
|
||||
def posters(path: str):
|
||||
return FileResponse(f"data/posters/{path}")
|
||||
|
||||
|
||||
if VERSION != "DEV_VERSION":
|
||||
app.mount("/assets", StaticFiles(directory="dist/assets"), name="assets")
|
||||
@@ -63,7 +68,6 @@ if __name__ == "__main__":
|
||||
host = "::"
|
||||
else:
|
||||
host = os.getenv("HOST", "0.0.0.0")
|
||||
os.mkdir("data/posters") if not os.path.exists("data/posters") else None
|
||||
uvicorn.run(
|
||||
app,
|
||||
host=host,
|
||||
|
||||
@@ -79,7 +79,8 @@ class Checker:
|
||||
def check_img_cache() -> bool:
|
||||
img_path = Path("data/posters")
|
||||
# If poster folder is not empty, return True
|
||||
if list(img_path.glob("*")):
|
||||
if img_path.exists():
|
||||
return True
|
||||
else:
|
||||
img_path.mkdir()
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user