""" Servicio local del worker (puerto 5001), lo arranca el agente. Solo responde si el worker de este equipo está prendido: la app de escritorio lo usa para mostrar el aviso del worker local. No carga la API completa, así que no necesita credenciales de producción. Las demás rutas que la app prueba acá (/songs/status) devuelven 404 y la app sigue con la nube. """ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware app = FastAPI(title="Melodix Worker local") app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["GET"], allow_headers=["*"]) @app.get("/health") def health(): version = None try: import os ruta = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "version.txt") with open(ruta, encoding="utf-8") as f: version = f.read().strip() except Exception: pass return {"status": "ok", "worker": True, "version": version}