fixing issues of integration with wordpress plugin

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-12 23:25:47 +00:00
parent ad828a9fcd
commit 5c3aa90e91
18 changed files with 1414 additions and 427 deletions

View File

@@ -85,6 +85,14 @@ class Igny8RestAPI {
'permission_callback' => '__return_true', // Public endpoint for health checks
));
// API key verification endpoint - requires valid API key in header
// Used by IGNY8 to verify the API keys match
register_rest_route('igny8/v1', '/verify-key', array(
'methods' => 'GET',
'callback' => array($this, 'verify_api_key'),
'permission_callback' => array($this, 'check_permission'),
));
// Manual publish endpoint - for triggering WordPress publish from IGNY8
// Route: /wp-json/igny8/v1/publish
register_rest_route('igny8/v1', '/publish', array(
@@ -406,6 +414,28 @@ class Igny8RestAPI {
return $this->build_unified_response(true, $data, 'Plugin status retrieved', null, null, 200);
}
/**
* GET /verify-key - Verify API key is valid and matches
* This endpoint requires authentication - if we get here, the API key is valid
*
* @param WP_REST_Request $request
* @return WP_REST_Response
*/
public function verify_api_key($request) {
// If we reach here, check_permission passed, meaning API key is valid
$api_key = function_exists('igny8_get_secure_option') ? igny8_get_secure_option('igny8_api_key') : get_option('igny8_api_key');
$site_id = get_option('igny8_site_id', '');
$data = array(
'verified' => true,
'site_id' => $site_id,
'plugin_version' => defined('IGNY8_BRIDGE_VERSION') ? IGNY8_BRIDGE_VERSION : '1.0.0',
'api_key_prefix' => !empty($api_key) ? substr($api_key, 0, 15) . '...' : null,
);
return $this->build_unified_response(true, $data, 'API key verified successfully', null, null, 200);
}
/**
* GET /site-metadata/ - returns post types, taxonomies and counts in unified format
*