Upd. Search. Improved flow of keeping token.#807
Conversation
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.
| /** | ||
| * 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'; | ||
| } |
| 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:
|
|
Decided to close this PR, new one is #821 |
task https://app.doboard.com/1/task/49674