Changeset 3486488
- Timestamp:
- 03/19/2026 01:01:56 PM (13 days ago)
- Location:
- mark-ai
- Files:
-
- 4 edited
- 1 copied
-
tags/1.0.5 (copied) (copied from mark-ai/trunk)
-
tags/1.0.5/mark-ai.php (modified) (8 diffs)
-
tags/1.0.5/readme.txt (modified) (2 diffs)
-
trunk/mark-ai.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mark-ai/tags/1.0.5/mark-ai.php
r3476258 r3486488 3 3 * Plugin Name: Mark AI 4 4 * Description: Publish content directly from Mark AI, the platform to create on-brand content at scale. 5 * Version: 1.0. 45 * Version: 1.0.5 6 6 * Requires at least: 5.6 7 7 * Requires PHP: 7.4 … … 37 37 38 38 // Define plugin constants 39 define('MARKAI_VERSION', '1.0. 4');39 define('MARKAI_VERSION', '1.0.5'); 40 40 define('MARKAI_PLUGIN_DIR', plugin_dir_path(__FILE__)); 41 41 define('MARKAI_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 225 225 if (!$this->verify_signature($body, $signature)) { 226 226 $this->log_activity('auth_failed', null, ['error' => 'Invalid signature']); 227 $this->report_error_to_api('error', 'HMAC signature verification failed', [ 228 'ip' => $this->get_client_ip(), 229 ]); 227 230 return false; 228 231 } … … 289 292 if (empty($integration_id)) { 290 293 $this->log_activity('auth_failed', null, ['error' => 'Connection not authorized']); 294 $this->report_error_to_api('error', 'Connection not authorized — markai_integration_id is empty'); 291 295 wp_send_json_error(__('Connection not authorized. Please authorize from your WordPress admin.', 'mark-ai'), 403); 292 296 } … … 445 449 'payload' => $data 446 450 ]); 451 $this->report_error_to_api('error', 'Publish failed: ' . $post_id->get_error_message(), [ 452 'post_type' => $post_type, 453 ]); 447 454 wp_send_json_error($post_id->get_error_message(), 500); 448 455 } … … 1854 1861 'payload' => $this->sanitize_for_logging($data), 1855 1862 ]); 1863 $this->report_error_to_api('error', 'Elementor publish failed: ' . $post_id->get_error_message()); 1856 1864 wp_send_json_error($post_id->get_error_message(), 500); 1857 1865 } … … 2247 2255 'payload' => $this->sanitize_for_logging($data), 2248 2256 ]); 2257 $this->report_error_to_api('error', 'Gutenberg publish failed: ' . $post_id->get_error_message()); 2249 2258 wp_send_json_error($post_id->get_error_message(), 500); 2250 2259 } … … 2932 2941 2933 2942 /** 2943 * Report an error to the Mark AI API for Sentry tracking. 2944 * 2945 * Fire-and-forget: uses a short timeout and ignores the response. 2946 * Only sends for important errors (auth failures, publish failures). 2947 * 2948 * @since 1.0.5 2949 * @param string $level Error level ('error' or 'warning'). 2950 * @param string $message Error message. 2951 * @param array $context Optional context data. 2952 * @return void 2953 */ 2954 private function report_error_to_api($level, $message, $context = []) { 2955 $integration_id = get_option('markai_integration_id'); 2956 if (empty($integration_id) || empty($this->api_key)) { 2957 return; 2958 } 2959 2960 $api_base_url = defined('MARKAI_API_URL') 2961 ? MARKAI_API_URL 2962 : 'https://api.markcopy.ai'; 2963 2964 $payload = [ 2965 'integration_id' => $integration_id, 2966 'errors' => [ 2967 [ 2968 'level' => $level, 2969 'message' => $message, 2970 'context' => array_merge($context, [ 2971 'site_url' => get_site_url(), 2972 'plugin_version' => MARKAI_VERSION, 2973 ]), 2974 'timestamp' => time(), 2975 ], 2976 ], 2977 ]; 2978 2979 $body = wp_json_encode($payload); 2980 $signature = hash_hmac('sha256', $body, $this->api_key); 2981 2982 wp_remote_post($api_base_url . '/integrations/wordpress/plugin-errors', [ 2983 'body' => $body, 2984 'headers' => [ 2985 'Content-Type' => 'application/json', 2986 'X-MarkAI-Signature' => $signature, 2987 ], 2988 'timeout' => 5, 2989 'blocking' => false, 2990 'sslverify' => true, 2991 ]); 2992 } 2993 2994 /** 2934 2995 * Log plugin activity to the database. 2935 2996 * -
mark-ai/tags/1.0.5/readme.txt
r3476258 r3486488 4 4 Requires at least: 5.6 5 5 Tested up to: 6.9 6 Stable tag: 1.0. 46 Stable tag: 1.0.5 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 81 81 82 82 == Changelog == 83 84 = 1.0.5 = 85 * Improved error reporting for faster troubleshooting 83 86 84 87 = 1.0.4 = -
mark-ai/trunk/mark-ai.php
r3476258 r3486488 3 3 * Plugin Name: Mark AI 4 4 * Description: Publish content directly from Mark AI, the platform to create on-brand content at scale. 5 * Version: 1.0. 45 * Version: 1.0.5 6 6 * Requires at least: 5.6 7 7 * Requires PHP: 7.4 … … 37 37 38 38 // Define plugin constants 39 define('MARKAI_VERSION', '1.0. 4');39 define('MARKAI_VERSION', '1.0.5'); 40 40 define('MARKAI_PLUGIN_DIR', plugin_dir_path(__FILE__)); 41 41 define('MARKAI_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 225 225 if (!$this->verify_signature($body, $signature)) { 226 226 $this->log_activity('auth_failed', null, ['error' => 'Invalid signature']); 227 $this->report_error_to_api('error', 'HMAC signature verification failed', [ 228 'ip' => $this->get_client_ip(), 229 ]); 227 230 return false; 228 231 } … … 289 292 if (empty($integration_id)) { 290 293 $this->log_activity('auth_failed', null, ['error' => 'Connection not authorized']); 294 $this->report_error_to_api('error', 'Connection not authorized — markai_integration_id is empty'); 291 295 wp_send_json_error(__('Connection not authorized. Please authorize from your WordPress admin.', 'mark-ai'), 403); 292 296 } … … 445 449 'payload' => $data 446 450 ]); 451 $this->report_error_to_api('error', 'Publish failed: ' . $post_id->get_error_message(), [ 452 'post_type' => $post_type, 453 ]); 447 454 wp_send_json_error($post_id->get_error_message(), 500); 448 455 } … … 1854 1861 'payload' => $this->sanitize_for_logging($data), 1855 1862 ]); 1863 $this->report_error_to_api('error', 'Elementor publish failed: ' . $post_id->get_error_message()); 1856 1864 wp_send_json_error($post_id->get_error_message(), 500); 1857 1865 } … … 2247 2255 'payload' => $this->sanitize_for_logging($data), 2248 2256 ]); 2257 $this->report_error_to_api('error', 'Gutenberg publish failed: ' . $post_id->get_error_message()); 2249 2258 wp_send_json_error($post_id->get_error_message(), 500); 2250 2259 } … … 2932 2941 2933 2942 /** 2943 * Report an error to the Mark AI API for Sentry tracking. 2944 * 2945 * Fire-and-forget: uses a short timeout and ignores the response. 2946 * Only sends for important errors (auth failures, publish failures). 2947 * 2948 * @since 1.0.5 2949 * @param string $level Error level ('error' or 'warning'). 2950 * @param string $message Error message. 2951 * @param array $context Optional context data. 2952 * @return void 2953 */ 2954 private function report_error_to_api($level, $message, $context = []) { 2955 $integration_id = get_option('markai_integration_id'); 2956 if (empty($integration_id) || empty($this->api_key)) { 2957 return; 2958 } 2959 2960 $api_base_url = defined('MARKAI_API_URL') 2961 ? MARKAI_API_URL 2962 : 'https://api.markcopy.ai'; 2963 2964 $payload = [ 2965 'integration_id' => $integration_id, 2966 'errors' => [ 2967 [ 2968 'level' => $level, 2969 'message' => $message, 2970 'context' => array_merge($context, [ 2971 'site_url' => get_site_url(), 2972 'plugin_version' => MARKAI_VERSION, 2973 ]), 2974 'timestamp' => time(), 2975 ], 2976 ], 2977 ]; 2978 2979 $body = wp_json_encode($payload); 2980 $signature = hash_hmac('sha256', $body, $this->api_key); 2981 2982 wp_remote_post($api_base_url . '/integrations/wordpress/plugin-errors', [ 2983 'body' => $body, 2984 'headers' => [ 2985 'Content-Type' => 'application/json', 2986 'X-MarkAI-Signature' => $signature, 2987 ], 2988 'timeout' => 5, 2989 'blocking' => false, 2990 'sslverify' => true, 2991 ]); 2992 } 2993 2994 /** 2934 2995 * Log plugin activity to the database. 2935 2996 * -
mark-ai/trunk/readme.txt
r3476258 r3486488 4 4 Requires at least: 5.6 5 5 Tested up to: 6.9 6 Stable tag: 1.0. 46 Stable tag: 1.0.5 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 81 81 82 82 == Changelog == 83 84 = 1.0.5 = 85 * Improved error reporting for faster troubleshooting 83 86 84 87 = 1.0.4 =
Note: See TracChangeset
for help on using the changeset viewer.