fixing issues of integration with wordpress plugin
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: IGNY8 WordPress Bridge
|
||||
* Plugin URI: https://igny8.com/igny8-wp-bridge
|
||||
* Description: Lightweight bridge plugin that connects WordPress to IGNY8 API for one-way content publishing.
|
||||
* Version: 1.3.4
|
||||
* Version: 1.3.8
|
||||
* Author: IGNY8
|
||||
* Author URI: https://igny8.com/
|
||||
* License: GPL v2 or later
|
||||
@@ -22,7 +22,7 @@ if (!defined('ABSPATH')) {
|
||||
}
|
||||
|
||||
// Define plugin constants
|
||||
define('IGNY8_BRIDGE_VERSION', '1.3.4');
|
||||
define('IGNY8_BRIDGE_VERSION', '1.3.8');
|
||||
define('IGNY8_BRIDGE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
||||
define('IGNY8_BRIDGE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
||||
define('IGNY8_BRIDGE_PLUGIN_FILE', __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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user