Skip to content

Commit

Permalink
Performance: VideoPress: avoid useEffect call for every block on typi…
Browse files Browse the repository at this point in the history
…ng (#33724)

* Performance: VideoPress: avoid running useEffect for every block on typing

* unbreak the rules of hooks

* comment

* fix another instance

* fix eslint issue

* fix eslint issues

* changelog

* update videopress pkg version

---------

Co-authored-by: Damián Suárez <rdsuarez@gmail.com>

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/6616469564
  • Loading branch information
ice9js authored and matticbot committed Oct 23, 2023
1 parent aba1485 commit aa70ba2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 100 deletions.
19 changes: 0 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.11.0-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Added
- DSP media endpoints whitelisting

### Changed
- Updated package dependencies.

### Fixed
- Fix unsetting `'sub_path'` in `Dashboard_REST_Controller`.

## [0.10.4] - 2023-10-16
### Changed
- Updated package dependencies. [#33429]

## [0.10.3] - 2023-10-10
### Changed
- Updated package dependencies. [#33428]
Expand Down Expand Up @@ -228,8 +211,6 @@ This is an alpha version! The changes listed here are not final.
### Changed
- Updated package dependencies. [#27906]

[0.11.0-alpha]: https://github.com/automattic/jetpack-blaze/compare/v0.10.4...v0.11.0-alpha
[0.10.4]: https://github.com/automattic/jetpack-blaze/compare/v0.10.3...v0.10.4
[0.10.3]: https://github.com/automattic/jetpack-blaze/compare/v0.10.2...v0.10.3
[0.10.2]: https://github.com/automattic/jetpack-blaze/compare/v0.10.1...v0.10.2
[0.10.1]: https://github.com/automattic/jetpack-blaze/compare/v0.10.0...v0.10.1
Expand Down
13 changes: 2 additions & 11 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@ Full details of the Automattic Security Policy can be found on [automattic.com](

## Supported Versions

Generally, only the latest version of Jetpack and its associated plugins have continued support. If a critical vulnerability is found in the current version of a plugin, we may opt to backport any patches to previous versions.
Generally, only the latest version of Jetpack has continued support. If a critical vulnerability is found in the current version of Jetpack, we may opt to backport any patches to previous versions.

## Reporting a Vulnerability

Our HackerOne program covers the below plugin software, as well as a variety of related projects and infrastructure:

* [Jetpack](https://jetpack.com/)
* Jetpack Backup
* Jetpack Boost
* Jetpack CRM
* Jetpack Protect
* Jetpack Search
* Jetpack Social
* Jetpack VideoPress
[Jetpack](https://jetpack.com/) is an open-source plugin for WordPress. Our HackerOne program covers the plugin software, as well as a variety of related projects and infrastructure.

**For responsible disclosure of security issues and to be eligible for our bug bounty program, please submit your report via the [HackerOne](https://hackerone.com/automattic) portal.**

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"type": "jetpack-library",
"license": "GPL-2.0-or-later",
"require": {
"automattic/jetpack-assets": "^1.18.13",
"automattic/jetpack-connection": "^1.58.2",
"automattic/jetpack-assets": "^1.18.12",
"automattic/jetpack-connection": "^1.58.1",
"automattic/jetpack-plans": "^0.3.4",
"automattic/jetpack-redirect": "^1.7.27",
"automattic/jetpack-status": "^1.18.5",
"automattic/jetpack-sync": "^1.59.0-alpha"
"automattic/jetpack-sync": "^1.57.4"
},
"require-dev": {
"yoast/phpunit-polyfills": "1.1.0",
Expand Down Expand Up @@ -53,7 +53,7 @@
"link-template": "https://github.com/automattic/jetpack-blaze/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "0.11.x-dev"
"dev-trunk": "0.10.x-dev"
},
"textdomain": "jetpack-blaze",
"version-constants": {
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-blaze",
"version": "0.11.0-alpha",
"version": "0.10.3",
"description": "Attract high-quality traffic to your site using Blaze. Using this service, you can advertise a post or page on some of the millions of pages across WordPress.com and Tumblr from just $5 per day.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/blaze/#readme",
"bugs": {
Expand All @@ -23,25 +23,25 @@
},
"dependencies": {
"@automattic/jetpack-analytics": "^0.1.27",
"@automattic/jetpack-components": "^0.44.1-alpha",
"@automattic/jetpack-shared-extension-utils": "^0.12.4",
"@wordpress/block-editor": "12.12.0",
"@wordpress/components": "25.10.0",
"@wordpress/compose": "6.21.0",
"@wordpress/data": "9.14.0",
"@wordpress/element": "5.21.0",
"@wordpress/i18n": "4.44.0",
"@wordpress/icons": "9.35.0",
"@wordpress/plugins": "6.12.0",
"@automattic/jetpack-components": "^0.43.2",
"@automattic/jetpack-shared-extension-utils": "^0.12.1",
"@wordpress/block-editor": "12.11.0",
"@wordpress/components": "25.9.0",
"@wordpress/compose": "6.20.0",
"@wordpress/data": "9.13.0",
"@wordpress/element": "5.20.0",
"@wordpress/i18n": "4.43.0",
"@wordpress/icons": "9.34.0",
"@wordpress/plugins": "6.11.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@automattic/jetpack-webpack-config": "workspace:*",
"@babel/core": "7.23.2",
"@babel/preset-env": "7.23.2",
"@babel/runtime": "7.23.2",
"@wordpress/browserslist-config": "5.27.0",
"@babel/core": "7.22.17",
"@babel/preset-env": "7.22.15",
"@babel/runtime": "7.22.15",
"@wordpress/browserslist-config": "5.26.0",
"sass": "1.64.1",
"sass-loader": "12.4.0",
"webpack": "5.76.0",
Expand Down
54 changes: 4 additions & 50 deletions src/class-dashboard-rest-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,6 @@ public function register_rest_routes() {
)
);

// WordAds DSP API media query routes
register_rest_route(
static::$namespace,
sprintf( '/sites/%1$d/wordads/dsp/api/v1/wpcom/sites/%1$d/media(?P<sub_path>[a-zA-Z0-9-_\/]*)(\?.*)?', $site_id ),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_dsp_media' ),
'permission_callback' => array( $this, 'can_user_view_dsp_callback' ),
)
);

// WordAds DSP API media openverse query routes
register_rest_route(
static::$namespace,
sprintf( '/sites/%1$d/wordads/dsp/api/v1/wpcom/media(?P<sub_path>[a-zA-Z0-9-_\/]*)(\?.*)?', $site_id ),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_dsp_openverse' ),
'permission_callback' => array( $this, 'can_user_view_dsp_callback' ),
)
);

// WordAds DSP API Experiment route
register_rest_route(
static::$namespace,
Expand Down Expand Up @@ -296,8 +274,8 @@ public function get_blaze_posts( $req ) {
}

// We don't use sub_path in the blaze posts, only query strings
if ( isset( $req['sub_path'] ) ) {
unset( $req['sub_path'] );
if ( isset( $params['sub_path'] ) ) {
unset( $req->get_params()['sub_path'] );
}

return $this->request_as_user(
Expand Down Expand Up @@ -344,37 +322,13 @@ public function get_dsp_blaze_posts( $req ) {
}

// We don't use sub_path in the blaze posts, only query strings
if ( isset( $req['sub_path'] ) ) {
unset( $req['sub_path'] );
if ( isset( $params['sub_path'] ) ) {
unset( $req->get_params()['sub_path'] );
}

return $this->get_dsp_generic( sprintf( 'v1/wpcom/sites/%d/blaze/posts', $site_id ), $req );
}

/**
* Redirect GET requests to WordAds DSP Blaze media endpoint for the site.
*
* @param WP_REST_Request $req The request object.
* @return array|WP_Error
*/
public function get_dsp_media( $req ) {
$site_id = $this->get_site_id();
if ( is_wp_error( $site_id ) ) {
return array();
}
return $this->get_dsp_generic( sprintf( 'v1/wpcom/sites/%d/media', $site_id ), $req );
}

/**
* Redirect GET requests to WordAds DSP Blaze openverse endpoint.
*
* @param WP_REST_Request $req The request object.
* @return array|WP_Error
*/
public function get_dsp_openverse( $req ) {
return $this->get_dsp_generic( 'v1/wpcom/media', $req );
}

/**
* Redirect GET requests to WordAds DSP Credits endpoint for the site.
*
Expand Down
2 changes: 1 addition & 1 deletion src/class-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Dashboard {
*
* @var string
*/
const PACKAGE_VERSION = '0.11.0-alpha';
const PACKAGE_VERSION = '0.10.3';

/**
* List of dependencies needed to render the dashboard in wp-admin.
Expand Down

0 comments on commit aa70ba2

Please sign in to comment.