diff --git a/web.py b/web.py index e3c65e3..31060a8 100644 --- a/web.py +++ b/web.py @@ -1,5 +1,4 @@ from fastapi import FastAPI, HTTPException, WebSocket, WebSocketDisconnect, UploadFile, File -from fastapi.staticfiles import StaticFiles from pydantic import BaseModel from typing import List, Optional import asyncio @@ -11,8 +10,9 @@ import shutil from bot import bot from ytdl import YTDLSource -# Initialize FastAPI application -app = FastAPI(title="ŻyrarBOT Queue Controller") +# Initialize FastAPI application. +# The service exposes the API only - the web panel is a separate container. +app = FastAPI(title="ŻyrarBOT API") # FastAPI Request Models class PlayRequest(BaseModel): @@ -82,6 +82,20 @@ def get_active_guild(): return None # FastAPI Endpoints +@app.get("/") +async def root(): + """Service descriptor - the panel is served by its own container.""" + return { + "service": "zyrarbot-api", + "docs": "/docs", + "status": "/api/status", + "websocket": "/ws", + } + +@app.get("/api/health") +async def health(): + return {"status": "ok", "discord_ready": bot.is_ready()} + @app.get("/api/status") async def get_status(): music_cog = bot.get_cog("MusicBot") @@ -740,6 +754,3 @@ async def startup_event(): asyncio.create_task(wait_and_register_callback()) asyncio.create_task(status_broadcast_loop()) - -# Serve UI Files (Must be registered after API routes) -app.mount("/", StaticFiles(directory="static", html=True), name="static")