Upd. Search. Improved flow of keeping token.#807
Open
svfcode wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the “search” flow by proactively syncing the bot-detector event token into alternative cookies when a page contains a GET-based search form markup used by popular WordPress themes (so search requests can carry the token even when submit-middleware can’t intercept).
Changes:
- Added popular-theme search form detection + a throttled (5 min) token sync to alternative cookies in the public handler.
- Wired the new token sync into the public init flow and the
botDetectorEventTokenUpdatedevent path. - Rebuilt generated JS bundles/minified assets (including admin edit-screen scripts).
Reviewed changes
Copilot reviewed 9 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| js/src/public-1-main.js | Adds theme search form detection and throttled token sync; hooks it into init + token-updated flow. |
| js/prebuild/apbct-public-bundle.js | Rebuilt bundle with the new search token sync logic. |
| js/prebuild/apbct-public-bundle_int-protection.js | Rebuilt bundle variant with the new search token sync logic. |
| js/prebuild/apbct-public-bundle_int-protection_gathering.js | Rebuilt bundle variant with the new search token sync logic. |
| js/prebuild/apbct-public-bundle_gathering.js | Rebuilt bundle variant with the new search token sync logic. |
| js/prebuild/apbct-public-bundle_full-protection.js | Rebuilt bundle variant with the new search token sync logic. |
| js/prebuild/apbct-public-bundle_full-protection_gathering.js | Rebuilt bundle variant with the new search token sync logic. |
| js/prebuild/apbct-public-bundle_ext-protection.js | Rebuilt bundle variant with the new search token sync logic. |
| js/prebuild/apbct-public-bundle_ext-protection_gathering.js | Rebuilt bundle variant with the new search token sync logic. |
| js/cleantalk-users-editscreen.min.js | Rebuilt minified asset (blacklist-link insertion behavior). |
| js/cleantalk-users-editscreen.min.js.map | Updated source map for rebuilt minified asset. |
| js/cleantalk-comments-editscreen.min.js | Rebuilt minified asset (blacklist-link insertion behavior). |
| js/cleantalk-comments-editscreen.min.js.map | Updated source map for rebuilt minified asset. |
| js/apbct-public-bundle.min.js | Rebuilt minified public bundle including the new search token sync logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1399
to
+1405
| /** | ||
| * LS key: timestamp (ms) of the last successful search-form token sync to alt cookies. | ||
| * @return {string} | ||
| */ | ||
| getSearchFormTokenAltCookieSentAtLsKey() { | ||
| return 'apbct_search_form_token_alt_cookie_sent_at'; | ||
| } |
Comment on lines
+2097
to
+2099
| if (+ctPublic.settings__forms__search_test === 1) { | ||
| handler.searchFormMiddlewareJustSetTokenToAlternativeCookie(); | ||
| } |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #807 +/- ##
=========================================
Coverage 26.09% 26.09%
Complexity 5631 5631
=========================================
Files 265 265
Lines 24157 24157
=========================================
Hits 6304 6304
Misses 17853 17853 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
task https://app.doboard.com/1/task/49674