-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Descript.com embeds support #22234
Conversation
Caution: This PR has changes that must be merged to WordPress.com |
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about Descript! It seems nice. I left a bit of feedback below.
'id' => $id, | ||
'width' => $width, | ||
'height' => $height, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice if we could cast those as int / escape if possible.
// Descript rejects any request with the dnt query param, this removes the dnt from the oembed request. | ||
add_filter( 'oembed_fetch_url', 'jetpack_descript_remove_dnt' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit annoying. I wonder if we should opt to not embed, but only display a link when dnt is enabled? This way we would honor dnt at all times, and not just ignore it. I think someone who enabled dnt may prefer that over being tracked without knowing about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I'm on the Descript engineering team. Good catch! We'll add support for the dnt
parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @pdesantis! That's awesome. Thanks a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alshakero just following up, the dnt
parameter is now supported
src: ( | ||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 43 43" xmlSpace="preserve"> | ||
<Path transform="translate(-25)" fillRule="evenodd" d="M37 31.908c0 1.376.893 2.268 2.27 2.268H45.9c3.956 0 7.192-1.337 9.392-3.68H37v1.412zM45.901 9H39.27C37.893 9 37 9.893 37 11.269v1.411h18.294C53.093 10.338 49.857 9 45.9 9zm5.787 16.176c0 1.113.726 1.835 1.845 1.835h3.973c.45-1.117.753-2.345.894-3.671h-4.867c-1.119 0-1.845.722-1.845 1.836zm-5.507-7.166c0 1.113.725 1.836 1.844 1.836H58.4a13.644 13.644 0 00-.894-3.672h-9.481c-1.119 0-1.844.723-1.844 1.836zm1.843 7.166c0-1.114-.726-1.836-1.845-1.836H37v3.671h9.18c1.118 0 1.843-.722 1.843-1.835zm-5.508-7.166c0-1.113-.726-1.836-1.844-1.836H37v3.672h3.672c1.118 0 1.844-.723 1.844-1.836zM83.667 21.209c.296-1.437" clipRule="evenodd" /> | ||
</SVG> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to remove that trailing space so we can merge this.
/* | ||
* New `core/embed` block variation. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better like this?
/* | |
* New `core/embed` block variation. | |
*/ | |
/* | |
* New `core/embed` block variation. | |
*/ |
Thanks for the quick review! I addressed all feedback. To test the I also contacted Descript's support asking them to whitelist the dnt param. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick turn-around. I have one more suggestion, since you're working on DNT?
* | ||
* @return bool | ||
*/ | ||
function jetpack_descript_is_dnt_enabled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have something similar already:
jetpack/projects/plugins/jetpack/modules/stats.php
Lines 95 to 100 in e50c798
/** | |
* Checks if filter is set and dnt is enabled. | |
* | |
* @return bool | |
*/ | |
function jetpack_is_dnt_enabled() { |
What do you think about extracting this to a shared location, maybe projects/plugins/jetpack/functions.global.php
for now?
Hi @pdesantis! Would it be possible to quickly whitelist the I've put this on hold considering the above. |
Before calling jetpack_is_dnt_enabled.
7871b34
to
6bbfbdd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on both WPCOM and standalone WP site.
- Descript block works.
- Embed block with descript URL works.
- Shortcode block works (after enabling shortcodes through Jetpack > Settings > Writing > Compose using Shortcodes)
- Using
<iframe>
on Custom HTML block will not work on WPCOM (likely due to kses restriction, and that is OK). This works fine for standalone WP sites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well in my tests. 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well in my tests. 🚢
…tpack into add/descript-embed-support
Great news! One last step: head over to your WordPress.com diff, D72574-code, and commit it. Thank you! |
r238203-wpcom |
Similar to #21101. Which was thoroughly reviewed.
Changes proposed in this Pull Request:
This PR adds support for Descript.com embedding.
[descript id="gXEWtXaGTyK" width="640" height="480"]
.Does this pull request change what data or activity we track or use?
No
Testing instructions:
[descript id="gXEWtXaGTyK" width="640" height="480"]
.