diff --git a/core/dashboard/routes.py b/core/dashboard/routes.py index 4de5401..7e1ccbc 100644 --- a/core/dashboard/routes.py +++ b/core/dashboard/routes.py @@ -395,8 +395,8 @@ async def get_recent_activity(limit: int = 10) -> list: audit_logger = get_audit_logger() - # Read recent entries from audit log - entries = audit_logger.get_recent_entries(limit=limit) + # Fetch extra entries because we filter some out + entries = audit_logger.get_recent_entries(limit=limit * 3) for entry in entries: # Skip internal/noise events @@ -404,16 +404,22 @@ async def get_recent_activity(limit: int = 10) -> list: if evt in ("health_metric_recorded", "health_check"): continue + project = (entry.get("metadata") or {}).get("project_id") or "-" + activity.append( { "timestamp": entry.get("timestamp") or "", "type": evt or "unknown", "message": entry.get("message") or "", - "project": (entry.get("metadata") or {}).get("project_id", "-"), + "project": project if project != "None" else "-", "level": entry.get("level") or "INFO", } ) + # Stop once we have enough + if len(activity) >= limit: + break + except Exception as e: logger.warning(f"Error getting recent activity: {e}") diff --git a/core/health.py b/core/health.py index 7c01455..ebc206e 100644 --- a/core/health.py +++ b/core/health.py @@ -553,12 +553,36 @@ class HealthMonitor: plugin_instance = plugin_registry.create_instance(plugin_type, site_id, config_dict) return await plugin_instance.health_check() except Exception as e: - logger.debug( + logger.warning( f"Could not create plugin instance for {project_id}, " - f"falling back to basic HTTP check: {e}" + f"falling back to authenticated HTTP check: {e}" ) - # Fallback: basic HTTP check if plugin instantiation fails + # Fallback: authenticated health check for WordPress-based plugins + if plugin_type in ("wordpress", "wordpress_advanced", "woocommerce"): + try: + import aiohttp + + auth = aiohttp.BasicAuth( + config.username or "", + config.app_password or "", + ) + async with aiohttp.ClientSession(auth=auth) as session: + async with session.get( + f"{config.url}/wp-json/wp/v2/users/me", + timeout=aiohttp.ClientTimeout(total=10), + ssl=False, + ) as resp: + auth_valid = resp.status == 200 + basic_result = await self._basic_http_health_check(config.url, project_id) + basic_result["auth_valid"] = auth_valid + if not auth_valid: + basic_result["auth_warning"] = "Site accessible but credentials may be invalid" + return basic_result + except Exception: + pass + + # Last resort: basic HTTP check return await self._basic_http_health_check(config.url, project_id) async def _basic_http_health_check(self, url: str | None, project_id: str) -> dict[str, Any]: diff --git a/core/templates/dashboard/index.html b/core/templates/dashboard/index.html index b465d87..8bf0981 100644 --- a/core/templates/dashboard/index.html +++ b/core/templates/dashboard/index.html @@ -137,7 +137,7 @@
{{ activity.message }}
-{{ activity.project }}
+{{ activity.project if activity.project and activity.project != 'None' else '-' }}