fixes integration

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-13 00:17:38 +00:00
parent 5c3aa90e91
commit 25caea5d90
4 changed files with 78 additions and 16 deletions

View File

@@ -237,8 +237,10 @@ class IntegrationViewSet(SiteSectorModelViewSet):
issues.append(f"Cannot detect IGNY8 plugin: {str(e)}")
# Check 3: Verify API keys MATCH by making authenticated request
# This is the CRITICAL check - WordPress must accept our API key
if health_checks['plugin_installed'] and health_checks['plugin_has_api_key']:
# This is the CRITICAL and AUTHORITATIVE check - WordPress must accept our API key
# We always try this if plugin is installed, regardless of what /status says about has_api_key
# because the /verify-key endpoint is the source of truth
if health_checks['plugin_installed']:
try:
# Make authenticated request using Site.wp_api_key to dedicated verify endpoint
verify_response = http_requests.get(
@@ -251,6 +253,8 @@ class IntegrationViewSet(SiteSectorModelViewSet):
)
if verify_response.status_code == 200:
health_checks['api_key_verified'] = True
# If verify succeeds, plugin definitely has the matching key
health_checks['plugin_has_api_key'] = True
elif verify_response.status_code in [401, 403]:
issues.append("API key mismatch - WordPress has different key than IGNY8. Please copy the API key from IGNY8 to WordPress plugin settings.")
else: