API ISsues fixes pluigna dn app, plugin v udapte 1.4.0

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-13 04:42:58 +00:00
parent a91e22895b
commit a361dea528
9 changed files with 728 additions and 27 deletions

View File

@@ -363,17 +363,24 @@ function igny8_get_connection_state() {
$integration_id = get_option('igny8_integration_id');
$last_structure_sync = get_option('igny8_last_structure_sync');
// SECURITY: Must have API key to show ANY connection state
if (empty($api_key)) {
igny8_log_connection_state('not_connected', 'No API key found');
return 'not_connected';
}
if (!empty($api_key) && !empty($integration_id) && !empty($last_structure_sync)) {
igny8_log_connection_state('connected', 'Fully connected and synced');
// SECURITY: Only show 'connected' if API key is validated
// Check if we have a recent successful API health check (within last hour)
$last_health_check = get_option('igny8_last_api_health_check', 0);
$one_hour_ago = time() - 3600;
if (!empty($api_key) && !empty($integration_id) && !empty($last_structure_sync) && $last_health_check > $one_hour_ago) {
igny8_log_connection_state('connected', 'Fully connected and synced with validated API key');
return 'connected';
}
igny8_log_connection_state('configured', 'API key set, pending structure sync');
// If we have API key but no recent validation, show as 'configured' not 'connected'
igny8_log_connection_state('configured', 'API key set, validation pending');
return 'configured';
}