Skip to content

Commit

Permalink
fix: prevent API bot exit without referer (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelpeixe authored Dec 20, 2022
1 parent dd1d38d commit bc8ec5b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [2.9.2-hotfix.1](https://github.com/Automattic/newspack-popups/compare/v2.9.1...v2.9.2-hotfix.1) (2022-12-20)


### Bug Fixes

* prevent API bot exit without referer ([b9f5c56](https://github.com/Automattic/newspack-popups/commit/b9f5c5646580f7f354dac1279a33a7398bc6491c))

## [2.9.1](https://github.com/Automattic/newspack-popups/compare/v2.9.0...v2.9.1) (2022-12-20)


Expand Down
2 changes: 1 addition & 1 deletion api/classes/class-lightweight-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Lightweight_API {
* @codeCoverageIgnore
*/
public function __construct( $nonce = null, $ignore_referer_validation = false ) {
if ( $this->is_a_web_crawler() ) {
if ( $this->is_a_web_crawler() && ! $ignore_referer_validation ) {
header( 'X-Robots-Tag: noindex' );
exit;
}
Expand Down
4 changes: 1 addition & 3 deletions includes/class-newspack-popups-segmentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ public function __construct() {
add_action( 'wp_footer', [ __CLASS__, 'insert_amp_analytics' ], 20 );

add_filter( 'newspack_custom_dimensions', [ __CLASS__, 'register_custom_dimensions' ] );
// Temporarily removed this filter on 2022-12-20. It's causing blank pages to get cached intermittently on production sites.
// phpcs:ignore Squiz.Commenting.InlineComment.InvalidEndChar
// add_filter( 'newspack_custom_dimensions_values', [ __CLASS__, 'report_custom_dimensions' ] );
add_filter( 'newspack_custom_dimensions_values', [ __CLASS__, 'report_custom_dimensions' ] );

// Data pruning CRON job.
register_deactivation_hook( NEWSPACK_POPUPS_PLUGIN_FILE, [ __CLASS__, 'cron_deactivate' ] );
Expand Down
2 changes: 1 addition & 1 deletion newspack-popups.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://newspack.blog
* Text Domain: newspack-popups
* Domain Path: /languages
* Version: 2.9.1
* Version: 2.9.2-hotfix.1
*
* @package Newspack_Popups
*/
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "newspack-popups",
"version": "2.9.1",
"version": "2.9.2-hotfix.1",
"main": "Gruntfile.js",
"author": "Automattic",
"scripts": {
Expand Down

0 comments on commit bc8ec5b

Please sign in to comment.