From 1736779d69785af2d63daf811d89f058be233440 Mon Sep 17 00:00:00 2001 From: airano Date: Tue, 24 Feb 2026 07:16:05 +0330 Subject: [PATCH] fix: SUG-6 API key modal, SUG-4 project activity filter, WooCommerce health auth MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SUG-6: Replace auto-closing inline banner with persistent modal on Connect page — key stays visible until user clicks "Done" - SUG-4: Filter health_metric_recorded/health_check from project detail activity - WooCommerce: Accept consumer_key/consumer_secret credentials (preferred) with username/app_password fallback; fix health check to use WC endpoint and creds Co-Authored-By: Claude Opus 4.6 --- core/dashboard/routes.py | 9 ++++-- core/health.py | 23 +++++++++++--- core/templates/dashboard/connect.html | 45 +++++++++++++++++++++------ plugins/woocommerce/plugin.py | 26 ++++++++++++---- tests/test_woocommerce_plugin.py | 11 ++++--- 5 files changed, 86 insertions(+), 28 deletions(-) diff --git a/core/dashboard/routes.py b/core/dashboard/routes.py index 7e1ccbc..f279325 100644 --- a/core/dashboard/routes.py +++ b/core/dashboard/routes.py @@ -918,12 +918,15 @@ async def get_project_detail(project_id: str) -> dict | None: # Get recent activity for this project audit_logger = get_audit_logger() - recent_entries = audit_logger.get_recent_entries(limit=20) + recent_entries = audit_logger.get_recent_entries(limit=60) project_activity = [ e for e in recent_entries - if e.get("metadata", {}).get("project_id") == project_id - or e.get("metadata", {}).get("site") == site_id + if ( + e.get("metadata", {}).get("project_id") == project_id + or e.get("metadata", {}).get("site") == site_id + ) + and e.get("event_type", "") not in ("health_metric_recorded", "health_check") ][:5] # Get cached health status diff --git a/core/health.py b/core/health.py index ebc206e..78d8c22 100644 --- a/core/health.py +++ b/core/health.py @@ -563,13 +563,26 @@ class HealthMonitor: try: import aiohttp - auth = aiohttp.BasicAuth( - config.username or "", - config.app_password or "", - ) + if plugin_type == "woocommerce": + # WooCommerce uses consumer_key/consumer_secret + ck = getattr(config, "consumer_key", None) or "" + cs = getattr(config, "consumer_secret", None) or "" + # consumer_key/consumer_secret may be in model_extra + if not ck and hasattr(config, "model_extra"): + ck = (config.model_extra or {}).get("consumer_key", "") + cs = (config.model_extra or {}).get("consumer_secret", "") + auth = aiohttp.BasicAuth(ck, cs) + auth_check_url = f"{config.url}/wp-json/wc/v3/system_status" + else: + auth = aiohttp.BasicAuth( + config.username or "", + config.app_password or "", + ) + auth_check_url = f"{config.url}/wp-json/wp/v2/users/me" + async with aiohttp.ClientSession(auth=auth) as session: async with session.get( - f"{config.url}/wp-json/wp/v2/users/me", + auth_check_url, timeout=aiohttp.ClientTimeout(total=10), ssl=False, ) as resp: diff --git a/core/templates/dashboard/connect.html b/core/templates/dashboard/connect.html index 96d8306..57bbf9b 100644 --- a/core/templates/dashboard/connect.html +++ b/core/templates/dashboard/connect.html @@ -28,14 +28,35 @@ {% endif %} - -