diff --git a/dashboard/backend/main.py b/dashboard/backend/main.py index 52bea23..ace0fc9 100644 --- a/dashboard/backend/main.py +++ b/dashboard/backend/main.py @@ -28,7 +28,8 @@ async def monitor_containers(): msg = f"⚠️ *Container Alert* ⚠️\nContainer `{c.name}` just stopped unexpectedly (Status: {current_status})." # Use httpx directly as system.send_notification expects a FastAPI request object usually if TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID: - async with httpx.AsyncClient() as hc: + proxy_url = os.environ.get("HTTP_PROXY") or os.environ.get("http_proxy") + async with httpx.AsyncClient(proxy=proxy_url) as hc: await hc.post( f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage", data={"chat_id": TELEGRAM_CHAT_ID, "text": msg, "parse_mode": "Markdown"}, diff --git a/dashboard/backend/routers/system.py b/dashboard/backend/routers/system.py index 0539b5d..f629054 100644 --- a/dashboard/backend/routers/system.py +++ b/dashboard/backend/routers/system.py @@ -16,7 +16,8 @@ async def send_notification(body: dict): msg = body.get("message", "") if not msg or not TELEGRAM_BOT_TOKEN or not TELEGRAM_CHAT_ID: return {"ok": False, "error": "missing message or Telegram config"} - async with httpx.AsyncClient() as client: + proxy_url = os.environ.get("HTTP_PROXY") or os.environ.get("http_proxy") + async with httpx.AsyncClient(proxy=proxy_url) as client: r = await client.post( f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage", data={"chat_id": TELEGRAM_CHAT_ID, "text": msg, "parse_mode": "Markdown"}, diff --git a/dashboard/docker-compose.yml b/dashboard/docker-compose.yml index a09d50f..71e5472 100644 --- a/dashboard/docker-compose.yml +++ b/dashboard/docker-compose.yml @@ -36,6 +36,8 @@ services: - VPS_SSH_USER=jimmyg - TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN:-} - TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID:-} + - HTTP_PROXY=${HTTP_PROXY:-} + - HTTPS_PROXY=${HTTPS_PROXY:-} volumes: - /volume1:/volume1 - /volume1/docker/nas-dashboard/ssh/dashboard_terminal:/app/ssh/id_ed25519:ro