diff --git a/scoreboard_injector/main.py b/scoreboard_injector/main.py index cf2f188..2e56789 100644 --- a/scoreboard_injector/main.py +++ b/scoreboard_injector/main.py @@ -194,20 +194,26 @@ async def http_polling_listener(): while True: try: async with aiohttp.ClientSession() as session: - # ForcAD API endpoints for actual attack/flag data (not attack_data which is exploit credentials) - # Try different possible paths + # ForcAD real API endpoints (not Vue.js router paths) + # These should be accessed without /api prefix or with different structure + base_url = SCOREBOARD_API_URL.rstrip('/api').rstrip('/') + endpoints_to_try = [ - ('/api/flag/submit', 'GET'), # Flag submission history - ('/api/client/stolen_flags', 'GET'), # Stolen flags - ('/api/client/flag_stats', 'GET'), # Flag statistics - ('/api/game/status', 'GET'), # Game status with flags - ('/api/service/status', 'GET'), # Service status + # Try direct API access patterns + (f'{base_url}/flags', 'GET'), + (f'{base_url}/stolen_flags', 'GET'), + (f'{base_url}/flag_stats', 'GET'), + (f'{base_url}/game_state', 'GET'), + (f'{base_url}/scoreboard', 'GET'), + # Try with /api/ prefix variations + (f'{base_url}/api/flags/', 'GET'), + (f'{base_url}/api/stolen_flags/', 'GET'), + (f'{base_url}/api/game_state/', 'GET'), ] data_found = False - for endpoint_path, method in endpoints_to_try: - endpoint = f"{SCOREBOARD_API_URL.rstrip('/api')}{endpoint_path}" + for endpoint, method in endpoints_to_try: try: async with session.get(endpoint, timeout=aiohttp.ClientTimeout(total=5)) as resp: if resp.status == 200: @@ -525,29 +531,28 @@ async def debug_scoreboard(): results["websocket_status"] = f"unreachable: {str(e)}" # Test HTTP endpoints - both HTML and API paths - base_url = SCOREBOARD_API_URL.rstrip('/api') + base_url = SCOREBOARD_API_URL.rstrip('/api').rstrip('/') endpoints = [ - "/api/flag/submit", - "/api/client/stolen_flags", - "/api/client/flag_stats", - "/api/game/status", - "/api/service/status", - "/api/attacks", - "/api/scoreboard", - "/api/teams", - "/api/events" + f"{base_url}/flags", + f"{base_url}/stolen_flags", + f"{base_url}/flag_stats", + f"{base_url}/game_state", + f"{base_url}/scoreboard", + f"{base_url}/api/flags/", + f"{base_url}/api/stolen_flags/", + f"{base_url}/api/game_state/", + f"{base_url}/api/client/attack_data", ] for endpoint in endpoints: - url = f"{base_url}{endpoint}" try: - async with session.get(url, timeout=aiohttp.ClientTimeout(total=5)) as resp: + async with session.get(endpoint, timeout=aiohttp.ClientTimeout(total=5)) as resp: content_type = resp.headers.get('Content-Type', '') is_json = 'application/json' in content_type is_html = 'text/html' in content_type result = { - "url": url, + "url": endpoint, "status": resp.status, "reachable": resp.status == 200, "content_type": content_type, @@ -571,7 +576,7 @@ async def debug_scoreboard(): except Exception as e: results["endpoints_tested"].append({ - "url": url, + "url": endpoint, "reachable": False, "error": str(e) })