Changeset 3436960
- Timestamp:
- 01/11/2026 08:24:31 AM (3 months ago)
- Location:
- fastcomments
- Files:
-
- 40 added
- 4 edited
-
tags/3.16.2 (added)
-
tags/3.16.2/.gitignore (added)
-
tags/3.16.2/LICENSE (added)
-
tags/3.16.2/README.md (added)
-
tags/3.16.2/README.txt (added)
-
tags/3.16.2/admin (added)
-
tags/3.16.2/admin/fastcomments-admin-advanced-settings-view.js (added)
-
tags/3.16.2/admin/fastcomments-admin-advanced-settings-view.php (added)
-
tags/3.16.2/admin/fastcomments-admin-manual-sync-view.js (added)
-
tags/3.16.2/admin/fastcomments-admin-manual-sync-view.php (added)
-
tags/3.16.2/admin/fastcomments-admin-setup-view.js (added)
-
tags/3.16.2/admin/fastcomments-admin-setup-view.php (added)
-
tags/3.16.2/admin/fastcomments-admin-sso-view.css (added)
-
tags/3.16.2/admin/fastcomments-admin-sso-view.js (added)
-
tags/3.16.2/admin/fastcomments-admin-sso-view.php (added)
-
tags/3.16.2/admin/fastcomments-admin-support-view.php (added)
-
tags/3.16.2/admin/fastcomments-admin-view.php (added)
-
tags/3.16.2/admin/fastcomments-admin.css (added)
-
tags/3.16.2/admin/fastcomments-admin.php (added)
-
tags/3.16.2/admin/images (added)
-
tags/3.16.2/admin/images/api.png (added)
-
tags/3.16.2/admin/images/crown.png (added)
-
tags/3.16.2/admin/images/css.png (added)
-
tags/3.16.2/admin/images/debugging.png (added)
-
tags/3.16.2/admin/images/download.png (added)
-
tags/3.16.2/admin/images/home.png (added)
-
tags/3.16.2/admin/images/logo-50.png (added)
-
tags/3.16.2/admin/images/logo.png (added)
-
tags/3.16.2/admin/images/settings.png (added)
-
tags/3.16.2/admin/images/support.png (added)
-
tags/3.16.2/admin/images/sync-status.png (added)
-
tags/3.16.2/admin/images/sync.png (added)
-
tags/3.16.2/core (added)
-
tags/3.16.2/core/FastCommentsIntegrationCore.php (added)
-
tags/3.16.2/core/FastCommentsWordPressIntegration.php (added)
-
tags/3.16.2/fastcomments-wordpress-plugin.php (added)
-
tags/3.16.2/public (added)
-
tags/3.16.2/public/fastcomments-public.php (added)
-
tags/3.16.2/public/fastcomments-widget-view.php (added)
-
tags/3.16.2/uninstall.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/core/FastCommentsIntegrationCore.php (modified) (1 diff)
-
trunk/core/FastCommentsWordPressIntegration.php (modified) (2 diffs)
-
trunk/fastcomments-wordpress-plugin.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fastcomments/trunk/README.txt
r3380398 r3436960 3 3 Tags: live comments, comments, comment spam, comment system, fast comments, live commenting 4 4 Requires at least: 4.6 5 Tested up to: 6. 8.36 Stable tag: 3.16. 15 Tested up to: 6.9.1 6 Stable tag: 3.16.2 7 7 Requires PHP: 5.2.5 8 8 License: GPLv2 or later … … 88 88 == Changelog == 89 89 90 = 3.16.2 = 91 * Improved initial sync reliability 92 * Further improvements to prevent bots from submitting spam around the plugin, but in a way that interferes with other themes/plugins less. 93 90 94 = 3.16.1 = 91 95 * Prevent bots from submitting spam directly to the WP endpoint when the plugin is installed -
fastcomments/trunk/core/FastCommentsIntegrationCore.php
r2771905 r3436960 143 143 $domainName = $this->getDomain(); 144 144 $rawTokenUpsertResponse = $this->makeHTTPRequest('PUT', "$this->baseUrl/token?token=$token&integrationType=$this->integrationType&domain=$domainName", null); 145 146 if ($rawTokenUpsertResponse->responseStatusCode !== 200) { 147 $this->log('warn', "Token validation HTTP request failed with status code: {$rawTokenUpsertResponse->responseStatusCode}"); 148 return null; 149 } 150 151 if (empty($rawTokenUpsertResponse->responseBody)) { 152 $this->log('warn', "Token validation received empty response body"); 153 return null; 154 } 155 145 156 $tokenUpsertResponse = json_decode($rawTokenUpsertResponse->responseBody); 146 if ($tokenUpsertResponse->status === 'success' && $tokenUpsertResponse->isTokenValidated === true) { 147 $this->setSettingValue('fastcomments_tenant_id', $tokenUpsertResponse->tenantId); 157 158 if ($tokenUpsertResponse === null) { 159 $this->log('warn', "Token validation failed to parse JSON response: " . substr($rawTokenUpsertResponse->responseBody, 0, 200)); 160 return null; 161 } 162 163 $status = isset($tokenUpsertResponse->status) ? $tokenUpsertResponse->status : 'unknown'; 164 $isValidated = isset($tokenUpsertResponse->isTokenValidated) ? $tokenUpsertResponse->isTokenValidated : false; 165 $tenantId = isset($tokenUpsertResponse->tenantId) ? $tokenUpsertResponse->tenantId : null; 166 167 $this->log('debug', "Token validation response: status={$status} isTokenValidated=" . var_export($isValidated, true) . " tenantId=" . var_export($tenantId, true)); 168 169 if ($status === 'success' && $isValidated === true && !empty($tenantId)) { 170 $this->setSettingValue('fastcomments_tenant_id', $tenantId); 148 171 $this->setSettingValue('fastcomments_token_validated', true); 172 $this->log('info', "Token validated successfully, tenant_id set to {$tenantId}"); 173 } else if ($status === 'success' && $isValidated === true) { 174 $this->log('warn', "Token validated but tenantId was empty/null - not setting tenant_id"); 175 } else if ($status === 'success' && $isValidated === false) { 176 $this->log('debug', "Token not yet validated by user on FastComments side"); 177 } else { 178 $this->log('warn', "Token validation got unexpected response - status: {$status}, isValidated: " . var_export($isValidated, true)); 149 179 } 150 180 return null; -
fastcomments/trunk/core/FastCommentsWordPressIntegration.php
r2771905 r3436960 236 236 237 237 public function makeHTTPRequest($method, $url, $body) { 238 // Use longer timeout for POST requests (comment uploads can take time with large batches) 239 $timeout = ($method === 'POST' && $body) ? 60 : 20; 238 240 $rawResult = wp_remote_request($url, array( 239 241 'method' => $method, 240 242 'body' => $body, 241 'timeout' => 20,243 'timeout' => $timeout, 242 244 'headers' => array('Content-Type' => 'application/json; charset=utf-8'), 243 245 'data_format' => $body ? 'body' : 'query' … … 365 367 $fc_comment['comment'] = $wp_comment->comment_content ? $wp_comment->comment_content : ''; 366 368 $fc_comment['externalParentId'] = $wp_comment->comment_parent ? $wp_comment->comment_parent : null; // 0 is the WP default (no parent). we can't do anything with 0. 367 $fc_comment['date'] = $wp_comment->comment_date ;369 $fc_comment['date'] = $wp_comment->comment_date_gmt ? $wp_comment->comment_date_gmt : $wp_comment->comment_date; 368 370 $fc_comment['votes'] = $votes; 369 371 $fc_comment['votesUp'] = $votes > 0 ? $votes : 0; -
fastcomments/trunk/fastcomments-wordpress-plugin.php
r3380398 r3436960 3 3 Plugin Name: FastComments 4 4 Plugin URI: https://fastcomments.com 5 Description: A live, fast, privacy-focused commenting system .6 Version: 3.16. 15 Description: A live, fast, privacy-focused commenting system with advanced spam prevention capabilities. 6 Version: 3.16.2 7 7 Author: winrid @ FastComments 8 8 License: GPL-2.0+ … … 14 14 } 15 15 16 $FASTCOMMENTS_VERSION = 3.16 1;16 $FASTCOMMENTS_VERSION = 3.162; 17 17 18 18 require_once plugin_dir_path(__FILE__) . 'admin/fastcomments-admin.php'; … … 94 94 95 95 // Prevent spam bots from submitting to WordPress's native comment endpoints 96 add_ filter('comments_open', 'fc_block_native_comments', 10, 2);96 add_action('pre_comment_on_post', 'fc_block_native_submissions'); 97 97 add_filter('rest_pre_insert_comment', 'fc_block_rest_comments', 10, 2); 98 98 } 99 99 100 100 // Block submissions to wp-comments-post.php 101 function fc_block_native_ comments($open, $post_id) {102 // When FastComments is active, close native WordPress comments to prevent bot spam101 function fc_block_native_submissions($comment_post_ID) { 102 // When FastComments is active, block native WordPress comment submissions 103 103 if (get_option('fastcomments_tenant_id')) { 104 return false;104 wp_die(__('Comments must be submitted through FastComments.', 'fastcomments'), __('Comments Disabled', 'fastcomments'), array('response' => 403)); 105 105 } 106 return $open;107 106 } 108 107 … … 122 121 function fastcomments_cron() 123 122 { 124 require_once plugin_dir_path(__FILE__) . 'core/FastCommentsWordPressIntegration.php'; 125 $fastcomments = new FastCommentsWordPressIntegration(); 126 $fastcomments->log('debug', 'Begin cron tick.'); 127 $fastcomments->tick(); 128 $fastcomments->log('debug', 'End cron tick.'); 123 try { 124 require_once plugin_dir_path(__FILE__) . 'core/FastCommentsWordPressIntegration.php'; 125 $fastcomments = new FastCommentsWordPressIntegration(); 126 $fastcomments->log('debug', 'Begin cron tick.'); 127 $fastcomments->tick(); 128 $fastcomments->log('debug', 'End cron tick.'); 129 } catch (Exception $e) { 130 error_log('ERROR:::FastComments cron failed: ' . $e->getMessage()); 131 } 129 132 } 130 133
Note: See TracChangeset
for help on using the changeset viewer.