Skip to content

Commit d73f4ff

Browse files
obenlandpfefferlemattwiebe
authored
Reply Block: Embed referenced post when possible (#1100)
* Reply Block: Embed referenced post when possible Fixes #1027. * some small refactorings * Add support for Activitypub JSON * Try oembed first. * Use get_remote_object() to, well, get the remote objects Props @pfefferle. * Set out embed template into its own template * Update readme.txt * Added some microformats @obenland I added some microformats to match the https://indieweb.org/reply-context * fix changelog * Add an embed setting * Move to Inspector * Add migrate * Default to false * build * Default to true, legacy false * built files * nothing to see here * Fix tests * default to true * Show embed previews in the Editor Introduce a new ActivityPub-centric embed endpoint that: 1. Uses OEmbed where possible 2. Falls back to ActivityPub representations when not possible * use REST namespace * Use core embeds as much as possible * Account for proxy response being an object * UX fit and finish * Might this be the key to defaults? * return early and empty with no url * fix tests * UX fit and finish ✨ * The long way around to only ActivityPub embeds supported. * lint and stray var_dump * more stray debugs * fix embed test * lint brush * Optimistic embedding when appropriate * Use webfinger style identifiers rather than URLs in embed * better labels, loading states * Don't render reply block in federated replies * Generate @-reply markup for reply block when federating * Improve Rest Controller implementation props @obenland ! * Use real oEmbed as much as possible, and consistently * update bookmarklet flow to prefer embeds * Rest: Replace URL checks with built-in sanitization * Minor cleanup * Add schema * Alphabetize * Handle oEmbed ourselves, the block was causing trouble * Ensure ActivityPub markup is always available oEmbed likes to filter out valid embeds for non-registered providers. So we check for that case, and see if we can help with ActivityPub-specific markup. * lint * remove `embed_get` * Embed class tests * changelog new style * Hide links when the Embed is shown * Use u-in-reply-to in fallback template Also fixes test * Improved UX when toggling the embed. * Ensure that state is reset consistently * use shorter handle in federated replies from reply block * Properly handle WP embeds. --------- Co-authored-by: Matthias Pfefferle <[email protected]> Co-authored-by: Matt Wiebe <[email protected]>
1 parent 6814118 commit d73f4ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1392
-95
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: added
3+
4+
Reply block: show embeds where available

activitypub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function rest_init() {
5353
( new Rest\Moderators_Controller() )->register_routes();
5454
( new Rest\Outbox_Controller() )->register_routes();
5555
( new Rest\Replies_Controller() )->register_routes();
56+
( new Rest\URL_Validator_Controller() )->register_routes();
5657
( new Rest\Webfinger_Controller() )->register_routes();
5758

5859
// Load NodeInfo endpoints only if blog is public.

assets/css/activitypub-embed.css

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/**
2+
* ActivityPub embed styles.
3+
*/
4+
5+
.activitypub-embed {
6+
background: #fff;
7+
border: 1px solid #e6e6e6;
8+
border-radius: 12px;
9+
margin: 1em 0;
10+
padding: 0;
11+
max-width: 100%;
12+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
13+
}
14+
15+
.activitypub-embed-header {
16+
padding: 15px;
17+
display: flex;
18+
align-items: center;
19+
gap: 10px;
20+
}
21+
22+
.activitypub-embed-header img {
23+
width: 48px;
24+
height: 48px;
25+
border-radius: 50%;
26+
}
27+
28+
.activitypub-embed-header-text {
29+
flex-grow: 1;
30+
}
31+
32+
.activitypub-embed-header-text h2 {
33+
color: #000;
34+
font-size: 15px;
35+
font-weight: 600;
36+
margin: 0;
37+
padding: 0;
38+
}
39+
40+
.activitypub-embed-header-text .ap-account {
41+
color: #687684;
42+
font-size: 14px;
43+
text-decoration: none;
44+
}
45+
46+
.activitypub-embed-content {
47+
padding: 0 15px 15px;
48+
}
49+
50+
.activitypub-embed-content .ap-title {
51+
font-size: 23px;
52+
font-weight: 600;
53+
margin: 0 0 10px;
54+
padding: 0;
55+
color: #000;
56+
}
57+
58+
.activitypub-embed-content .ap-subtitle {
59+
font-size: 15px;
60+
color: #000;
61+
margin: 0 0 15px;
62+
}
63+
64+
.activitypub-embed-content .ap-preview {
65+
border: 1px solid #e6e6e6;
66+
border-radius: 8px;
67+
overflow: hidden;
68+
}
69+
70+
.activitypub-embed-content .ap-preview img {
71+
width: 100%;
72+
height: auto;
73+
display: block;
74+
}
75+
76+
.activitypub-embed-content .ap-preview-text {
77+
padding: 15px;
78+
}
79+
80+
.activitypub-embed-meta {
81+
padding: 15px;
82+
border-top: 1px solid #e6e6e6;
83+
color: #687684;
84+
font-size: 13px;
85+
display: flex;
86+
gap: 15px;
87+
}
88+
89+
.activitypub-embed-meta .ap-stat {
90+
display: flex;
91+
align-items: center;
92+
gap: 5px;
93+
}
94+
95+
.activitypub-embed-meta a.ap-stat {
96+
text-decoration: none;
97+
}
98+
99+
.activitypub-embed-meta strong {
100+
font-weight: 600;
101+
color: #000;
102+
}
103+
104+
.activitypub-embed-meta .ap-stat-label {
105+
color: #687684;
106+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '293b8e75ac7a589c5096');
1+
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '50189007f2d8a7c9488f');

build/editor-plugin/plugin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/follow-me/index.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '37fe71b93359e27fe42a');
1+
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'cf004f8eb60b74344a41');

0 commit comments

Comments
 (0)