Fix UniFi OS authentication and simplify server architecture
All checks were successful
Build and Push Docker Image / build (push) Successful in 15s
All checks were successful
Build and Push Docker Image / build (push) Successful in 15s
- Use /api/auth/login for UniFi OS controllers (UDM, Cloud Gateway) - Use /api/login for standalone controllers - Refactor to use FastMCP's native mcp.run() with custom_route for /health - Switch to network_mode: host for local network access - Include README.md in Dockerfile for hatchling build
This commit is contained in:
@@ -158,8 +158,17 @@ class UnifiClient:
|
||||
logger.warning("Controller type detection failed, defaulting to UniFi OS")
|
||||
|
||||
async def _authenticate(self) -> None:
|
||||
"""Authenticate with the UniFi controller."""
|
||||
login_url = f"{self.base_url}{self.api_prefix}/api/login"
|
||||
"""Authenticate with the UniFi controller.
|
||||
|
||||
UniFi OS (UDM, Cloud Gateway) uses /api/auth/login
|
||||
Standalone controllers use /api/login
|
||||
"""
|
||||
if self._is_unifi_os:
|
||||
# UniFi OS uses a different auth endpoint (no api_prefix needed)
|
||||
login_url = f"{self.base_url}/api/auth/login"
|
||||
else:
|
||||
# Standalone controller
|
||||
login_url = f"{self.base_url}/api/login"
|
||||
|
||||
payload = {
|
||||
"username": self.username,
|
||||
|
||||
Reference in New Issue
Block a user