Udp.Code. frontend_data logger - #864
Open
alexander-b-clean wants to merge 6 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors bot-detector “frontend data log” collection/transfer into a consolidated browser state payload (apbct_browser_state) that is injected into frontend requests, then parsed server-side and exposed via apbct__bot_detector_get_fd_log(). It also updates AltSessions allow-listing and expands PHPUnit coverage for transport-specific state retrieval.
Changes:
- Replace periodic “save log to AltSessions” JS with an
ApbctBrowserStatecollector and request-injection (apbct_browser_state) across XHR/fetch/FormData/string bodies. - Update PHP to return
apbct_browser_state(with defaults/error handling) and add helpers to parse state from RequestParameters/POST. - Expand standalone tests to cover AltSessions/NoCookie/POST transports and default-filling behavior.
Reviewed changes
Copilot reviewed 15 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/StandaloneFunctions/TestBotDetectorLogGathering.php | Reworked tests to validate new browser-state transport behavior and defaults. |
| lib/Cleantalk/ApbctWP/Variables/AltSessions.php | Allow-list apbct_browser_state as JSON in AltSessions validation. |
| js/src/public-3-bot-detector-log.js | Introduces ApbctBrowserState + apbctGetBrowserStatePair() for request injection. |
| js/src/public-1-main.js | Injects apbct_browser_state into multiple request interception paths (XHR/fetch/etc.). |
| js/src/public-1-functions.js | Includes browser state into NoCookie hidden-field payload / storage data array. |
| js/prebuild/apbct-public-bundle.js | Prebuilt bundle updated with browser state injection logic. |
| js/prebuild/apbct-public-bundle_int-protection.js | Prebuilt bundle updated with browser state injection logic. |
| js/prebuild/apbct-public-bundle_int-protection_gathering.js | Prebuilt bundle updated with browser state injection logic. |
| js/prebuild/apbct-public-bundle_gathering.js | Prebuilt bundle updated with browser state injection logic. |
| js/prebuild/apbct-public-bundle_full-protection.js | Prebuilt bundle updated with browser state injection logic. |
| js/prebuild/apbct-public-bundle_full-protection_gathering.js | Prebuilt bundle updated with browser state injection logic. |
| js/prebuild/apbct-public-bundle_ext-protection.js | Prebuilt bundle updated with browser state injection logic. |
| js/prebuild/apbct-public-bundle_ext-protection_gathering.js | Prebuilt bundle updated with browser state injection logic. |
| js/apbct-public-bundle.min.js | Minified public bundle updated to match new browser state behavior. |
| inc/cleantalk-common.php | Server-side browser state parsing + updated fd-log return structure. |
| cleantalk.php | Changes bot detector wrapper script URL constant. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
154
to
156
| if ( ! defined('APBCT_BOT_DETECTOR_SCRIPT_URL') ) { | ||
| define('APBCT_BOT_DETECTOR_SCRIPT_URL', 'https://fd.cleantalk.org/ct-bot-detector-wrapper.js'); | ||
| define('APBCT_BOT_DETECTOR_SCRIPT_URL', '/js-bot-detector-fd_log_av/ct-bot-detector-wrapper.js'); | ||
| } |
Comment on lines
+17
to
+21
| /** | ||
| * Get the current browser state as a JSON string ready to be transferred. | ||
| * @return {string} Empty string if the bot detector is disabled or on any collecting error. | ||
| */ | ||
| static toJson() { |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ontend_data-logger.ab
# Conflicts: # js/apbct-public-bundle.min.js # js/apbct-public-bundle_ext-protection.min.js # js/apbct-public-bundle_ext-protection_gathering.min.js # js/apbct-public-bundle_full-protection.min.js # js/apbct-public-bundle_full-protection_gathering.min.js # js/apbct-public-bundle_gathering.min.js # js/apbct-public-bundle_int-protection.min.js # js/apbct-public-bundle_int-protection_gathering.min.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://app.doboard.com/1/task/51081