fix: correct wallpaper directory path in settings.py

- Path(__file__) is server/api/settings.py, so:
  .parent → api/  .parent → server/  .parent → Nexus/ (ROOT)
  .parent → (above ROOT — wrong!)
- Changed from .parent.parent.parent to .parent.parent.parent.parent
  to reach the project root, then into web/app/wallpapers/
- Moved _WALLPAPER_DIR.mkdir into the async function body

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-05-31 20:34:27 +08:00
parent d0308aaef6
commit afd32118b2
+3 -2
View File
@@ -1265,8 +1265,7 @@ def _retry_to_dict(job: PushRetryJob) -> dict:
# ── Bing Daily Wallpaper — download + cache to disk ──
_WALLPAPER_DIR = Path(__file__).resolve().parent.parent.parent / "web" / "app" / "wallpapers"
_WALLPAPER_DIR.mkdir(parents=True, exist_ok=True)
_WALLPAPER_DIR = Path(__file__).resolve().parent.parent.parent.parent / "web" / "app" / "wallpapers"
@router.get("/bing-wallpaper", response_model=dict)
async def bing_wallpaper():
@@ -1278,6 +1277,8 @@ async def bing_wallpaper():
import httpx
from datetime import datetime, timedelta
_WALLPAPER_DIR.mkdir(parents=True, exist_ok=True)
today = datetime.utcnow().strftime("%Y-%m-%d")
cached = _WALLPAPER_DIR / f"{today}.jpg"