diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2fc612b5..fbdf254df 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,22 @@ 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.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [Unreleased]
+## [Untitled]
+
+### Changed
+
+* Improved content negotiation and AUTHORIZED_FETCH support for third-party plugins
+
+## [4.7.2] - 2025-01-17
+
+### Fixed
+
+* More robust handling of `_activityPubOptions` in scripts, using a `useOptions()` helper.
+* Flush post caches after Followers migration.
+
+### Added
+
+* Support for WPML post locale
### Removed
@@ -1213,8 +1228,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* initial
-[Unreleased]: https://github.com/Automattic/wordpress-activitypub/compare/4.7.1...trunk
+[Unreleased]: https://github.com/Automattic/wordpress-activitypub/compare/4.7.2...trunk
+[4.7.2]: https://github.com/Automattic/wordpress-activitypub/compare/4.7.1...4.7.2
[4.7.1]: https://github.com/Automattic/wordpress-activitypub/compare/4.7.0...4.7.1
[4.7.0]: https://github.com/Automattic/wordpress-activitypub/compare/4.6.0...4.7.0
[4.6.0]: https://github.com/Automattic/wordpress-activitypub/compare/4.5.1...4.6.0
diff --git a/activitypub.php b/activitypub.php
index 22a23ec49..5960bff86 100644
--- a/activitypub.php
+++ b/activitypub.php
@@ -3,7 +3,7 @@
* Plugin Name: ActivityPub
* Plugin URI: https://github.com/Automattic/wordpress-activitypub
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
- * Version: 4.7.1
+ * Version: 4.7.2
* Author: Matthias Pfefferle & Automattic
* Author URI: https://automattic.com/
* License: MIT
@@ -19,7 +19,7 @@
use WP_CLI;
-\define( 'ACTIVITYPUB_PLUGIN_VERSION', '4.7.1' );
+\define( 'ACTIVITYPUB_PLUGIN_VERSION', '4.7.2' );
// Plugin related constants.
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
diff --git a/bin/release.js b/bin/release.js
new file mode 100644
index 000000000..f022e98df
--- /dev/null
+++ b/bin/release.js
@@ -0,0 +1,177 @@
+#!/usr/bin/env node
+
+const { execSync } = require('child_process');
+const readline = require('readline');
+const fs = require('fs');
+
+const rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout
+});
+
+const question = (query) => new Promise((resolve) => rl.question(query, resolve));
+
+const exec = (command) => {
+ try {
+ return execSync(command, { stdio: 'inherit' });
+ } catch (error) {
+ console.error(`Error executing command: ${command}`);
+ process.exit(1);
+ }
+};
+
+const execWithOutput = (command) => {
+ try {
+ return execSync(command, { stdio: 'pipe' }).toString().trim();
+ } catch (error) {
+ console.error(`Error executing command: ${command}`);
+ process.exit(1);
+ }
+};
+
+const updateVersionInFile = (filePath, version, patterns) => {
+ let content = fs.readFileSync(filePath, 'utf8');
+
+ patterns.forEach(({ search, replace }) => {
+ content = content.replace(
+ search,
+ typeof replace === 'function' ? replace(version) : replace
+ );
+ });
+
+ fs.writeFileSync(filePath, content);
+};
+
+const updateChangelog = (version) => {
+ const date = new Date().toISOString().split('T')[0];
+ const content = fs.readFileSync('CHANGELOG.md', 'utf8');
+
+ // Update the Unreleased section
+ let updated = content.replace(
+ /## \[Unreleased\]/,
+ `## [${version}] - ${date}`
+ );
+
+ // Update the comparison links at the bottom
+ const prevVersion = content.match(/compare\/(\d+\.\d+\.\d+)\.\.\.trunk/)[1];
+ updated = updated.replace(
+ /\[Unreleased\]: .*\n/,
+ `[Unreleased]: https://github.com/Automattic/wordpress-activitypub/compare/${version}...trunk\n`
+ );
+
+ // Add the new version comparison link
+ const newVersionLink = `[${version}]: https://github.com/Automattic/wordpress-activitypub/compare/${prevVersion}...${version}\n`;
+ updated = updated.replace(
+ /\n/,
+ `\n${newVersionLink}`
+ );
+
+ fs.writeFileSync('CHANGELOG.md', updated);
+};
+
+async function createRelease(version) {
+ // Create and checkout release branch
+ const branchName = `release/${version}`;
+ exec(`git checkout -b ${branchName}`);
+
+ // Update version numbers in files
+ updateVersionInFile('activitypub.php', version, [
+ {
+ search: /Version: \d+\.\d+\.\d+/,
+ replace: `Version: ${version}`
+ },
+ {
+ search: /ACTIVITYPUB_PLUGIN_VERSION', '\d+\.\d+\.\d+/,
+ replace: `ACTIVITYPUB_PLUGIN_VERSION', '${version}`
+ }
+ ]);
+
+ updateVersionInFile('readme.txt', version, [
+ {
+ search: /Stable tag: \d+\.\d+\.\d+/,
+ replace: `Stable tag: ${version}`
+ },
+ {
+ search: /= Unreleased =/,
+ replace: `= ${version} =`
+ }
+ ]);
+
+ updateVersionInFile('includes/class-migration.php', version, [
+ {
+ search: /version_compare\([^,]+,\s*['"]unreleased['"]/gi,
+ replace: (match) => match.replace(/unreleased/i, version)
+ }
+ ]);
+
+ // Update CHANGELOG.md
+ updateChangelog(version);
+
+ // Stage and commit changes
+ exec('git add .');
+ exec(`git commit -m "Release ${version}"`);
+
+ // Push to remote
+ exec(`git push -u origin ${branchName}`);
+
+ // Get current user's GitHub username
+ const currentUser = execWithOutput('gh api user --jq .login');
+
+ // Create PR using GitHub CLI and capture the URL
+ console.log('\nCreating draft PR...');
+ const prUrl = execWithOutput(`gh pr create --title "Release ${version}" --body "Release version ${version}" --base trunk --head ${branchName} --draft --reviewer "Automattic/fediverse" --assignee "${currentUser}" --json url --jq .url`);
+
+ // Open PR in browser
+ exec(`open ${prUrl}`);
+}
+
+async function release() {
+ try {
+ // Check if gh CLI is installed
+ try {
+ execSync('gh --version', { stdio: 'ignore' });
+ } catch (error) {
+ console.error('GitHub CLI (gh) is not installed. Please install it first:');
+ console.error('https://cli.github.com/');
+ process.exit(1);
+ }
+
+ // Store current branch
+ const currentBranch = execWithOutput('git rev-parse --abbrev-ref HEAD');
+
+ while (true) {
+ // Get new version
+ const version = await question('\nWhat version would you like to release? (x.x.x): ');
+ if (!/^\d+\.\d+\.\d+$/.test(version)) {
+ console.error('Invalid version format. Please use x.x.x');
+ continue;
+ }
+
+ // Check if release branch already exists
+ const branchExists = execWithOutput(`git branch --list release/${version}`);
+ if (branchExists) {
+ console.error(`\nError: Branch release/${version} already exists.`);
+ // Return to original branch if we're not already there
+ if (currentBranch !== execWithOutput('git rev-parse --abbrev-ref HEAD')) {
+ exec(`git checkout ${currentBranch}`);
+ }
+ continue;
+ }
+
+ // Ensure we're on trunk branch and up to date
+ exec('git checkout trunk');
+ exec('git pull origin trunk');
+
+ await createRelease(version);
+ break;
+ }
+
+ } catch (error) {
+ console.error('An error occurred:', error);
+ process.exit(1);
+ } finally {
+ rl.close();
+ }
+}
+
+release();
diff --git a/build/editor-plugin/plugin.asset.php b/build/editor-plugin/plugin.asset.php
index 13857aafd..548126f53 100644
--- a/build/editor-plugin/plugin.asset.php
+++ b/build/editor-plugin/plugin.asset.php
@@ -1 +1 @@
- array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => 'cdcc2ad2e5f7b1d547fe');
+ array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '6b15195803d2f5a2c116');
diff --git a/build/editor-plugin/plugin.js b/build/editor-plugin/plugin.js
index 38d65259a..1d75171bd 100644
--- a/build/editor-plugin/plugin.js
+++ b/build/editor-plugin/plugin.js
@@ -1 +1 @@
-(()=>{"use strict";var e={20:(e,t,i)=>{var n=i(609),r=Symbol.for("react.element"),o=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,i){var n,c={},s=null,p=null;for(n in void 0!==i&&(s=""+i),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(p=t.ref),t)o.call(t,n)&&!l.hasOwnProperty(n)&&(c[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===c[n]&&(c[n]=t[n]);return{$$typeof:r,type:e,key:s,ref:p,props:c,_owner:a.current}}},848:(e,t,i)=>{e.exports=i(20)},609:e=>{e.exports=window.React}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,i),o.exports}var n=i(609);const r=window.wp.editor,o=window.wp.plugins,a=window.wp.components,l=window.wp.element,c=(0,l.forwardRef)((function({icon:e,size:t=24,...i},n){return(0,l.cloneElement)(e,{width:t,height:t,...i,ref:n})})),s=window.wp.primitives;var p=i(848);const u=(0,p.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(s.Path,{d:"M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"})}),v=(0,p.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(s.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})}),w=(0,p.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(s.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})}),d=window.wp.data,h=window.wp.coreData,_=window.wp.url,y=window.wp.i18n,b=(0,n.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(s.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"}));(0,o.registerPlugin)("activitypub-editor-plugin",{render:()=>{const e=(0,d.useSelect)((e=>e("core/editor").getCurrentPostType()),[]),[t,i]=(0,h.useEntityProp)("postType",e,"meta"),o={verticalAlign:"middle",gap:"4px",justifyContent:"start",display:"inline-flex",alignItems:"center"},l=(e,t)=>(0,n.createElement)(a.__experimentalText,{style:o},(0,n.createElement)(c,{icon:t}),e);return"wp_block"===e?null:(0,n.createElement)(r.PluginDocumentSettingPanel,{name:"activitypub",title:(0,y.__)("⁂ Fediverse","activitypub")},(0,n.createElement)(a.TextControl,{label:(0,y.__)("Content Warning","activitypub"),value:t?.activitypub_content_warning,onChange:e=>{i({...t,activitypub_content_warning:e})},placeholder:(0,y.__)("Optional content warning","activitypub"),help:(0,y.__)("Content warnings do not change the content on your site, only in the fediverse.","activitypub")}),(0,n.createElement)(a.RadioControl,{label:(0,y.__)("Visibility","activitypub"),help:(0,y.__)("This adjusts the visibility of a post in the fediverse, but note that it won't affect how the post appears on the blog.","activitypub"),selected:t?.activitypub_content_visibility||"public",options:[{label:l((0,y.__)("Public","activitypub"),u),value:"public"},{label:l((0,y.__)("Quiet public","activitypub"),v),value:"quiet_public"},{label:l((0,y.__)("Do not federate","activitypub"),b),value:"local"}],onChange:e=>{i({...t,activitypub_content_visibility:e})},className:"activitypub-visibility"}))}}),(0,o.registerPlugin)("activitypub-editor-preview",{render:()=>{const e=(0,d.useSelect)((e=>e("core/editor").getCurrentPost().status));return(0,n.createElement)(n.Fragment,null,r.PluginPreviewMenuItem?(0,n.createElement)(r.PluginPreviewMenuItem,{onClick:()=>function(){const e=(0,d.select)("core/editor").getEditedPostPreviewLink(),t=(0,_.addQueryArgs)(e,{activitypub:"true"});window.open(t,"_blank")}(),icon:w,disabled:"auto-draft"===e},(0,y.__)("⁂ Fediverse preview","activitypub")):null)}})})();
\ No newline at end of file
+(()=>{"use strict";const e=window.React,t=window.wp.editor,i=window.wp.plugins,n=window.wp.components,a=window.wp.element,l=(0,a.forwardRef)((function({icon:e,size:t=24,...i},n){return(0,a.cloneElement)(e,{width:t,height:t,...i,ref:n})})),c=window.wp.primitives,o=(0,e.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(c.Path,{d:"M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"})),r=(0,e.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(c.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})),u=(0,e.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(c.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})),w=window.wp.data,p=window.wp.coreData,v=window.wp.url,s=window.wp.i18n,d=(0,e.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(c.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"}));(0,i.registerPlugin)("activitypub-editor-plugin",{render:()=>{const i=(0,w.useSelect)((e=>e("core/editor").getCurrentPostType()),[]),[a,c]=(0,p.useEntityProp)("postType",i,"meta"),u={verticalAlign:"middle",gap:"4px",justifyContent:"start",display:"inline-flex",alignItems:"center"},v=(t,i)=>(0,e.createElement)(n.__experimentalText,{style:u},(0,e.createElement)(l,{icon:i}),t);return"wp_block"===i?null:(0,e.createElement)(t.PluginDocumentSettingPanel,{name:"activitypub",title:(0,s.__)("⁂ Fediverse","activitypub")},(0,e.createElement)(n.TextControl,{label:(0,s.__)("Content Warning","activitypub"),value:a?.activitypub_content_warning,onChange:e=>{c({...a,activitypub_content_warning:e})},placeholder:(0,s.__)("Optional content warning","activitypub"),help:(0,s.__)("Content warnings do not change the content on your site, only in the fediverse.","activitypub")}),(0,e.createElement)(n.RadioControl,{label:(0,s.__)("Visibility","activitypub"),help:(0,s.__)("This adjusts the visibility of a post in the fediverse, but note that it won't affect how the post appears on the blog.","activitypub"),selected:a?.activitypub_content_visibility||"public",options:[{label:v((0,s.__)("Public","activitypub"),o),value:"public"},{label:v((0,s.__)("Quiet public","activitypub"),r),value:"quiet_public"},{label:v((0,s.__)("Do not federate","activitypub"),d),value:"local"}],onChange:e=>{c({...a,activitypub_content_visibility:e})},className:"activitypub-visibility"}))}}),(0,i.registerPlugin)("activitypub-editor-preview",{render:()=>{const i=(0,w.useSelect)((e=>e("core/editor").getCurrentPost().status));return(0,e.createElement)(e.Fragment,null,t.PluginPreviewMenuItem?(0,e.createElement)(t.PluginPreviewMenuItem,{onClick:()=>function(){const e=(0,w.select)("core/editor").getEditedPostPreviewLink(),t=(0,v.addQueryArgs)(e,{activitypub:"true"});window.open(t,"_blank")}(),icon:u,disabled:"auto-draft"===i},(0,s.__)("⁂ Fediverse preview","activitypub")):null)}})})();
\ No newline at end of file
diff --git a/build/follow-me/index.asset.php b/build/follow-me/index.asset.php
index d5face1ed..c9a909a3e 100644
--- a/build/follow-me/index.asset.php
+++ b/build/follow-me/index.asset.php
@@ -1 +1 @@
- 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' => '62610556ba8e5f129fdf');
+ 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' => '83f77c18c3da9f51d14b');
diff --git a/build/follow-me/index.js b/build/follow-me/index.js
index cd4eff04e..cf75e0f09 100644
--- a/build/follow-me/index.js
+++ b/build/follow-me/index.js
@@ -1,2 +1,2 @@
-(()=>{"use strict";var e,t={399:(e,t,r)=>{const o=window.wp.blocks,n=window.wp.primitives;var i=r(848);const a=(0,i.jsx)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(n.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})});var l=r(609);const c=window.wp.blockEditor,s=window.wp.i18n,u=window.wp.data,p=window.wp.coreData,d=window.wp.components,m=window.wp.element,v=window._activityPubOptions?.enabled,f=window.wp.apiFetch;var y=r.n(f);function b(e){return`var(--wp--preset--color--${e})`}function _(e){if("string"!=typeof e)return null;if(e.match(/^#/))return e.substring(0,7);const[,,t]=e.split("|");return b(t)}function w(e,t,r=null,o=""){return r?`${e}${o} { ${t}: ${r}; }\n`:""}function h(e,t,r,o){return w(e,"background-color",t)+w(e,"color",r)+w(e,"background-color",o,":hover")+w(e,"background-color",o,":focus")}function g({selector:e,style:t,backgroundColor:r}){const o=function(e,t,r){const o=`${e} .components-button`,n=("string"==typeof(i=r)?b(i):i?.color?.background||null)||t?.color?.background;var i;return h(o,_(t?.elements?.link?.color?.text),n,_(t?.elements?.link?.[":hover"]?.color?.text))}(e,t,r);return(0,l.createElement)("style",null,o)}const E=(0,i.jsx)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),k=(0,i.jsx)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,i.jsx)(n.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),x=(0,m.forwardRef)((function({icon:e,size:t=24,...r},o){return(0,m.cloneElement)(e,{width:t,height:t,...r,ref:o})})),S=window.wp.compose,O="fediverse-remote-user";function C(e){try{return new URL(e),!0}catch(e){return!1}}function N({actionText:e,copyDescription:t,handle:r,resourceUrl:o,myProfile:n=!1,rememberProfile:i=!1}){const c=(0,s.__)("Loading...","activitypub"),u=(0,s.__)("Opening...","activitypub"),p=(0,s.__)("Error","activitypub"),v=(0,s.__)("Invalid","activitypub"),f=n||(0,s.__)("My Profile","activitypub"),[b,_]=(0,m.useState)(e),[w,h]=(0,m.useState)(E),g=(0,S.useCopyToClipboard)(r,(()=>{h(k),setTimeout((()=>h(E)),1e3)})),[N,I]=(0,m.useState)(""),[R,U]=(0,m.useState)(!0),{setRemoteUser:P}=function(){const[e,t]=(0,m.useState)(function(){const e=localStorage.getItem(O);return e?JSON.parse(e):{}}()),r=(0,m.useCallback)((e=>{!function(e){localStorage.setItem(O,JSON.stringify(e))}(e),t(e)}),[]),o=(0,m.useCallback)((()=>{localStorage.removeItem(O),t({})}),[]);return{template:e?.template||!1,profileURL:e?.profileURL||!1,setRemoteUser:r,deleteRemoteUser:o}}(),$=(0,m.useCallback)((()=>{let t;if(!C(N)&&!function(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&C(`https://${t[1]}`)}(N))return _(v),t=setTimeout((()=>_(e)),2e3),()=>clearTimeout(t);const r=o+N;_(c),y()({path:r}).then((({url:t,template:r})=>{R&&P({profileURL:N,template:r}),_(u),setTimeout((()=>{window.open(t,"_blank"),_(e)}),200)})).catch((()=>{_(p),setTimeout((()=>_(e)),2e3)}))}),[N]);return(0,l.createElement)("div",{className:"activitypub__dialog",role:"dialog","aria-labelledby":"dialog-title"},(0,l.createElement)("div",{className:"activitypub-dialog__section"},(0,l.createElement)("h4",{id:"dialog-title"},f),(0,l.createElement)("div",{className:"activitypub-dialog__description",id:"copy-description"},t),(0,l.createElement)("div",{className:"activitypub-dialog__button-group"},(0,l.createElement)("label",{htmlFor:"profile-handle",className:"screen-reader-text"},t),(0,l.createElement)("input",{type:"text",id:"profile-handle",value:r,readOnly:!0}),(0,l.createElement)(d.Button,{ref:g,"aria-label":(0,s.__)("Copy handle to clipboard","activitypub")},(0,l.createElement)(x,{icon:w}),(0,s.__)("Copy","activitypub")))),(0,l.createElement)("div",{className:"activitypub-dialog__section"},(0,l.createElement)("h4",{id:"remote-profile-title"},(0,s.__)("Your Profile","activitypub")),(0,l.createElement)("div",{className:"activitypub-dialog__description",id:"remote-profile-description"},(0,m.createInterpolateElement)((0,s.__)("Or, if you know your own profile, we can start things that way! (eg @yourusername@example.com
)","activitypub"),{code:(0,l.createElement)("code",null)})),(0,l.createElement)("div",{className:"activitypub-dialog__button-group"},(0,l.createElement)("label",{htmlFor:"remote-profile",className:"screen-reader-text"},(0,s.__)("Enter your ActivityPub profile","activitypub")),(0,l.createElement)("input",{type:"text",id:"remote-profile",value:N,onKeyDown:e=>{"Enter"===e?.code&&$()},onChange:e=>I(e.target.value),"aria-invalid":b===v}),(0,l.createElement)(d.Button,{onClick:$,"aria-label":(0,s.__)("Submit profile","activitypub")},(0,l.createElement)(x,{icon:a}),b)),i&&(0,l.createElement)("div",{className:"activitypub-dialog__remember"},(0,l.createElement)(d.CheckboxControl,{checked:R,label:(0,s.__)("Remember me for easier comments","activitypub"),onChange:()=>{U(!R)}}))))}const{namespace:I}=window._activityPubOptions,R={avatar:"",webfinger:"@well@hello.dolly",name:(0,s.__)("Hello Dolly Fan Account","activitypub"),url:"#"};function U(e){if(!e)return R;const t={...R,...e};return t.avatar=t?.icon?.url,t}function P({profile:e,popupStyles:t,userId:r}){const{webfinger:o,avatar:n,name:i}=e,a=o.startsWith("@")?o:`@${o}`;return(0,l.createElement)("div",{className:"activitypub-profile"},(0,l.createElement)("img",{className:"activitypub-profile__avatar",src:n,alt:i}),(0,l.createElement)("div",{className:"activitypub-profile__content"},(0,l.createElement)("div",{className:"activitypub-profile__name"},i),(0,l.createElement)("div",{className:"activitypub-profile__handle",title:a},a)),(0,l.createElement)($,{profile:e,popupStyles:t,userId:r}))}function $({profile:e,popupStyles:t,userId:r}){const[o,n]=(0,m.useState)(!1),i=(0,s.sprintf)((0,s.__)("Follow %s","activitypub"),e?.name);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(d.Button,{className:"activitypub-profile__follow",onClick:()=>n(!0),"aria-haspopup":"dialog","aria-expanded":o,"aria-label":(0,s.__)("Follow me on the Fediverse","activitypub")},(0,s.__)("Follow","activitypub")),o&&(0,l.createElement)(d.Modal,{className:"activitypub-profile__confirm activitypub__modal",onRequestClose:()=>n(!1),title:i,"aria-label":i,role:"dialog"},(0,l.createElement)(T,{profile:e,userId:r}),(0,l.createElement)("style",null,t)))}function T({profile:e,userId:t}){const{webfinger:r}=e,o=(0,s.__)("Follow","activitypub"),n=`/${I}/actors/${t}/remote-follow?resource=`,i=(0,s.__)("Copy and paste my profile into the search field of your favorite fediverse app or server.","activitypub"),a=r.startsWith("@")?r:`@${r}`;return(0,l.createElement)(N,{actionText:o,copyDescription:i,handle:a,resourceUrl:n})}function j({selectedUser:e,style:t,backgroundColor:r,id:o,useId:n=!1,profileData:i=!1}){const[a,c]=(0,m.useState)(U()),s="site"===e?0:e,u=function(e){return h(".apfmd__button-group .components-button",_(e?.elements?.link?.color?.text)||"#111","#fff",_(e?.elements?.link?.[":hover"]?.color?.text)||"#333")}(t),p=n?{id:o}:{};function d(e){c(U(e))}return(0,m.useEffect)((()=>{if(i)return d(i);(function(e){const t={headers:{Accept:"application/activity+json"},path:`/${I}/actors/${e}`};return y()(t)})(s).then(d)}),[s,i]),(0,l.createElement)("div",{...p},(0,l.createElement)(g,{selector:`#${o}`,style:t,backgroundColor:r}),(0,l.createElement)(P,{profile:a,userId:s,popupStyles:u}))}const F=window._activityPubOptions?.enabled;function B({name:e}){const t=F?.site?"":(0,s.__)("It will be empty in other non-author contexts.","activitypub"),r=(0,s.sprintf)(/* translators: %1$s: block name, %2$s: extra information for non-author context */ /* translators: %1$s: block name, %2$s: extra information for non-author context */
-(0,s.__)("This %1$s block will adapt to the page it is on, displaying the user profile associated with a post author (in a loop) or a user archive. %2$s","activitypub"),e,t).trim();return(0,l.createElement)(d.Card,null,(0,l.createElement)(d.CardBody,null,(0,m.createInterpolateElement)(r,{strong:(0,l.createElement)("strong",null)})))}(0,o.registerBlockType)("activitypub/follow-me",{edit:function({attributes:e,setAttributes:t,context:{postType:r,postId:o}}){const n=(0,c.useBlockProps)({className:"activitypub-follow-me-block-wrapper"}),i=function({withInherit:e=!1}){const t=v?.users?(0,u.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,m.useMemo)((()=>{if(!t)return[];const r=[];return v?.site&&r.push({label:(0,s.__)("Site","activitypub"),value:"site"}),e&&v?.users&&r.push({label:(0,s.__)("Dynamic User","activitypub"),value:"inherit"}),t.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),r)}),[t])}({withInherit:!0}),{selectedUser:a}=e,f="inherit"===a,y=(0,u.useSelect)((e=>{const{getEditedEntityRecord:t}=e(p.store),n=t("postType",r,o)?.author;return null!=n?n:null}),[r,o]);return(0,m.useEffect)((()=>{i.length&&(i.find((({value:e})=>e===a))||t({selectedUser:i[0].value}))}),[a,i]),(0,l.createElement)("div",{...n},i.length>1&&(0,l.createElement)(c.InspectorControls,{key:"setting"},(0,l.createElement)(d.PanelBody,{title:(0,s.__)("Followers Options","activitypub")},(0,l.createElement)(d.SelectControl,{label:(0,s.__)("Select User","activitypub"),value:e.selectedUser,options:i,onChange:e=>t({selectedUser:e})}))),f?y?(0,l.createElement)(j,{...e,id:n.id,selectedUser:y}):(0,l.createElement)(B,{name:(0,s.__)("Follow Me","activitypub")}):(0,l.createElement)(j,{...e,id:n.id}))},save:()=>null,icon:a})},20:(e,t,r)=>{var o=r(609),n=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,r){var o,c={},s=null,u=null;for(o in void 0!==r&&(s=""+r),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(u=t.ref),t)i.call(t,o)&&!l.hasOwnProperty(o)&&(c[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===c[o]&&(c[o]=t[o]);return{$$typeof:n,type:e,key:s,ref:u,props:c,_owner:a.current}}},848:(e,t,r)=>{e.exports=r(20)},609:e=>{e.exports=window.React}},r={};function o(e){var n=r[e];if(void 0!==n)return n.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.m=t,e=[],o.O=(t,r,n,i)=>{if(!r){var a=1/0;for(u=0;u=i)&&Object.keys(o.O).every((e=>o.O[e](r[c])))?r.splice(c--,1):(l=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[r,n,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={338:0,301:0};o.O.j=t=>0===e[t];var t=(t,r)=>{var n,i,a=r[0],l=r[1],c=r[2],s=0;if(a.some((t=>0!==e[t]))){for(n in l)o.o(l,n)&&(o.m[n]=l[n]);if(c)var u=c(o)}for(t&&t(r);so(399)));n=o.O(n)})();
\ No newline at end of file
+(()=>{"use strict";var e,t={60:(e,t,r)=>{const o=window.wp.blocks,a=window.React,n=window.wp.primitives,i=(0,a.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(n.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})),l=window.wp.blockEditor,c=window.wp.i18n,s=window.wp.data,u=window.wp.coreData,p=window.wp.components,m=window.wp.element;function d(){return window._activityPubOptions||{}}const v=window.wp.apiFetch;var f=r.n(v);function b(e){return`var(--wp--preset--color--${e})`}function y(e){if("string"!=typeof e)return null;if(e.match(/^#/))return e.substring(0,7);const[,,t]=e.split("|");return b(t)}function h(e,t,r=null,o=""){return r?`${e}${o} { ${t}: ${r}; }\n`:""}function _(e,t,r,o){return h(e,"background-color",t)+h(e,"color",r)+h(e,"background-color",o,":hover")+h(e,"background-color",o,":focus")}function w({selector:e,style:t,backgroundColor:r}){const o=function(e,t,r){const o=`${e} .components-button`,a=("string"==typeof(n=r)?b(n):n?.color?.background||null)||t?.color?.background;var n;return _(o,y(t?.elements?.link?.color?.text),a,y(t?.elements?.link?.[":hover"]?.color?.text))}(e,t,r);return(0,a.createElement)("style",null,o)}const g=(0,a.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})),E=(0,a.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(n.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),k=(0,m.forwardRef)((function({icon:e,size:t=24,...r},o){return(0,m.cloneElement)(e,{width:t,height:t,...r,ref:o})})),x=window.wp.compose,C="fediverse-remote-user";function S(e){try{return new URL(e),!0}catch(e){return!1}}function N({actionText:e,copyDescription:t,handle:r,resourceUrl:o,myProfile:n=!1,rememberProfile:l=!1}){const s=(0,c.__)("Loading...","activitypub"),u=(0,c.__)("Opening...","activitypub"),d=(0,c.__)("Error","activitypub"),v=(0,c.__)("Invalid","activitypub"),b=n||(0,c.__)("My Profile","activitypub"),[y,h]=(0,m.useState)(e),[_,w]=(0,m.useState)(g),N=(0,x.useCopyToClipboard)(r,(()=>{w(E),setTimeout((()=>w(g)),1e3)})),[I,O]=(0,m.useState)(""),[U,$]=(0,m.useState)(!0),{setRemoteUser:R}=function(){const[e,t]=(0,m.useState)(function(){const e=localStorage.getItem(C);return e?JSON.parse(e):{}}()),r=(0,m.useCallback)((e=>{!function(e){localStorage.setItem(C,JSON.stringify(e))}(e),t(e)}),[]),o=(0,m.useCallback)((()=>{localStorage.removeItem(C),t({})}),[]);return{template:e?.template||!1,profileURL:e?.profileURL||!1,setRemoteUser:r,deleteRemoteUser:o}}(),T=(0,m.useCallback)((()=>{let t;if(!S(I)&&!function(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&S(`https://${t[1]}`)}(I))return h(v),t=setTimeout((()=>h(e)),2e3),()=>clearTimeout(t);const r=o+I;h(s),f()({path:r}).then((({url:t,template:r})=>{U&&R({profileURL:I,template:r}),h(u),setTimeout((()=>{window.open(t,"_blank"),h(e)}),200)})).catch((()=>{h(d),setTimeout((()=>h(e)),2e3)}))}),[I]);return(0,a.createElement)("div",{className:"activitypub__dialog",role:"dialog","aria-labelledby":"dialog-title"},(0,a.createElement)("div",{className:"activitypub-dialog__section"},(0,a.createElement)("h4",{id:"dialog-title"},b),(0,a.createElement)("div",{className:"activitypub-dialog__description",id:"copy-description"},t),(0,a.createElement)("div",{className:"activitypub-dialog__button-group"},(0,a.createElement)("label",{htmlFor:"profile-handle",className:"screen-reader-text"},t),(0,a.createElement)("input",{type:"text",id:"profile-handle",value:r,readOnly:!0}),(0,a.createElement)(p.Button,{ref:N,"aria-label":(0,c.__)("Copy handle to clipboard","activitypub")},(0,a.createElement)(k,{icon:_}),(0,c.__)("Copy","activitypub")))),(0,a.createElement)("div",{className:"activitypub-dialog__section"},(0,a.createElement)("h4",{id:"remote-profile-title"},(0,c.__)("Your Profile","activitypub")),(0,a.createElement)("div",{className:"activitypub-dialog__description",id:"remote-profile-description"},(0,m.createInterpolateElement)((0,c.__)("Or, if you know your own profile, we can start things that way! (eg @yourusername@example.com
)","activitypub"),{code:(0,a.createElement)("code",null)})),(0,a.createElement)("div",{className:"activitypub-dialog__button-group"},(0,a.createElement)("label",{htmlFor:"remote-profile",className:"screen-reader-text"},(0,c.__)("Enter your ActivityPub profile","activitypub")),(0,a.createElement)("input",{type:"text",id:"remote-profile",value:I,onKeyDown:e=>{"Enter"===e?.code&&T()},onChange:e=>O(e.target.value),"aria-invalid":y===v}),(0,a.createElement)(p.Button,{onClick:T,"aria-label":(0,c.__)("Submit profile","activitypub")},(0,a.createElement)(k,{icon:i}),y)),l&&(0,a.createElement)("div",{className:"activitypub-dialog__remember"},(0,a.createElement)(p.CheckboxControl,{checked:U,label:(0,c.__)("Remember me for easier comments","activitypub"),onChange:()=>{$(!U)}}))))}const I={avatar:"",webfinger:"@well@hello.dolly",name:(0,c.__)("Hello Dolly Fan Account","activitypub"),url:"#"};function O(e){if(!e)return I;const t={...I,...e};return t.avatar=t?.icon?.url,t}function U({profile:e,popupStyles:t,userId:r}){const{webfinger:o,avatar:n,name:i}=e,l=o.startsWith("@")?o:`@${o}`;return(0,a.createElement)("div",{className:"activitypub-profile"},(0,a.createElement)("img",{className:"activitypub-profile__avatar",src:n,alt:i}),(0,a.createElement)("div",{className:"activitypub-profile__content"},(0,a.createElement)("div",{className:"activitypub-profile__name"},i),(0,a.createElement)("div",{className:"activitypub-profile__handle",title:l},l)),(0,a.createElement)($,{profile:e,popupStyles:t,userId:r}))}function $({profile:e,popupStyles:t,userId:r}){const[o,n]=(0,m.useState)(!1),i=(0,c.sprintf)((0,c.__)("Follow %s","activitypub"),e?.name);return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(p.Button,{className:"activitypub-profile__follow",onClick:()=>n(!0),"aria-haspopup":"dialog","aria-expanded":o,"aria-label":(0,c.__)("Follow me on the Fediverse","activitypub")},(0,c.__)("Follow","activitypub")),o&&(0,a.createElement)(p.Modal,{className:"activitypub-profile__confirm activitypub__modal",onRequestClose:()=>n(!1),title:i,"aria-label":i,role:"dialog"},(0,a.createElement)(R,{profile:e,userId:r}),(0,a.createElement)("style",null,t)))}function R({profile:e,userId:t}){const{namespace:r}=d(),{webfinger:o}=e,n=(0,c.__)("Follow","activitypub"),i=`/${r}/actors/${t}/remote-follow?resource=`,l=(0,c.__)("Copy and paste my profile into the search field of your favorite fediverse app or server.","activitypub"),s=o.startsWith("@")?o:`@${o}`;return(0,a.createElement)(N,{actionText:n,copyDescription:l,handle:s,resourceUrl:i})}function T({selectedUser:e,style:t,backgroundColor:r,id:o,useId:n=!1,profileData:i=!1}){const[l,c]=(0,m.useState)(O()),s="site"===e?0:e,u=function(e){return _(".apfmd__button-group .components-button",y(e?.elements?.link?.color?.text)||"#111","#fff",y(e?.elements?.link?.[":hover"]?.color?.text)||"#333")}(t),p=n?{id:o}:{};function v(e){c(O(e))}return(0,m.useEffect)((()=>{if(i)return v(i);(function(e){const{namespace:t}=d(),r={headers:{Accept:"application/activity+json"},path:`/${t}/actors/${e}`};return f()(r)})(s).then(v)}),[s,i]),(0,a.createElement)("div",{...p},(0,a.createElement)(w,{selector:`#${o}`,style:t,backgroundColor:r}),(0,a.createElement)(U,{profile:l,userId:s,popupStyles:u}))}function P({name:e}){const{enabled:t}=d(),r=t?.site?"":(0,c.__)("It will be empty in other non-author contexts.","activitypub"),o=(0,c.sprintf)(/* translators: %1$s: block name, %2$s: extra information for non-author context */ /* translators: %1$s: block name, %2$s: extra information for non-author context */
+(0,c.__)("This %1$s block will adapt to the page it is on, displaying the user profile associated with a post author (in a loop) or a user archive. %2$s","activitypub"),e,r).trim();return(0,a.createElement)(p.Card,null,(0,a.createElement)(p.CardBody,null,(0,m.createInterpolateElement)(o,{strong:(0,a.createElement)("strong",null)})))}(0,o.registerBlockType)("activitypub/follow-me",{edit:function({attributes:e,setAttributes:t,context:{postType:r,postId:o}}){const n=(0,l.useBlockProps)({className:"activitypub-follow-me-block-wrapper"}),i=function({withInherit:e=!1}){const{enabled:t}=d(),r=t?.users?(0,s.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,m.useMemo)((()=>{if(!r)return[];const o=[];return t?.site&&o.push({label:(0,c.__)("Site","activitypub"),value:"site"}),e&&t?.users&&o.push({label:(0,c.__)("Dynamic User","activitypub"),value:"inherit"}),r.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),o)}),[r])}({withInherit:!0}),{selectedUser:v}=e,f="inherit"===v,b=(0,s.useSelect)((e=>{const{getEditedEntityRecord:t}=e(u.store),a=t("postType",r,o)?.author;return null!=a?a:null}),[r,o]);return(0,m.useEffect)((()=>{i.length&&(i.find((({value:e})=>e===v))||t({selectedUser:i[0].value}))}),[v,i]),(0,a.createElement)("div",{...n},i.length>1&&(0,a.createElement)(l.InspectorControls,{key:"setting"},(0,a.createElement)(p.PanelBody,{title:(0,c.__)("Followers Options","activitypub")},(0,a.createElement)(p.SelectControl,{label:(0,c.__)("Select User","activitypub"),value:e.selectedUser,options:i,onChange:e=>t({selectedUser:e})}))),f?b?(0,a.createElement)(T,{...e,id:n.id,selectedUser:b}):(0,a.createElement)(P,{name:(0,c.__)("Follow Me","activitypub")}):(0,a.createElement)(T,{...e,id:n.id}))},save:()=>null,icon:i})}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.m=t,e=[],o.O=(t,r,a,n)=>{if(!r){var i=1/0;for(u=0;u=n)&&Object.keys(o.O).every((e=>o.O[e](r[c])))?r.splice(c--,1):(l=!1,n0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[r,a,n]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={338:0,301:0};o.O.j=t=>0===e[t];var t=(t,r)=>{var a,n,[i,l,c]=r,s=0;if(i.some((t=>0!==e[t]))){for(a in l)o.o(l,a)&&(o.m[a]=l[a]);if(c)var u=c(o)}for(t&&t(r);so(60)));a=o.O(a)})();
\ No newline at end of file
diff --git a/build/follow-me/view.asset.php b/build/follow-me/view.asset.php
index 5068f4ba1..94ce6bf25 100644
--- a/build/follow-me/view.asset.php
+++ b/build/follow-me/view.asset.php
@@ -1 +1 @@
- array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '8008189b4c59111938ec');
+ array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'e73363caa1732d86861b');
diff --git a/build/follow-me/view.js b/build/follow-me/view.js
index 72946cd37..73933188e 100644
--- a/build/follow-me/view.js
+++ b/build/follow-me/view.js
@@ -1 +1 @@
-(()=>{"use strict";var e,t={729:(e,t,r)=>{var o=r(609);const a=window.wp.element,n=window.wp.domReady;var i=r.n(n);const l=window.wp.apiFetch;var c=r.n(l);const s=window.wp.components,u=window.wp.i18n;function p(e){return`var(--wp--preset--color--${e})`}function d(e){if("string"!=typeof e)return null;if(e.match(/^#/))return e.substring(0,7);const[,,t]=e.split("|");return p(t)}function m(e,t,r=null,o=""){return r?`${e}${o} { ${t}: ${r}; }\n`:""}function v(e,t,r,o){return m(e,"background-color",t)+m(e,"color",r)+m(e,"background-color",o,":hover")+m(e,"background-color",o,":focus")}function f({selector:e,style:t,backgroundColor:r}){const a=function(e,t,r){const o=`${e} .components-button`,a=("string"==typeof(n=r)?p(n):n?.color?.background||null)||t?.color?.background;var n;return v(o,d(t?.elements?.link?.color?.text),a,d(t?.elements?.link?.[":hover"]?.color?.text))}(e,t,r);return(0,o.createElement)("style",null,a)}const y=window.wp.primitives;var b=r(848);const _=(0,b.jsx)(y.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,b.jsx)(y.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),w=(0,b.jsx)(y.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,b.jsx)(y.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),h=(0,a.forwardRef)((function({icon:e,size:t=24,...r},o){return(0,a.cloneElement)(e,{width:t,height:t,...r,ref:o})})),g=(0,b.jsx)(y.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,b.jsx)(y.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})}),E=window.wp.compose,k="fediverse-remote-user";function x(e){try{return new URL(e),!0}catch(e){return!1}}function S({actionText:e,copyDescription:t,handle:r,resourceUrl:n,myProfile:i=!1,rememberProfile:l=!1}){const p=(0,u.__)("Loading...","activitypub"),d=(0,u.__)("Opening...","activitypub"),m=(0,u.__)("Error","activitypub"),v=(0,u.__)("Invalid","activitypub"),f=i||(0,u.__)("My Profile","activitypub"),[y,b]=(0,a.useState)(e),[S,O]=(0,a.useState)(_),N=(0,E.useCopyToClipboard)(r,(()=>{O(w),setTimeout((()=>O(_)),1e3)})),[C,R]=(0,a.useState)(""),[I,$]=(0,a.useState)(!0),{setRemoteUser:P}=function(){const[e,t]=(0,a.useState)(function(){const e=localStorage.getItem(k);return e?JSON.parse(e):{}}()),r=(0,a.useCallback)((e=>{!function(e){localStorage.setItem(k,JSON.stringify(e))}(e),t(e)}),[]),o=(0,a.useCallback)((()=>{localStorage.removeItem(k),t({})}),[]);return{template:e?.template||!1,profileURL:e?.profileURL||!1,setRemoteUser:r,deleteRemoteUser:o}}(),j=(0,a.useCallback)((()=>{let t;if(!x(C)&&!function(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&x(`https://${t[1]}`)}(C))return b(v),t=setTimeout((()=>b(e)),2e3),()=>clearTimeout(t);const r=n+C;b(p),c()({path:r}).then((({url:t,template:r})=>{I&&P({profileURL:C,template:r}),b(d),setTimeout((()=>{window.open(t,"_blank"),b(e)}),200)})).catch((()=>{b(m),setTimeout((()=>b(e)),2e3)}))}),[C]);return(0,o.createElement)("div",{className:"activitypub__dialog",role:"dialog","aria-labelledby":"dialog-title"},(0,o.createElement)("div",{className:"activitypub-dialog__section"},(0,o.createElement)("h4",{id:"dialog-title"},f),(0,o.createElement)("div",{className:"activitypub-dialog__description",id:"copy-description"},t),(0,o.createElement)("div",{className:"activitypub-dialog__button-group"},(0,o.createElement)("label",{htmlFor:"profile-handle",className:"screen-reader-text"},t),(0,o.createElement)("input",{type:"text",id:"profile-handle",value:r,readOnly:!0}),(0,o.createElement)(s.Button,{ref:N,"aria-label":(0,u.__)("Copy handle to clipboard","activitypub")},(0,o.createElement)(h,{icon:S}),(0,u.__)("Copy","activitypub")))),(0,o.createElement)("div",{className:"activitypub-dialog__section"},(0,o.createElement)("h4",{id:"remote-profile-title"},(0,u.__)("Your Profile","activitypub")),(0,o.createElement)("div",{className:"activitypub-dialog__description",id:"remote-profile-description"},(0,a.createInterpolateElement)((0,u.__)("Or, if you know your own profile, we can start things that way! (eg @yourusername@example.com
)","activitypub"),{code:(0,o.createElement)("code",null)})),(0,o.createElement)("div",{className:"activitypub-dialog__button-group"},(0,o.createElement)("label",{htmlFor:"remote-profile",className:"screen-reader-text"},(0,u.__)("Enter your ActivityPub profile","activitypub")),(0,o.createElement)("input",{type:"text",id:"remote-profile",value:C,onKeyDown:e=>{"Enter"===e?.code&&j()},onChange:e=>R(e.target.value),"aria-invalid":y===v}),(0,o.createElement)(s.Button,{onClick:j,"aria-label":(0,u.__)("Submit profile","activitypub")},(0,o.createElement)(h,{icon:g}),y)),l&&(0,o.createElement)("div",{className:"activitypub-dialog__remember"},(0,o.createElement)(s.CheckboxControl,{checked:I,label:(0,u.__)("Remember me for easier comments","activitypub"),onChange:()=>{$(!I)}}))))}const{namespace:O}=window._activityPubOptions,N={avatar:"",webfinger:"@well@hello.dolly",name:(0,u.__)("Hello Dolly Fan Account","activitypub"),url:"#"};function C(e){if(!e)return N;const t={...N,...e};return t.avatar=t?.icon?.url,t}function R({profile:e,popupStyles:t,userId:r}){const{webfinger:a,avatar:n,name:i}=e,l=a.startsWith("@")?a:`@${a}`;return(0,o.createElement)("div",{className:"activitypub-profile"},(0,o.createElement)("img",{className:"activitypub-profile__avatar",src:n,alt:i}),(0,o.createElement)("div",{className:"activitypub-profile__content"},(0,o.createElement)("div",{className:"activitypub-profile__name"},i),(0,o.createElement)("div",{className:"activitypub-profile__handle",title:l},l)),(0,o.createElement)(I,{profile:e,popupStyles:t,userId:r}))}function I({profile:e,popupStyles:t,userId:r}){const[n,i]=(0,a.useState)(!1),l=(0,u.sprintf)((0,u.__)("Follow %s","activitypub"),e?.name);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(s.Button,{className:"activitypub-profile__follow",onClick:()=>i(!0),"aria-haspopup":"dialog","aria-expanded":n,"aria-label":(0,u.__)("Follow me on the Fediverse","activitypub")},(0,u.__)("Follow","activitypub")),n&&(0,o.createElement)(s.Modal,{className:"activitypub-profile__confirm activitypub__modal",onRequestClose:()=>i(!1),title:l,"aria-label":l,role:"dialog"},(0,o.createElement)($,{profile:e,userId:r}),(0,o.createElement)("style",null,t)))}function $({profile:e,userId:t}){const{webfinger:r}=e,a=(0,u.__)("Follow","activitypub"),n=`/${O}/actors/${t}/remote-follow?resource=`,i=(0,u.__)("Copy and paste my profile into the search field of your favorite fediverse app or server.","activitypub"),l=r.startsWith("@")?r:`@${r}`;return(0,o.createElement)(S,{actionText:a,copyDescription:i,handle:l,resourceUrl:n})}function P({selectedUser:e,style:t,backgroundColor:r,id:n,useId:i=!1,profileData:l=!1}){const[s,u]=(0,a.useState)(C()),p="site"===e?0:e,m=function(e){return v(".apfmd__button-group .components-button",d(e?.elements?.link?.color?.text)||"#111","#fff",d(e?.elements?.link?.[":hover"]?.color?.text)||"#333")}(t),y=i?{id:n}:{};function b(e){u(C(e))}return(0,a.useEffect)((()=>{if(l)return b(l);(function(e){const t={headers:{Accept:"application/activity+json"},path:`/${O}/actors/${e}`};return c()(t)})(p).then(b)}),[p,l]),(0,o.createElement)("div",{...y},(0,o.createElement)(f,{selector:`#${n}`,style:t,backgroundColor:r}),(0,o.createElement)(R,{profile:s,userId:p,popupStyles:m}))}let j=1;i()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follow-me-block-wrapper"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,a.createRoot)(e).render((0,o.createElement)(P,{...t,id:"activitypub-follow-me-block-"+j++,useId:!0}))}))}))},20:(e,t,r)=>{var o=r(609),a=Symbol.for("react.element"),n=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,r){var o,c={},s=null,u=null;for(o in void 0!==r&&(s=""+r),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(u=t.ref),t)n.call(t,o)&&!l.hasOwnProperty(o)&&(c[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===c[o]&&(c[o]=t[o]);return{$$typeof:a,type:e,key:s,ref:u,props:c,_owner:i.current}}},848:(e,t,r)=>{e.exports=r(20)},609:e=>{e.exports=window.React}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.m=t,e=[],o.O=(t,r,a,n)=>{if(!r){var i=1/0;for(u=0;u=n)&&Object.keys(o.O).every((e=>o.O[e](r[c])))?r.splice(c--,1):(l=!1,n0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[r,a,n]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={41:0,301:0};o.O.j=t=>0===e[t];var t=(t,r)=>{var a,n,i=r[0],l=r[1],c=r[2],s=0;if(i.some((t=>0!==e[t]))){for(a in l)o.o(l,a)&&(o.m[a]=l[a]);if(c)var u=c(o)}for(t&&t(r);so(729)));a=o.O(a)})();
\ No newline at end of file
+(()=>{"use strict";var e,t={300:(e,t,r)=>{const o=window.React,a=window.wp.element,n=window.wp.domReady;var i=r.n(n);const l=window.wp.apiFetch;var c=r.n(l);const s=window.wp.components,u=window.wp.i18n;function p(e){return`var(--wp--preset--color--${e})`}function m(e){if("string"!=typeof e)return null;if(e.match(/^#/))return e.substring(0,7);const[,,t]=e.split("|");return p(t)}function d(e,t,r=null,o=""){return r?`${e}${o} { ${t}: ${r}; }\n`:""}function v(e,t,r,o){return d(e,"background-color",t)+d(e,"color",r)+d(e,"background-color",o,":hover")+d(e,"background-color",o,":focus")}function f({selector:e,style:t,backgroundColor:r}){const a=function(e,t,r){const o=`${e} .components-button`,a=("string"==typeof(n=r)?p(n):n?.color?.background||null)||t?.color?.background;var n;return v(o,m(t?.elements?.link?.color?.text),a,m(t?.elements?.link?.[":hover"]?.color?.text))}(e,t,r);return(0,o.createElement)("style",null,a)}const b=window.wp.primitives,y=(0,o.createElement)(b.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(b.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})),_=(0,o.createElement)(b.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(b.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),w=(0,a.forwardRef)((function({icon:e,size:t=24,...r},o){return(0,a.cloneElement)(e,{width:t,height:t,...r,ref:o})})),h=(0,o.createElement)(b.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(b.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})),g=window.wp.compose,E="fediverse-remote-user";function k(e){try{return new URL(e),!0}catch(e){return!1}}function x({actionText:e,copyDescription:t,handle:r,resourceUrl:n,myProfile:i=!1,rememberProfile:l=!1}){const p=(0,u.__)("Loading...","activitypub"),m=(0,u.__)("Opening...","activitypub"),d=(0,u.__)("Error","activitypub"),v=(0,u.__)("Invalid","activitypub"),f=i||(0,u.__)("My Profile","activitypub"),[b,x]=(0,a.useState)(e),[S,C]=(0,a.useState)(y),N=(0,g.useCopyToClipboard)(r,(()=>{C(_),setTimeout((()=>C(y)),1e3)})),[O,R]=(0,a.useState)(""),[$,I]=(0,a.useState)(!0),{setRemoteUser:P}=function(){const[e,t]=(0,a.useState)(function(){const e=localStorage.getItem(E);return e?JSON.parse(e):{}}()),r=(0,a.useCallback)((e=>{!function(e){localStorage.setItem(E,JSON.stringify(e))}(e),t(e)}),[]),o=(0,a.useCallback)((()=>{localStorage.removeItem(E),t({})}),[]);return{template:e?.template||!1,profileURL:e?.profileURL||!1,setRemoteUser:r,deleteRemoteUser:o}}(),F=(0,a.useCallback)((()=>{let t;if(!k(O)&&!function(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&k(`https://${t[1]}`)}(O))return x(v),t=setTimeout((()=>x(e)),2e3),()=>clearTimeout(t);const r=n+O;x(p),c()({path:r}).then((({url:t,template:r})=>{$&&P({profileURL:O,template:r}),x(m),setTimeout((()=>{window.open(t,"_blank"),x(e)}),200)})).catch((()=>{x(d),setTimeout((()=>x(e)),2e3)}))}),[O]);return(0,o.createElement)("div",{className:"activitypub__dialog",role:"dialog","aria-labelledby":"dialog-title"},(0,o.createElement)("div",{className:"activitypub-dialog__section"},(0,o.createElement)("h4",{id:"dialog-title"},f),(0,o.createElement)("div",{className:"activitypub-dialog__description",id:"copy-description"},t),(0,o.createElement)("div",{className:"activitypub-dialog__button-group"},(0,o.createElement)("label",{htmlFor:"profile-handle",className:"screen-reader-text"},t),(0,o.createElement)("input",{type:"text",id:"profile-handle",value:r,readOnly:!0}),(0,o.createElement)(s.Button,{ref:N,"aria-label":(0,u.__)("Copy handle to clipboard","activitypub")},(0,o.createElement)(w,{icon:S}),(0,u.__)("Copy","activitypub")))),(0,o.createElement)("div",{className:"activitypub-dialog__section"},(0,o.createElement)("h4",{id:"remote-profile-title"},(0,u.__)("Your Profile","activitypub")),(0,o.createElement)("div",{className:"activitypub-dialog__description",id:"remote-profile-description"},(0,a.createInterpolateElement)((0,u.__)("Or, if you know your own profile, we can start things that way! (eg @yourusername@example.com
)","activitypub"),{code:(0,o.createElement)("code",null)})),(0,o.createElement)("div",{className:"activitypub-dialog__button-group"},(0,o.createElement)("label",{htmlFor:"remote-profile",className:"screen-reader-text"},(0,u.__)("Enter your ActivityPub profile","activitypub")),(0,o.createElement)("input",{type:"text",id:"remote-profile",value:O,onKeyDown:e=>{"Enter"===e?.code&&F()},onChange:e=>R(e.target.value),"aria-invalid":b===v}),(0,o.createElement)(s.Button,{onClick:F,"aria-label":(0,u.__)("Submit profile","activitypub")},(0,o.createElement)(w,{icon:h}),b)),l&&(0,o.createElement)("div",{className:"activitypub-dialog__remember"},(0,o.createElement)(s.CheckboxControl,{checked:$,label:(0,u.__)("Remember me for easier comments","activitypub"),onChange:()=>{I(!$)}}))))}function S(){return window._activityPubOptions||{}}const C={avatar:"",webfinger:"@well@hello.dolly",name:(0,u.__)("Hello Dolly Fan Account","activitypub"),url:"#"};function N(e){if(!e)return C;const t={...C,...e};return t.avatar=t?.icon?.url,t}function O({profile:e,popupStyles:t,userId:r}){const{webfinger:a,avatar:n,name:i}=e,l=a.startsWith("@")?a:`@${a}`;return(0,o.createElement)("div",{className:"activitypub-profile"},(0,o.createElement)("img",{className:"activitypub-profile__avatar",src:n,alt:i}),(0,o.createElement)("div",{className:"activitypub-profile__content"},(0,o.createElement)("div",{className:"activitypub-profile__name"},i),(0,o.createElement)("div",{className:"activitypub-profile__handle",title:l},l)),(0,o.createElement)(R,{profile:e,popupStyles:t,userId:r}))}function R({profile:e,popupStyles:t,userId:r}){const[n,i]=(0,a.useState)(!1),l=(0,u.sprintf)((0,u.__)("Follow %s","activitypub"),e?.name);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(s.Button,{className:"activitypub-profile__follow",onClick:()=>i(!0),"aria-haspopup":"dialog","aria-expanded":n,"aria-label":(0,u.__)("Follow me on the Fediverse","activitypub")},(0,u.__)("Follow","activitypub")),n&&(0,o.createElement)(s.Modal,{className:"activitypub-profile__confirm activitypub__modal",onRequestClose:()=>i(!1),title:l,"aria-label":l,role:"dialog"},(0,o.createElement)($,{profile:e,userId:r}),(0,o.createElement)("style",null,t)))}function $({profile:e,userId:t}){const{namespace:r}=S(),{webfinger:a}=e,n=(0,u.__)("Follow","activitypub"),i=`/${r}/actors/${t}/remote-follow?resource=`,l=(0,u.__)("Copy and paste my profile into the search field of your favorite fediverse app or server.","activitypub"),c=a.startsWith("@")?a:`@${a}`;return(0,o.createElement)(x,{actionText:n,copyDescription:l,handle:c,resourceUrl:i})}function I({selectedUser:e,style:t,backgroundColor:r,id:n,useId:i=!1,profileData:l=!1}){const[s,u]=(0,a.useState)(N()),p="site"===e?0:e,d=function(e){return v(".apfmd__button-group .components-button",m(e?.elements?.link?.color?.text)||"#111","#fff",m(e?.elements?.link?.[":hover"]?.color?.text)||"#333")}(t),b=i?{id:n}:{};function y(e){u(N(e))}return(0,a.useEffect)((()=>{if(l)return y(l);(function(e){const{namespace:t}=S(),r={headers:{Accept:"application/activity+json"},path:`/${t}/actors/${e}`};return c()(r)})(p).then(y)}),[p,l]),(0,o.createElement)("div",{...b},(0,o.createElement)(f,{selector:`#${n}`,style:t,backgroundColor:r}),(0,o.createElement)(O,{profile:s,userId:p,popupStyles:d}))}let P=1;i()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follow-me-block-wrapper"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,a.createRoot)(e).render((0,o.createElement)(I,{...t,id:"activitypub-follow-me-block-"+P++,useId:!0}))}))}))}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.m=t,e=[],o.O=(t,r,a,n)=>{if(!r){var i=1/0;for(u=0;u=n)&&Object.keys(o.O).every((e=>o.O[e](r[c])))?r.splice(c--,1):(l=!1,n0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[r,a,n]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={41:0,301:0};o.O.j=t=>0===e[t];var t=(t,r)=>{var a,n,[i,l,c]=r,s=0;if(i.some((t=>0!==e[t]))){for(a in l)o.o(l,a)&&(o.m[a]=l[a]);if(c)var u=c(o)}for(t&&t(r);so(300)));a=o.O(a)})();
\ No newline at end of file
diff --git a/build/followers/index.asset.php b/build/followers/index.asset.php
index 33e823773..f9f1a3443 100644
--- a/build/followers/index.asset.php
+++ b/build/followers/index.asset.php
@@ -1 +1 @@
- array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => 'eca29e57bfd7a1ef0298');
+ array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '5c45aaa8f57f7b4b3f8f');
diff --git a/build/followers/index.js b/build/followers/index.js
index 971c4bbff..a2f2300c2 100644
--- a/build/followers/index.js
+++ b/build/followers/index.js
@@ -1,4 +1,4 @@
-(()=>{var e={20:(e,t,a)=>{"use strict";var r=a(609),n=Symbol.for("react.element"),l=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,a){var r,c={},s=null,p=null;for(r in void 0!==a&&(s=""+a),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(p=t.ref),t)l.call(t,r)&&!i.hasOwnProperty(r)&&(c[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===c[r]&&(c[r]=t[r]);return{$$typeof:n,type:e,key:s,ref:p,props:c,_owner:o.current}}},848:(e,t,a)=>{"use strict";e.exports=a(20)},609:e=>{"use strict";e.exports=window.React},942:(e,t)=>{var a;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.wp.primitives;var r=a(848);const n=(0,r.jsx)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(t.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})});var l=a(609);const o=window.wp.components,i=window.wp.element,c=window.wp.blockEditor,s=window.wp.data,p=window.wp.coreData,u=window.wp.i18n,v=window.wp.apiFetch;var m=a.n(v);const w=window.wp.url;var d=a(942),b=a.n(d);function f({active:e,children:t,page:a,pageClick:r,className:n}){const o=b()("wp-block activitypub-pager",n,{current:e});return(0,l.createElement)("a",{className:o,onClick:t=>{t.preventDefault(),!e&&r(a)}},t)}function y({compact:e,nextLabel:t,page:a,pageClick:r,perPage:n,prevLabel:o,total:i,variant:c="outlined"}){const s=((e,t)=>{let a=[1,e-2,e-1,e,e+1,e+2,t];a.sort(((e,t)=>e-t)),a=a.filter(((e,a,r)=>e>=1&&e<=t&&r.lastIndexOf(e)===a));for(let e=a.length-2;e>=0;e--)a[e]===a[e+1]&&a.splice(e+1,1);return a})(a,Math.ceil(i/n)),p=b()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${c}`,{"is-compact":e});return(0,l.createElement)("nav",{className:p},o&&(0,l.createElement)(f,{key:"prev",page:a-1,pageClick:r,active:1===a,"aria-label":o,className:"wp-block-query-pagination-previous block-editor-block-list__block"},o),!e&&(0,l.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},s.map((e=>(0,l.createElement)(f,{key:e,page:e,pageClick:r,active:e===a,className:"page-numbers"},e)))),t&&(0,l.createElement)(f,{key:"next",page:a+1,pageClick:r,active:a===Math.ceil(i/n),"aria-label":t,className:"wp-block-query-pagination-next block-editor-block-list__block"},t))}const{namespace:g}=window._activityPubOptions;function _({selectedUser:e,per_page:t,order:a,title:r,page:n,setPage:o,className:c="",followLinks:s=!0,followerData:p=!1}){const v="site"===e?0:e,[d,b]=(0,l.useState)([]),[f,_]=(0,l.useState)(0),[k,E]=(0,l.useState)(0),[x,S]=function(){const[e,t]=(0,l.useState)(1);return[e,t]}(),N=n||x,C=o||S,O=(0,i.createInterpolateElement)(/* translators: arrow for previous followers link */ /* translators: arrow for previous followers link */
-(0,u.__)("← Less","activitypub"),{span:(0,l.createElement)("span",{className:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),P=(0,i.createInterpolateElement)(/* translators: arrow for next followers link */ /* translators: arrow for next followers link */
-(0,u.__)("More →","activitypub"),{span:(0,l.createElement)("span",{className:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),I=(e,a)=>{b(e),E(a),_(Math.ceil(a/t))};return(0,l.useEffect)((()=>{if(p&&1===N)return I(p.followers,p.total);const e=function(e,t,a,r){const n=`/${g}/actors/${e}/followers`,l={per_page:t,order:a,page:r,context:"full"};return(0,w.addQueryArgs)(n,l)}(v,t,a,N);m()({path:e}).then((e=>I(e.orderedItems,e.totalItems))).catch((()=>{}))}),[v,t,a,N,p]),(0,l.createElement)("div",{className:"activitypub-follower-block "+c},(0,l.createElement)("h3",null,r),(0,l.createElement)("ul",null,d&&d.map((e=>(0,l.createElement)("li",{key:e.url},(0,l.createElement)(h,{...e,followLinks:s}))))),f>1&&(0,l.createElement)(y,{page:N,perPage:t,total:k,pageClick:C,nextLabel:P,prevLabel:O,compact:"is-style-compact"===c}))}function h({name:e,icon:t,url:a,preferredUsername:r,followLinks:n=!0}){const i=`@${r}`,c={};return n||(c.onClick=e=>e.preventDefault()),(0,l.createElement)(o.ExternalLink,{className:"activitypub-link",href:a,title:i,...c},(0,l.createElement)("img",{width:"40",height:"40",src:t.url,className:"avatar activitypub-avatar",alt:e}),(0,l.createElement)("span",{className:"activitypub-actor"},(0,l.createElement)("strong",{className:"activitypub-name"},e),(0,l.createElement)("span",{className:"sep"},"/"),(0,l.createElement)("span",{className:"activitypub-handle"},i)))}const k=window._activityPubOptions?.enabled,E=window._activityPubOptions?.enabled;function x({name:e}){const t=E?.site?"":(0,u.__)("It will be empty in other non-author contexts.","activitypub"),a=(0,u.sprintf)(/* translators: %1$s: block name, %2$s: extra information for non-author context */ /* translators: %1$s: block name, %2$s: extra information for non-author context */
-(0,u.__)("This %1$s block will adapt to the page it is on, displaying the user profile associated with a post author (in a loop) or a user archive. %2$s","activitypub"),e,t).trim();return(0,l.createElement)(o.Card,null,(0,l.createElement)(o.CardBody,null,(0,i.createInterpolateElement)(a,{strong:(0,l.createElement)("strong",null)})))}(0,e.registerBlockType)("activitypub/followers",{edit:function({attributes:e,setAttributes:t,context:{postType:a,postId:r}}){const{order:n,per_page:v,selectedUser:m,title:w}=e,d=(0,c.useBlockProps)(),[b,f]=(0,i.useState)(1),y=[{label:(0,u.__)("New to old","activitypub"),value:"desc"},{label:(0,u.__)("Old to new","activitypub"),value:"asc"}],g=function({withInherit:e=!1}){const t=k?.users?(0,s.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,i.useMemo)((()=>{if(!t)return[];const a=[];return k?.site&&a.push({label:(0,u.__)("Site","activitypub"),value:"site"}),e&&k?.users&&a.push({label:(0,u.__)("Dynamic User","activitypub"),value:"inherit"}),t.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),a)}),[t])}({withInherit:!0}),h=e=>a=>{f(1),t({[e]:a})},E=(0,s.useSelect)((e=>{const{getEditedEntityRecord:t}=e(p.store),n=t("postType",a,r)?.author;return null!=n?n:null}),[a,r]);return(0,i.useEffect)((()=>{g.length&&(g.find((({value:e})=>e===m))||t({selectedUser:g[0].value}))}),[m,g]),(0,l.createElement)("div",{...d},(0,l.createElement)(c.InspectorControls,{key:"setting"},(0,l.createElement)(o.PanelBody,{title:(0,u.__)("Followers Options","activitypub")},(0,l.createElement)(o.TextControl,{label:(0,u.__)("Title","activitypub"),help:(0,u.__)("Title to display above the list of followers. Blank for none.","activitypub"),value:w,onChange:e=>t({title:e})}),g.length>1&&(0,l.createElement)(o.SelectControl,{label:(0,u.__)("Select User","activitypub"),value:m,options:g,onChange:h("selectedUser")}),(0,l.createElement)(o.SelectControl,{label:(0,u.__)("Sort","activitypub"),value:n,options:y,onChange:h("order")}),(0,l.createElement)(o.RangeControl,{label:(0,u.__)("Number of Followers","activitypub"),value:v,onChange:h("per_page"),min:1,max:10}))),"inherit"===m?E?(0,l.createElement)(_,{...e,page:b,setPage:f,followLinks:!1,selectedUser:E}):(0,l.createElement)(x,{name:(0,u.__)("Followers","activitypub")}):(0,l.createElement)(_,{...e,page:b,setPage:f,followLinks:!1}))},save:()=>null,icon:n})})()})();
\ No newline at end of file
+(()=>{var e={942:(e,t)=>{var a;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.React,n=window.wp.primitives,r=(0,t.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(n.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})),l=window.wp.components,o=window.wp.element,i=window.wp.blockEditor,c=window.wp.data,s=window.wp.coreData,p=window.wp.i18n,u=window.wp.apiFetch;var m=a.n(u);const v=window.wp.url;var w=a(942),d=a.n(w);function b({active:e,children:a,page:n,pageClick:r,className:l}){const o=d()("wp-block activitypub-pager",l,{current:e});return(0,t.createElement)("a",{className:o,onClick:t=>{t.preventDefault(),!e&&r(n)}},a)}const g={outlined:"outlined",minimal:"minimal"};function f({compact:e,nextLabel:a,page:n,pageClick:r,perPage:l,prevLabel:o,total:i,variant:c=g.outlined}){const s=((e,t)=>{let a=[1,e-2,e-1,e,e+1,e+2,t];a.sort(((e,t)=>e-t)),a=a.filter(((e,a,n)=>e>=1&&e<=t&&n.lastIndexOf(e)===a));for(let e=a.length-2;e>=0;e--)a[e]===a[e+1]&&a.splice(e+1,1);return a})(n,Math.ceil(i/l)),p=d()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${c}`,{"is-compact":e});return(0,t.createElement)("nav",{className:p},o&&(0,t.createElement)(b,{key:"prev",page:n-1,pageClick:r,active:1===n,"aria-label":o,className:"wp-block-query-pagination-previous block-editor-block-list__block"},o),!e&&(0,t.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},s.map((e=>(0,t.createElement)(b,{key:e,page:e,pageClick:r,active:e===n,className:"page-numbers"},e)))),a&&(0,t.createElement)(b,{key:"next",page:n+1,pageClick:r,active:n===Math.ceil(i/l),"aria-label":a,className:"wp-block-query-pagination-next block-editor-block-list__block"},a))}function y(){return window._activityPubOptions||{}}function h({selectedUser:e,per_page:a,order:n,title:r,page:l,setPage:i,className:c="",followLinks:s=!0,followerData:u=!1}){const w="site"===e?0:e,[d,b]=(0,t.useState)([]),[g,h]=(0,t.useState)(0),[E,_]=(0,t.useState)(0),[x,C]=function(){const[e,a]=(0,t.useState)(1);return[e,a]}(),N=l||x,S=i||C,P=(0,o.createInterpolateElement)(/* translators: arrow for previous followers link */ /* translators: arrow for previous followers link */
+(0,p.__)("← Less","activitypub"),{span:(0,t.createElement)("span",{className:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),I=(0,o.createInterpolateElement)(/* translators: arrow for next followers link */ /* translators: arrow for next followers link */
+(0,p.__)("More →","activitypub"),{span:(0,t.createElement)("span",{className:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(e,t)=>{b(e),_(t),h(Math.ceil(t/a))};return(0,t.useEffect)((()=>{if(u&&1===N)return L(u.followers,u.total);const e=function(e,t,a,n){const{namespace:r}=y(),l=`/${r}/actors/${e}/followers`,o={per_page:t,order:a,page:n,context:"full"};return(0,v.addQueryArgs)(l,o)}(w,a,n,N);m()({path:e}).then((e=>L(e.orderedItems,e.totalItems))).catch((()=>{}))}),[w,a,n,N,u]),(0,t.createElement)("div",{className:"activitypub-follower-block "+c},(0,t.createElement)("h3",null,r),(0,t.createElement)("ul",null,d&&d.map((e=>(0,t.createElement)("li",{key:e.url},(0,t.createElement)(k,{...e,followLinks:s}))))),g>1&&(0,t.createElement)(f,{page:N,perPage:a,total:E,pageClick:S,nextLabel:I,prevLabel:P,compact:"is-style-compact"===c}))}function k({name:e,icon:a,url:n,preferredUsername:r,followLinks:o=!0}){const i=`@${r}`,c={};return o||(c.onClick=e=>e.preventDefault()),(0,t.createElement)(l.ExternalLink,{className:"activitypub-link",href:n,title:i,...c},(0,t.createElement)("img",{width:"40",height:"40",src:a.url,className:"avatar activitypub-avatar",alt:e}),(0,t.createElement)("span",{className:"activitypub-actor"},(0,t.createElement)("strong",{className:"activitypub-name"},e),(0,t.createElement)("span",{className:"sep"},"/"),(0,t.createElement)("span",{className:"activitypub-handle"},i)))}function E({name:e}){const{enabled:a}=y(),n=a?.site?"":(0,p.__)("It will be empty in other non-author contexts.","activitypub"),r=(0,p.sprintf)(/* translators: %1$s: block name, %2$s: extra information for non-author context */ /* translators: %1$s: block name, %2$s: extra information for non-author context */
+(0,p.__)("This %1$s block will adapt to the page it is on, displaying the user profile associated with a post author (in a loop) or a user archive. %2$s","activitypub"),e,n).trim();return(0,t.createElement)(l.Card,null,(0,t.createElement)(l.CardBody,null,(0,o.createInterpolateElement)(r,{strong:(0,t.createElement)("strong",null)})))}(0,e.registerBlockType)("activitypub/followers",{edit:function({attributes:e,setAttributes:a,context:{postType:n,postId:r}}){const{order:u,per_page:m,selectedUser:v,title:w}=e,d=(0,i.useBlockProps)(),[b,g]=(0,o.useState)(1),f=[{label:(0,p.__)("New to old","activitypub"),value:"desc"},{label:(0,p.__)("Old to new","activitypub"),value:"asc"}],k=function({withInherit:e=!1}){const{enabled:t}=y(),a=t?.users?(0,c.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,o.useMemo)((()=>{if(!a)return[];const n=[];return t?.site&&n.push({label:(0,p.__)("Site","activitypub"),value:"site"}),e&&t?.users&&n.push({label:(0,p.__)("Dynamic User","activitypub"),value:"inherit"}),a.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),n)}),[a])}({withInherit:!0}),_=e=>t=>{g(1),a({[e]:t})},x=(0,c.useSelect)((e=>{const{getEditedEntityRecord:t}=e(s.store),a=t("postType",n,r)?.author;return null!=a?a:null}),[n,r]);return(0,o.useEffect)((()=>{k.length&&(k.find((({value:e})=>e===v))||a({selectedUser:k[0].value}))}),[v,k]),(0,t.createElement)("div",{...d},(0,t.createElement)(i.InspectorControls,{key:"setting"},(0,t.createElement)(l.PanelBody,{title:(0,p.__)("Followers Options","activitypub")},(0,t.createElement)(l.TextControl,{label:(0,p.__)("Title","activitypub"),help:(0,p.__)("Title to display above the list of followers. Blank for none.","activitypub"),value:w,onChange:e=>a({title:e})}),k.length>1&&(0,t.createElement)(l.SelectControl,{label:(0,p.__)("Select User","activitypub"),value:v,options:k,onChange:_("selectedUser")}),(0,t.createElement)(l.SelectControl,{label:(0,p.__)("Sort","activitypub"),value:u,options:f,onChange:_("order")}),(0,t.createElement)(l.RangeControl,{label:(0,p.__)("Number of Followers","activitypub"),value:m,onChange:_("per_page"),min:1,max:10}))),"inherit"===v?x?(0,t.createElement)(h,{...e,page:b,setPage:g,followLinks:!1,selectedUser:x}):(0,t.createElement)(E,{name:(0,p.__)("Followers","activitypub")}):(0,t.createElement)(h,{...e,page:b,setPage:g,followLinks:!1}))},save:()=>null,icon:r})})()})();
\ No newline at end of file
diff --git a/build/followers/view.asset.php b/build/followers/view.asset.php
index c4528416c..8ee28c028 100644
--- a/build/followers/view.asset.php
+++ b/build/followers/view.asset.php
@@ -1 +1 @@
- array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '771bb557b87449bcca85');
+ array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '20f96df73527c3bf094a');
diff --git a/build/followers/view.js b/build/followers/view.js
index 2450a7ee3..a94fcf18d 100644
--- a/build/followers/view.js
+++ b/build/followers/view.js
@@ -1,3 +1,3 @@
-(()=>{var e,t={250:(e,t,a)=>{"use strict";const r=window.React,n=window.wp.apiFetch;var l=a.n(n);const o=window.wp.url,c=window.wp.element,i=window.wp.i18n;var s=a(942),p=a.n(s);function u({active:e,children:t,page:a,pageClick:n,className:l}){const o=p()("wp-block activitypub-pager",l,{current:e});return(0,r.createElement)("a",{className:o,onClick:t=>{t.preventDefault(),!e&&n(a)}},t)}function m({compact:e,nextLabel:t,page:a,pageClick:n,perPage:l,prevLabel:o,total:c,variant:i="outlined"}){const s=((e,t)=>{let a=[1,e-2,e-1,e,e+1,e+2,t];a.sort(((e,t)=>e-t)),a=a.filter(((e,a,r)=>e>=1&&e<=t&&r.lastIndexOf(e)===a));for(let e=a.length-2;e>=0;e--)a[e]===a[e+1]&&a.splice(e+1,1);return a})(a,Math.ceil(c/l)),m=p()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${i}`,{"is-compact":e});return(0,r.createElement)("nav",{className:m},o&&(0,r.createElement)(u,{key:"prev",page:a-1,pageClick:n,active:1===a,"aria-label":o,className:"wp-block-query-pagination-previous block-editor-block-list__block"},o),!e&&(0,r.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},s.map((e=>(0,r.createElement)(u,{key:e,page:e,pageClick:n,active:e===a,className:"page-numbers"},e)))),t&&(0,r.createElement)(u,{key:"next",page:a+1,pageClick:n,active:a===Math.ceil(c/l),"aria-label":t,className:"wp-block-query-pagination-next block-editor-block-list__block"},t))}const f=window.wp.components,{namespace:v}=window._activityPubOptions;function b({selectedUser:e,per_page:t,order:a,title:n,page:s,setPage:p,className:u="",followLinks:f=!0,followerData:b=!1}){const d="site"===e?0:e,[g,y]=(0,r.useState)([]),[k,h]=(0,r.useState)(0),[E,N]=(0,r.useState)(0),[x,_]=function(){const[e,t]=(0,r.useState)(1);return[e,t]}(),O=s||x,S=p||_,C=(0,c.createInterpolateElement)(/* translators: arrow for previous followers link */ /* translators: arrow for previous followers link */
-(0,i.__)("← Less","activitypub"),{span:(0,r.createElement)("span",{className:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(0,c.createInterpolateElement)(/* translators: arrow for next followers link */ /* translators: arrow for next followers link */
-(0,i.__)("More →","activitypub"),{span:(0,r.createElement)("span",{className:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),q=(e,a)=>{y(e),N(a),h(Math.ceil(a/t))};return(0,r.useEffect)((()=>{if(b&&1===O)return q(b.followers,b.total);const e=function(e,t,a,r){const n=`/${v}/actors/${e}/followers`,l={per_page:t,order:a,page:r,context:"full"};return(0,o.addQueryArgs)(n,l)}(d,t,a,O);l()({path:e}).then((e=>q(e.orderedItems,e.totalItems))).catch((()=>{}))}),[d,t,a,O,b]),(0,r.createElement)("div",{className:"activitypub-follower-block "+u},(0,r.createElement)("h3",null,n),(0,r.createElement)("ul",null,g&&g.map((e=>(0,r.createElement)("li",{key:e.url},(0,r.createElement)(w,{...e,followLinks:f}))))),k>1&&(0,r.createElement)(m,{page:O,perPage:t,total:E,pageClick:S,nextLabel:L,prevLabel:C,compact:"is-style-compact"===u}))}function w({name:e,icon:t,url:a,preferredUsername:n,followLinks:l=!0}){const o=`@${n}`,c={};return l||(c.onClick=e=>e.preventDefault()),(0,r.createElement)(f.ExternalLink,{className:"activitypub-link",href:a,title:o,...c},(0,r.createElement)("img",{width:"40",height:"40",src:t.url,className:"avatar activitypub-avatar",alt:e}),(0,r.createElement)("span",{className:"activitypub-actor"},(0,r.createElement)("strong",{className:"activitypub-name"},e),(0,r.createElement)("span",{className:"sep"},"/"),(0,r.createElement)("span",{className:"activitypub-handle"},o)))}const d=window.wp.domReady;a.n(d)()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follower-block"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,c.createRoot)(e).render((0,r.createElement)(b,{...t}))}))}))},942:(e,t)=>{var a;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e="",t=0;t{if(!a){var o=1/0;for(p=0;p=l)&&Object.keys(r.O).every((e=>r.O[e](a[i])))?a.splice(i--,1):(c=!1,l0&&e[p-1][2]>l;p--)e[p]=e[p-1];e[p]=[a,n,l]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={996:0,528:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var n,l,o=a[0],c=a[1],i=a[2],s=0;if(o.some((t=>0!==e[t]))){for(n in c)r.o(c,n)&&(r.m[n]=c[n]);if(i)var p=i(r)}for(t&&t(a);sr(250)));n=r.O(n)})();
\ No newline at end of file
+(()=>{var e,t={73:(e,t,a)=>{"use strict";const r=window.React,n=window.wp.apiFetch;var l=a.n(n);const o=window.wp.url,i=window.wp.element,c=window.wp.i18n;var s=a(942),p=a.n(s);function u({active:e,children:t,page:a,pageClick:n,className:l}){const o=p()("wp-block activitypub-pager",l,{current:e});return(0,r.createElement)("a",{className:o,onClick:t=>{t.preventDefault(),!e&&n(a)}},t)}const m={outlined:"outlined",minimal:"minimal"};function f({compact:e,nextLabel:t,page:a,pageClick:n,perPage:l,prevLabel:o,total:i,variant:c=m.outlined}){const s=((e,t)=>{let a=[1,e-2,e-1,e,e+1,e+2,t];a.sort(((e,t)=>e-t)),a=a.filter(((e,a,r)=>e>=1&&e<=t&&r.lastIndexOf(e)===a));for(let e=a.length-2;e>=0;e--)a[e]===a[e+1]&&a.splice(e+1,1);return a})(a,Math.ceil(i/l)),f=p()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${c}`,{"is-compact":e});return(0,r.createElement)("nav",{className:f},o&&(0,r.createElement)(u,{key:"prev",page:a-1,pageClick:n,active:1===a,"aria-label":o,className:"wp-block-query-pagination-previous block-editor-block-list__block"},o),!e&&(0,r.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},s.map((e=>(0,r.createElement)(u,{key:e,page:e,pageClick:n,active:e===a,className:"page-numbers"},e)))),t&&(0,r.createElement)(u,{key:"next",page:a+1,pageClick:n,active:a===Math.ceil(i/l),"aria-label":t,className:"wp-block-query-pagination-next block-editor-block-list__block"},t))}const v=window.wp.components;function b({selectedUser:e,per_page:t,order:a,title:n,page:s,setPage:p,className:u="",followLinks:m=!0,followerData:v=!1}){const b="site"===e?0:e,[w,g]=(0,r.useState)([]),[y,k]=(0,r.useState)(0),[h,E]=(0,r.useState)(0),[N,x]=function(){const[e,t]=(0,r.useState)(1);return[e,t]}(),_=s||N,O=p||x,S=(0,i.createInterpolateElement)(/* translators: arrow for previous followers link */ /* translators: arrow for previous followers link */
+(0,c.__)("← Less","activitypub"),{span:(0,r.createElement)("span",{className:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),C=(0,i.createInterpolateElement)(/* translators: arrow for next followers link */ /* translators: arrow for next followers link */
+(0,c.__)("More →","activitypub"),{span:(0,r.createElement)("span",{className:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(e,a)=>{g(e),E(a),k(Math.ceil(a/t))};return(0,r.useEffect)((()=>{if(v&&1===_)return L(v.followers,v.total);const e=function(e,t,a,r){const{namespace:n}=window._activityPubOptions||{},l=`/${n}/actors/${e}/followers`,i={per_page:t,order:a,page:r,context:"full"};return(0,o.addQueryArgs)(l,i)}(b,t,a,_);l()({path:e}).then((e=>L(e.orderedItems,e.totalItems))).catch((()=>{}))}),[b,t,a,_,v]),(0,r.createElement)("div",{className:"activitypub-follower-block "+u},(0,r.createElement)("h3",null,n),(0,r.createElement)("ul",null,w&&w.map((e=>(0,r.createElement)("li",{key:e.url},(0,r.createElement)(d,{...e,followLinks:m}))))),y>1&&(0,r.createElement)(f,{page:_,perPage:t,total:h,pageClick:O,nextLabel:C,prevLabel:S,compact:"is-style-compact"===u}))}function d({name:e,icon:t,url:a,preferredUsername:n,followLinks:l=!0}){const o=`@${n}`,i={};return l||(i.onClick=e=>e.preventDefault()),(0,r.createElement)(v.ExternalLink,{className:"activitypub-link",href:a,title:o,...i},(0,r.createElement)("img",{width:"40",height:"40",src:t.url,className:"avatar activitypub-avatar",alt:e}),(0,r.createElement)("span",{className:"activitypub-actor"},(0,r.createElement)("strong",{className:"activitypub-name"},e),(0,r.createElement)("span",{className:"sep"},"/"),(0,r.createElement)("span",{className:"activitypub-handle"},o)))}const w=window.wp.domReady;a.n(w)()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follower-block"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,i.createRoot)(e).render((0,r.createElement)(b,{...t}))}))}))},942:(e,t)=>{var a;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e="",t=0;t{if(!a){var o=1/0;for(p=0;p=l)&&Object.keys(r.O).every((e=>r.O[e](a[c])))?a.splice(c--,1):(i=!1,l0&&e[p-1][2]>l;p--)e[p]=e[p-1];e[p]=[a,n,l]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={996:0,528:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var n,l,[o,i,c]=a,s=0;if(o.some((t=>0!==e[t]))){for(n in i)r.o(i,n)&&(r.m[n]=i[n]);if(c)var p=c(r)}for(t&&t(a);sr(73)));n=r.O(n)})();
\ No newline at end of file
diff --git a/build/reactions/index.asset.php b/build/reactions/index.asset.php
index 639203f1f..6d9642e29 100644
--- a/build/reactions/index.asset.php
+++ b/build/reactions/index.asset.php
@@ -1 +1 @@
- array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'dbcb7afdfaa6ae6975c0');
+ array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'af8b65b2e9159308a4b0');
diff --git a/build/reactions/index.js b/build/reactions/index.js
index 74a9f0d82..613ec78c7 100644
--- a/build/reactions/index.js
+++ b/build/reactions/index.js
@@ -1 +1 @@
-(()=>{"use strict";var e,t={505:(e,t,a)=>{const n=window.wp.blocks,r=window.React,l=window.wp.blockEditor,o=window.wp.element,s=window.wp.i18n,i=window.wp.components,c=window.wp.apiFetch;var u=a.n(c);const{namespace:m,defaultAvatarUrl:h}=window._activityPubOptions,p=({reactions:e})=>{const[t,a]=(0,o.useState)(new Set),[n,l]=(0,o.useState)(new Map),s=(0,o.useRef)([]),i=()=>{s.current.forEach((e=>clearTimeout(e))),s.current=[]},c=(t,n)=>{i();const r=100,o=e.length;n&&l((e=>{const a=new Map(e);return a.set(t,"clockwise"),a}));const c=e=>{const i="right"===e,c=i?o-1:0,u=i?1:-1;for(let e=i?t:t-1;i?e<=c:e>=c;e+=u){const o=Math.abs(e-t),i=setTimeout((()=>{a((t=>{const a=new Set(t);return n?a.add(e):a.delete(e),a})),n&&e!==t&&l((t=>{const a=new Map(t),n=e-u,r=a.get(n);return a.set(e,"clockwise"===r?"counter":"clockwise"),a}))}),o*r);s.current.push(i)}};if(c("right"),c("left"),!n){const e=Math.max((o-t)*r,t*r),a=setTimeout((()=>{l(new Map)}),e+r);s.current.push(a)}};return(0,o.useEffect)((()=>()=>i()),[]),(0,r.createElement)("ul",{className:"reaction-avatars"},e.map(((e,a)=>{const l=n.get(a),o=["reaction-avatar",t.has(a)?"wave-active":"",l?`rotate-${l}`:""].filter(Boolean).join(" "),s=e.avatar||h;return(0,r.createElement)("li",{key:a},(0,r.createElement)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onMouseEnter:()=>c(a,!0),onMouseLeave:()=>c(a,!1)},(0,r.createElement)("img",{src:s,alt:e.name,className:o,width:"32",height:"32"})))})))},f=({reactions:e,type:t})=>(0,r.createElement)("ul",{className:"activitypub-reaction-list"},e.map(((e,t)=>(0,r.createElement)("li",{key:t},(0,r.createElement)("a",{href:e.url,className:"reaction-item",target:"_blank",rel:"noopener noreferrer"},(0,r.createElement)("img",{src:e.avatar,alt:e.name,width:"32",height:"32"}),(0,r.createElement)("span",null,e.name)))))),d=({items:e,label:t})=>{const[a,n]=(0,o.useState)(!1),[l,s]=(0,o.useState)(null),[c,u]=(0,o.useState)(e.length),m=(0,o.useRef)(null);(0,o.useEffect)((()=>{if(!m.current)return;const t=()=>{const t=m.current;if(!t)return;const a=t.offsetWidth-(l?.offsetWidth||0)-12,n=Math.max(1,Math.floor((a-32)/22));u(Math.min(n,e.length))};t();const a=new ResizeObserver(t);return a.observe(m.current),()=>{a.disconnect()}}),[l,e.length]);const h=e.slice(0,c);return(0,r.createElement)("div",{className:"reaction-group",ref:m},(0,r.createElement)(p,{reactions:h}),(0,r.createElement)(i.Button,{ref:s,className:"reaction-label is-link",onClick:()=>n(!a),"aria-expanded":a},t),a&&l&&(0,r.createElement)(i.Popover,{anchor:l,onClose:()=>n(!1)},(0,r.createElement)(f,{reactions:e})))};function g({title:e="",postId:t=null,reactions:a=null,titleComponent:n=null}){const[l,s]=(0,o.useState)(a),[i,c]=(0,o.useState)(!a);return(0,o.useEffect)((()=>{if(a)return s(a),void c(!1);t?(c(!0),u()({path:`/${m}/posts/${t}/reactions`}).then((e=>{s(e),c(!1)})).catch((()=>c(!1)))):c(!1)}),[t,a]),i?null:l&&Object.values(l).some((e=>e.items?.length>0))?(0,r.createElement)("div",{className:"activitypub-reactions"},n||e&&(0,r.createElement)("h6",null,e),Object.entries(l).map((([e,t])=>t.items?.length?(0,r.createElement)(d,{key:e,items:t.items,label:t.label}):null))):null}const v=e=>{const t=["#FF6B6B","#4ECDC4","#45B7D1","#96CEB4","#FFEEAD","#D4A5A5","#9B59B6","#3498DB","#E67E22"],a=(()=>{const e=["Bouncy","Cosmic","Dancing","Fluffy","Giggly","Hoppy","Jazzy","Magical","Nifty","Perky","Quirky","Sparkly","Twirly","Wiggly","Zippy"],t=["Badger","Capybara","Dolphin","Echidna","Flamingo","Giraffe","Hedgehog","Iguana","Jellyfish","Koala","Lemur","Manatee","Narwhal","Octopus","Penguin"];return`${e[Math.floor(Math.random()*e.length)]} ${t[Math.floor(Math.random()*t.length)]}`})(),n=t[Math.floor(Math.random()*t.length)],r=a.charAt(0),l=document.createElement("canvas");l.width=64,l.height=64;const o=l.getContext("2d");return o.fillStyle=n,o.beginPath(),o.arc(32,32,32,0,2*Math.PI),o.fill(),o.fillStyle="#FFFFFF",o.font="32px sans-serif",o.textAlign="center",o.textBaseline="middle",o.fillText(r,32,32),{name:a,url:"#",avatar:l.toDataURL()}},w=JSON.parse('{"UU":"activitypub/reactions"}');(0,n.registerBlockType)(w.UU,{edit:function({attributes:e,setAttributes:t,__unstableLayoutClassNames:a}){const n=(0,l.useBlockProps)({className:a}),[i]=(0,o.useState)({likes:{label:"9 likes",items:Array.from({length:9},((e,t)=>v()))},reposts:{label:"6 reposts",items:Array.from({length:6},((e,t)=>v()))}}),c=(0,r.createElement)(l.RichText,{tagName:"h6",value:e.title,onChange:e=>t({title:e}),placeholder:(0,s.__)("Fediverse reactions","activitypub"),disableLineBreaks:!0,allowedFormats:[]});return(0,r.createElement)("div",{...n},(0,r.createElement)(g,{titleComponent:c,reactions:i}))}})}},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,a,r,l)=>{if(!a){var o=1/0;for(u=0;u=l)&&Object.keys(n.O).every((e=>n.O[e](a[i])))?a.splice(i--,1):(s=!1,l0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[a,r,l]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={608:0,104:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var r,l,o=a[0],s=a[1],i=a[2],c=0;if(o.some((t=>0!==e[t]))){for(r in s)n.o(s,r)&&(n.m[r]=s[r]);if(i)var u=i(n)}for(t&&t(a);cn(505)));r=n.O(r)})();
\ No newline at end of file
+(()=>{"use strict";var e,t={373:(e,t,a)=>{const n=window.wp.blocks,r=window.React,l=window.wp.blockEditor,o=window.wp.element,s=window.wp.i18n,i=window.wp.components,c=window.wp.apiFetch;var u=a.n(c);function m(){return window._activityPubOptions||{}}const h=({reactions:e})=>{const{defaultAvatarUrl:t}=m(),[a,n]=(0,o.useState)(new Set),[l,s]=(0,o.useState)(new Map),i=(0,o.useRef)([]),c=()=>{i.current.forEach((e=>clearTimeout(e))),i.current=[]},u=(t,a)=>{c();const r=100,l=e.length;a&&s((e=>{const a=new Map(e);return a.set(t,"clockwise"),a}));const o=e=>{const o="right"===e,c=o?l-1:0,u=o?1:-1;for(let e=o?t:t-1;o?e<=c:e>=c;e+=u){const l=Math.abs(e-t),o=setTimeout((()=>{n((t=>{const n=new Set(t);return a?n.add(e):n.delete(e),n})),a&&e!==t&&s((t=>{const a=new Map(t),n=e-u,r=a.get(n);return a.set(e,"clockwise"===r?"counter":"clockwise"),a}))}),l*r);i.current.push(o)}};if(o("right"),o("left"),!a){const e=Math.max((l-t)*r,t*r),a=setTimeout((()=>{s(new Map)}),e+r);i.current.push(a)}};return(0,o.useEffect)((()=>()=>c()),[]),(0,r.createElement)("ul",{className:"reaction-avatars"},e.map(((e,n)=>{const o=l.get(n),s=["reaction-avatar",a.has(n)?"wave-active":"",o?`rotate-${o}`:""].filter(Boolean).join(" "),i=e.avatar||t;return(0,r.createElement)("li",{key:n},(0,r.createElement)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onMouseEnter:()=>u(n,!0),onMouseLeave:()=>u(n,!1)},(0,r.createElement)("img",{src:i,alt:e.name,className:s,width:"32",height:"32"})))})))},p=({reactions:e,type:t})=>(0,r.createElement)("ul",{className:"activitypub-reaction-list"},e.map(((e,t)=>(0,r.createElement)("li",{key:t},(0,r.createElement)("a",{href:e.url,className:"reaction-item",target:"_blank",rel:"noopener noreferrer"},(0,r.createElement)("img",{src:e.avatar,alt:e.name,width:"32",height:"32"}),(0,r.createElement)("span",null,e.name)))))),f=({items:e,label:t})=>{const[a,n]=(0,o.useState)(!1),[l,s]=(0,o.useState)(null),[c,u]=(0,o.useState)(e.length),m=(0,o.useRef)(null);(0,o.useEffect)((()=>{if(!m.current)return;const t=()=>{const t=m.current;if(!t)return;const a=t.offsetWidth-(l?.offsetWidth||0)-12,n=Math.max(1,Math.floor((a-32)/22));u(Math.min(n,e.length))};t();const a=new ResizeObserver(t);return a.observe(m.current),()=>{a.disconnect()}}),[l,e.length]);const f=e.slice(0,c);return(0,r.createElement)("div",{className:"reaction-group",ref:m},(0,r.createElement)(h,{reactions:f}),(0,r.createElement)(i.Button,{ref:s,className:"reaction-label is-link",onClick:()=>n(!a),"aria-expanded":a},t),a&&l&&(0,r.createElement)(i.Popover,{anchor:l,onClose:()=>n(!1)},(0,r.createElement)(p,{reactions:e})))};function d({title:e="",postId:t=null,reactions:a=null,titleComponent:n=null}){const{namespace:l}=m(),[s,i]=(0,o.useState)(a),[c,h]=(0,o.useState)(!a);return(0,o.useEffect)((()=>{if(a)return i(a),void h(!1);t?(h(!0),u()({path:`/${l}/posts/${t}/reactions`}).then((e=>{i(e),h(!1)})).catch((()=>h(!1)))):h(!1)}),[t,a]),c?null:s&&Object.values(s).some((e=>e.items?.length>0))?(0,r.createElement)("div",{className:"activitypub-reactions"},n||e&&(0,r.createElement)("h6",null,e),Object.entries(s).map((([e,t])=>t.items?.length?(0,r.createElement)(f,{key:e,items:t.items,label:t.label}):null))):null}const g=e=>{const t=["#FF6B6B","#4ECDC4","#45B7D1","#96CEB4","#FFEEAD","#D4A5A5","#9B59B6","#3498DB","#E67E22"],a=(()=>{const e=["Bouncy","Cosmic","Dancing","Fluffy","Giggly","Hoppy","Jazzy","Magical","Nifty","Perky","Quirky","Sparkly","Twirly","Wiggly","Zippy"],t=["Badger","Capybara","Dolphin","Echidna","Flamingo","Giraffe","Hedgehog","Iguana","Jellyfish","Koala","Lemur","Manatee","Narwhal","Octopus","Penguin"];return`${e[Math.floor(Math.random()*e.length)]} ${t[Math.floor(Math.random()*t.length)]}`})(),n=t[Math.floor(Math.random()*t.length)],r=a.charAt(0),l=document.createElement("canvas");l.width=64,l.height=64;const o=l.getContext("2d");return o.fillStyle=n,o.beginPath(),o.arc(32,32,32,0,2*Math.PI),o.fill(),o.fillStyle="#FFFFFF",o.font="32px sans-serif",o.textAlign="center",o.textBaseline="middle",o.fillText(r,32,32),{name:a,url:"#",avatar:l.toDataURL()}},v=JSON.parse('{"UU":"activitypub/reactions"}');(0,n.registerBlockType)(v.UU,{edit:function({attributes:e,setAttributes:t,__unstableLayoutClassNames:a}){const n=(0,l.useBlockProps)({className:a}),[i]=(0,o.useState)({likes:{label:"9 likes",items:Array.from({length:9},((e,t)=>g()))},reposts:{label:"6 reposts",items:Array.from({length:6},((e,t)=>g()))}}),c=(0,r.createElement)(l.RichText,{tagName:"h6",value:e.title,onChange:e=>t({title:e}),placeholder:(0,s.__)("Fediverse reactions","activitypub"),disableLineBreaks:!0,allowedFormats:[]});return(0,r.createElement)("div",{...n},(0,r.createElement)(d,{titleComponent:c,reactions:i}))}})}},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,a,r,l)=>{if(!a){var o=1/0;for(u=0;u=l)&&Object.keys(n.O).every((e=>n.O[e](a[i])))?a.splice(i--,1):(s=!1,l0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[a,r,l]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={608:0,104:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var r,l,[o,s,i]=a,c=0;if(o.some((t=>0!==e[t]))){for(r in s)n.o(s,r)&&(n.m[r]=s[r]);if(i)var u=i(n)}for(t&&t(a);cn(373)));r=n.O(r)})();
\ No newline at end of file
diff --git a/build/reactions/view.asset.php b/build/reactions/view.asset.php
index 043ae865c..814279a16 100644
--- a/build/reactions/view.asset.php
+++ b/build/reactions/view.asset.php
@@ -1 +1 @@
- array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '1d4b9bd742ccb2da7be6');
+ array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'd5cb95d9bd6062974b3c');
diff --git a/build/reactions/view.js b/build/reactions/view.js
index 55ed4a059..4e4ff64e1 100644
--- a/build/reactions/view.js
+++ b/build/reactions/view.js
@@ -1 +1 @@
-(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,n=window.wp.element,a=window.wp.domReady;var r=e.n(a);const c=window.wp.components,o=window.wp.apiFetch;var l=e.n(o);window.wp.i18n;const{namespace:s,defaultAvatarUrl:i}=window._activityPubOptions,u=({reactions:e})=>{const[a,r]=(0,n.useState)(new Set),[c,o]=(0,n.useState)(new Map),l=(0,n.useRef)([]),s=()=>{l.current.forEach((e=>clearTimeout(e))),l.current=[]},u=(t,n)=>{s();const a=100,c=e.length;n&&o((e=>{const n=new Map(e);return n.set(t,"clockwise"),n}));const i=e=>{const s="right"===e,i=s?c-1:0,u=s?1:-1;for(let e=s?t:t-1;s?e<=i:e>=i;e+=u){const c=Math.abs(e-t),s=setTimeout((()=>{r((t=>{const a=new Set(t);return n?a.add(e):a.delete(e),a})),n&&e!==t&&o((t=>{const n=new Map(t),a=e-u,r=n.get(a);return n.set(e,"clockwise"===r?"counter":"clockwise"),n}))}),c*a);l.current.push(s)}};if(i("right"),i("left"),!n){const e=Math.max((c-t)*a,t*a),n=setTimeout((()=>{o(new Map)}),e+a);l.current.push(n)}};return(0,n.useEffect)((()=>()=>s()),[]),(0,t.createElement)("ul",{className:"reaction-avatars"},e.map(((e,n)=>{const r=c.get(n),o=["reaction-avatar",a.has(n)?"wave-active":"",r?`rotate-${r}`:""].filter(Boolean).join(" "),l=e.avatar||i;return(0,t.createElement)("li",{key:n},(0,t.createElement)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onMouseEnter:()=>u(n,!0),onMouseLeave:()=>u(n,!1)},(0,t.createElement)("img",{src:l,alt:e.name,className:o,width:"32",height:"32"})))})))},m=({reactions:e,type:n})=>(0,t.createElement)("ul",{className:"activitypub-reaction-list"},e.map(((e,n)=>(0,t.createElement)("li",{key:n},(0,t.createElement)("a",{href:e.url,className:"reaction-item",target:"_blank",rel:"noopener noreferrer"},(0,t.createElement)("img",{src:e.avatar,alt:e.name,width:"32",height:"32"}),(0,t.createElement)("span",null,e.name)))))),p=({items:e,label:a})=>{const[r,o]=(0,n.useState)(!1),[l,s]=(0,n.useState)(null),[i,p]=(0,n.useState)(e.length),h=(0,n.useRef)(null);(0,n.useEffect)((()=>{if(!h.current)return;const t=()=>{const t=h.current;if(!t)return;const n=t.offsetWidth-(l?.offsetWidth||0)-12,a=Math.max(1,Math.floor((n-32)/22));p(Math.min(a,e.length))};t();const n=new ResizeObserver(t);return n.observe(h.current),()=>{n.disconnect()}}),[l,e.length]);const f=e.slice(0,i);return(0,t.createElement)("div",{className:"reaction-group",ref:h},(0,t.createElement)(u,{reactions:f}),(0,t.createElement)(c.Button,{ref:s,className:"reaction-label is-link",onClick:()=>o(!r),"aria-expanded":r},a),r&&l&&(0,t.createElement)(c.Popover,{anchor:l,onClose:()=>o(!1)},(0,t.createElement)(m,{reactions:e})))};function h({title:e="",postId:a=null,reactions:r=null,titleComponent:c=null}){const[o,i]=(0,n.useState)(r),[u,m]=(0,n.useState)(!r);return(0,n.useEffect)((()=>{if(r)return i(r),void m(!1);a?(m(!0),l()({path:`/${s}/posts/${a}/reactions`}).then((e=>{i(e),m(!1)})).catch((()=>m(!1)))):m(!1)}),[a,r]),u?null:o&&Object.values(o).some((e=>e.items?.length>0))?(0,t.createElement)("div",{className:"activitypub-reactions"},c||e&&(0,t.createElement)("h6",null,e),Object.entries(o).map((([e,n])=>n.items?.length?(0,t.createElement)(p,{key:e,items:n.items,label:n.label}):null))):null}r()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-reactions-block"),(e=>{const a=JSON.parse(e.dataset.attrs);(0,n.createRoot)(e).render((0,t.createElement)(h,{...a}))}))}))})();
\ No newline at end of file
+(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,n=window.wp.element,a=window.wp.domReady;var r=e.n(a);const c=window.wp.components,o=window.wp.apiFetch;var l=e.n(o);function s(){return window._activityPubOptions||{}}window.wp.i18n;const i=({reactions:e})=>{const{defaultAvatarUrl:a}=s(),[r,c]=(0,n.useState)(new Set),[o,l]=(0,n.useState)(new Map),i=(0,n.useRef)([]),u=()=>{i.current.forEach((e=>clearTimeout(e))),i.current=[]},m=(t,n)=>{u();const a=100,r=e.length;n&&l((e=>{const n=new Map(e);return n.set(t,"clockwise"),n}));const o=e=>{const o="right"===e,s=o?r-1:0,u=o?1:-1;for(let e=o?t:t-1;o?e<=s:e>=s;e+=u){const r=Math.abs(e-t),o=setTimeout((()=>{c((t=>{const a=new Set(t);return n?a.add(e):a.delete(e),a})),n&&e!==t&&l((t=>{const n=new Map(t),a=e-u,r=n.get(a);return n.set(e,"clockwise"===r?"counter":"clockwise"),n}))}),r*a);i.current.push(o)}};if(o("right"),o("left"),!n){const e=Math.max((r-t)*a,t*a),n=setTimeout((()=>{l(new Map)}),e+a);i.current.push(n)}};return(0,n.useEffect)((()=>()=>u()),[]),(0,t.createElement)("ul",{className:"reaction-avatars"},e.map(((e,n)=>{const c=o.get(n),l=["reaction-avatar",r.has(n)?"wave-active":"",c?`rotate-${c}`:""].filter(Boolean).join(" "),s=e.avatar||a;return(0,t.createElement)("li",{key:n},(0,t.createElement)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onMouseEnter:()=>m(n,!0),onMouseLeave:()=>m(n,!1)},(0,t.createElement)("img",{src:s,alt:e.name,className:l,width:"32",height:"32"})))})))},u=({reactions:e,type:n})=>(0,t.createElement)("ul",{className:"activitypub-reaction-list"},e.map(((e,n)=>(0,t.createElement)("li",{key:n},(0,t.createElement)("a",{href:e.url,className:"reaction-item",target:"_blank",rel:"noopener noreferrer"},(0,t.createElement)("img",{src:e.avatar,alt:e.name,width:"32",height:"32"}),(0,t.createElement)("span",null,e.name)))))),m=({items:e,label:a})=>{const[r,o]=(0,n.useState)(!1),[l,s]=(0,n.useState)(null),[m,p]=(0,n.useState)(e.length),h=(0,n.useRef)(null);(0,n.useEffect)((()=>{if(!h.current)return;const t=()=>{const t=h.current;if(!t)return;const n=t.offsetWidth-(l?.offsetWidth||0)-12,a=Math.max(1,Math.floor((n-32)/22));p(Math.min(a,e.length))};t();const n=new ResizeObserver(t);return n.observe(h.current),()=>{n.disconnect()}}),[l,e.length]);const f=e.slice(0,m);return(0,t.createElement)("div",{className:"reaction-group",ref:h},(0,t.createElement)(i,{reactions:f}),(0,t.createElement)(c.Button,{ref:s,className:"reaction-label is-link",onClick:()=>o(!r),"aria-expanded":r},a),r&&l&&(0,t.createElement)(c.Popover,{anchor:l,onClose:()=>o(!1)},(0,t.createElement)(u,{reactions:e})))};function p({title:e="",postId:a=null,reactions:r=null,titleComponent:c=null}){const{namespace:o}=s(),[i,u]=(0,n.useState)(r),[p,h]=(0,n.useState)(!r);return(0,n.useEffect)((()=>{if(r)return u(r),void h(!1);a?(h(!0),l()({path:`/${o}/posts/${a}/reactions`}).then((e=>{u(e),h(!1)})).catch((()=>h(!1)))):h(!1)}),[a,r]),p?null:i&&Object.values(i).some((e=>e.items?.length>0))?(0,t.createElement)("div",{className:"activitypub-reactions"},c||e&&(0,t.createElement)("h6",null,e),Object.entries(i).map((([e,n])=>n.items?.length?(0,t.createElement)(m,{key:e,items:n.items,label:n.label}):null))):null}r()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-reactions-block"),(e=>{const a=JSON.parse(e.dataset.attrs);(0,n.createRoot)(e).render((0,t.createElement)(p,{...a}))}))}))})();
\ No newline at end of file
diff --git a/build/remote-reply/index.asset.php b/build/remote-reply/index.asset.php
index a5bf54012..332746df0 100644
--- a/build/remote-reply/index.asset.php
+++ b/build/remote-reply/index.asset.php
@@ -1 +1 @@
- array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'e834ccbee61327a31bfe');
+ array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'dbc9c5826a8c3e7e33ca');
diff --git a/build/remote-reply/index.js b/build/remote-reply/index.js
index fddefa349..270d4a4a9 100644
--- a/build/remote-reply/index.js
+++ b/build/remote-reply/index.js
@@ -1 +1 @@
-(()=>{"use strict";var e,t={456:(e,t,r)=>{var o=r(609);const a=window.wp.element,i=window.wp.domReady;var n=r.n(i);const l=window.wp.components,c=window.wp.i18n,s=(0,a.forwardRef)((function({icon:e,size:t=24,...r},o){return(0,a.cloneElement)(e,{width:t,height:t,...r,ref:o})})),m=window.wp.primitives;var p=r(848);const u=(0,p.jsx)(m.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,p.jsx)(m.Path,{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM15.5303 8.46967C15.8232 8.76256 15.8232 9.23744 15.5303 9.53033L13.0607 12L15.5303 14.4697C15.8232 14.7626 15.8232 15.2374 15.5303 15.5303C15.2374 15.8232 14.7626 15.8232 14.4697 15.5303L12 13.0607L9.53033 15.5303C9.23744 15.8232 8.76256 15.8232 8.46967 15.5303C8.17678 15.2374 8.17678 14.7626 8.46967 14.4697L10.9393 12L8.46967 9.53033C8.17678 9.23744 8.17678 8.76256 8.46967 8.46967C8.76256 8.17678 9.23744 8.17678 9.53033 8.46967L12 10.9393L14.4697 8.46967C14.7626 8.17678 15.2374 8.17678 15.5303 8.46967Z"})}),d=window.wp.apiFetch;var v=r.n(d);const y=(0,p.jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(m.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})}),_=(0,p.jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(m.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),f=(0,p.jsx)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(m.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})}),b=window.wp.compose,w="fediverse-remote-user";function h(){const[e,t]=(0,a.useState)(function(){const e=localStorage.getItem(w);return e?JSON.parse(e):{}}()),r=(0,a.useCallback)((e=>{!function(e){localStorage.setItem(w,JSON.stringify(e))}(e),t(e)}),[]),o=(0,a.useCallback)((()=>{localStorage.removeItem(w),t({})}),[]);return{template:e?.template||!1,profileURL:e?.profileURL||!1,setRemoteUser:r,deleteRemoteUser:o}}function g(e){try{return new URL(e),!0}catch(e){return!1}}function E({actionText:e,copyDescription:t,handle:r,resourceUrl:i,myProfile:n=!1,rememberProfile:m=!1}){const p=(0,c.__)("Loading...","activitypub"),u=(0,c.__)("Opening...","activitypub"),d=(0,c.__)("Error","activitypub"),w=(0,c.__)("Invalid","activitypub"),E=n||(0,c.__)("My Profile","activitypub"),[C,R]=(0,a.useState)(e),[x,O]=(0,a.useState)(y),k=(0,b.useCopyToClipboard)(r,(()=>{O(_),setTimeout((()=>O(y)),1e3)})),[L,S]=(0,a.useState)(""),[U,N]=(0,a.useState)(!0),{setRemoteUser:P}=h(),j=(0,a.useCallback)((()=>{let t;if(!g(L)&&!function(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&g(`https://${t[1]}`)}(L))return R(w),t=setTimeout((()=>R(e)),2e3),()=>clearTimeout(t);const r=i+L;R(p),v()({path:r}).then((({url:t,template:r})=>{U&&P({profileURL:L,template:r}),R(u),setTimeout((()=>{window.open(t,"_blank"),R(e)}),200)})).catch((()=>{R(d),setTimeout((()=>R(e)),2e3)}))}),[L]);return(0,o.createElement)("div",{className:"activitypub__dialog",role:"dialog","aria-labelledby":"dialog-title"},(0,o.createElement)("div",{className:"activitypub-dialog__section"},(0,o.createElement)("h4",{id:"dialog-title"},E),(0,o.createElement)("div",{className:"activitypub-dialog__description",id:"copy-description"},t),(0,o.createElement)("div",{className:"activitypub-dialog__button-group"},(0,o.createElement)("label",{htmlFor:"profile-handle",className:"screen-reader-text"},t),(0,o.createElement)("input",{type:"text",id:"profile-handle",value:r,readOnly:!0}),(0,o.createElement)(l.Button,{ref:k,"aria-label":(0,c.__)("Copy handle to clipboard","activitypub")},(0,o.createElement)(s,{icon:x}),(0,c.__)("Copy","activitypub")))),(0,o.createElement)("div",{className:"activitypub-dialog__section"},(0,o.createElement)("h4",{id:"remote-profile-title"},(0,c.__)("Your Profile","activitypub")),(0,o.createElement)("div",{className:"activitypub-dialog__description",id:"remote-profile-description"},(0,a.createInterpolateElement)((0,c.__)("Or, if you know your own profile, we can start things that way! (eg @yourusername@example.com
)","activitypub"),{code:(0,o.createElement)("code",null)})),(0,o.createElement)("div",{className:"activitypub-dialog__button-group"},(0,o.createElement)("label",{htmlFor:"remote-profile",className:"screen-reader-text"},(0,c.__)("Enter your ActivityPub profile","activitypub")),(0,o.createElement)("input",{type:"text",id:"remote-profile",value:L,onKeyDown:e=>{"Enter"===e?.code&&j()},onChange:e=>S(e.target.value),"aria-invalid":C===w}),(0,o.createElement)(l.Button,{onClick:j,"aria-label":(0,c.__)("Submit profile","activitypub")},(0,o.createElement)(s,{icon:f}),C)),m&&(0,o.createElement)("div",{className:"activitypub-dialog__remember"},(0,o.createElement)(l.CheckboxControl,{checked:U,label:(0,c.__)("Remember me for easier comments","activitypub"),onChange:()=>{N(!U)}}))))}const{namespace:C}=window._activityPubOptions;function R({selectedComment:e,commentId:t}){const r=(0,c.__)("Reply","activitypub"),a=`/${C}/comments/${t}/remote-reply?resource=`,i=(0,c.__)("Copy and paste the Comment URL into the search field of your favorite fediverse app or server.","activitypub");return(0,o.createElement)(E,{actionText:r,copyDescription:i,handle:e,resourceUrl:a,myProfile:(0,c.__)("Original Comment URL","activitypub"),rememberProfile:!0})}function x({profileURL:e,template:t,commentURL:r,deleteRemoteUser:a}){return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(l.Button,{variant:"link",className:"comment-reply-link activitypub-remote-reply__button",onClick:()=>{const e=t.replace("{uri}",r);window.open(e,"_blank")}},(0,c.sprintf)((0,c.__)("Reply as %s","activitypub"),e)),(0,o.createElement)(l.Button,{className:"activitypub-remote-profile-delete",onClick:a,title:(0,c.__)("Delete Remote Profile","activitypub")},(0,o.createElement)(s,{icon:u,size:18})))}function O({selectedComment:e,commentId:t}){const[r,i]=(0,a.useState)(!1),n=(0,c.__)("Remote Reply","activitypub"),{profileURL:s,template:m,deleteRemoteUser:p}=h(),u=s&&m;return(0,o.createElement)(o.Fragment,null,u?(0,o.createElement)(x,{profileURL:s,template:m,commentURL:e,deleteRemoteUser:p}):(0,o.createElement)(l.Button,{variant:"link",className:"comment-reply-link activitypub-remote-reply__button",onClick:()=>i(!0)},(0,c.__)("Reply on the Fediverse","activitypub")),r&&(0,o.createElement)(l.Modal,{className:"activitypub-remote-reply__modal activitypub__modal",onRequestClose:()=>i(!1),title:n},(0,o.createElement)(R,{selectedComment:e,commentId:t})))}let k=1;n()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-remote-reply"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,a.createRoot)(e).render((0,o.createElement)(O,{...t,id:"activitypub-remote-reply-link-"+k++,useId:!0}))}))}))},20:(e,t,r)=>{var o=r(609),a=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),n=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,r){var o,c={},s=null,m=null;for(o in void 0!==r&&(s=""+r),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(m=t.ref),t)i.call(t,o)&&!l.hasOwnProperty(o)&&(c[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===c[o]&&(c[o]=t[o]);return{$$typeof:a,type:e,key:s,ref:m,props:c,_owner:n.current}}},848:(e,t,r)=>{e.exports=r(20)},609:e=>{e.exports=window.React}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.m=t,e=[],o.O=(t,r,a,i)=>{if(!r){var n=1/0;for(m=0;m=i)&&Object.keys(o.O).every((e=>o.O[e](r[c])))?r.splice(c--,1):(l=!1,i0&&e[m-1][2]>i;m--)e[m]=e[m-1];e[m]=[r,a,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={227:0,739:0};o.O.j=t=>0===e[t];var t=(t,r)=>{var a,i,n=r[0],l=r[1],c=r[2],s=0;if(n.some((t=>0!==e[t]))){for(a in l)o.o(l,a)&&(o.m[a]=l[a]);if(c)var m=c(o)}for(t&&t(r);so(456)));a=o.O(a)})();
\ No newline at end of file
+(()=>{"use strict";var e,t={786:(e,t,a)=>{const r=window.React,i=window.wp.element,o=window.wp.domReady;var l=a.n(o);const n=window.wp.components,c=window.wp.i18n,m=(0,i.forwardRef)((function({icon:e,size:t=24,...a},r){return(0,i.cloneElement)(e,{width:t,height:t,...a,ref:r})})),p=window.wp.primitives,s=(0,r.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(p.Path,{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM15.5303 8.46967C15.8232 8.76256 15.8232 9.23744 15.5303 9.53033L13.0607 12L15.5303 14.4697C15.8232 14.7626 15.8232 15.2374 15.5303 15.5303C15.2374 15.8232 14.7626 15.8232 14.4697 15.5303L12 13.0607L9.53033 15.5303C9.23744 15.8232 8.76256 15.8232 8.46967 15.5303C8.17678 15.2374 8.17678 14.7626 8.46967 14.4697L10.9393 12L8.46967 9.53033C8.17678 9.23744 8.17678 8.76256 8.46967 8.46967C8.76256 8.17678 9.23744 8.17678 9.53033 8.46967L12 10.9393L14.4697 8.46967C14.7626 8.17678 15.2374 8.17678 15.5303 8.46967Z"})),u=window.wp.apiFetch;var d=a.n(u);const v=(0,r.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(p.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})),y=(0,r.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(p.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),b=(0,r.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(p.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})),_=window.wp.compose,f="fediverse-remote-user";function w(){const[e,t]=(0,i.useState)(function(){const e=localStorage.getItem(f);return e?JSON.parse(e):{}}()),a=(0,i.useCallback)((e=>{!function(e){localStorage.setItem(f,JSON.stringify(e))}(e),t(e)}),[]),r=(0,i.useCallback)((()=>{localStorage.removeItem(f),t({})}),[]);return{template:e?.template||!1,profileURL:e?.profileURL||!1,setRemoteUser:a,deleteRemoteUser:r}}function h(e){try{return new URL(e),!0}catch(e){return!1}}function E({actionText:e,copyDescription:t,handle:a,resourceUrl:o,myProfile:l=!1,rememberProfile:p=!1}){const s=(0,c.__)("Loading...","activitypub"),u=(0,c.__)("Opening...","activitypub"),f=(0,c.__)("Error","activitypub"),E=(0,c.__)("Invalid","activitypub"),g=l||(0,c.__)("My Profile","activitypub"),[C,R]=(0,i.useState)(e),[k,L]=(0,i.useState)(v),x=(0,_.useCopyToClipboard)(a,(()=>{L(y),setTimeout((()=>L(v)),1e3)})),[O,U]=(0,i.useState)(""),[S,N]=(0,i.useState)(!0),{setRemoteUser:P}=w(),M=(0,i.useCallback)((()=>{let t;if(!h(O)&&!function(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&h(`https://${t[1]}`)}(O))return R(E),t=setTimeout((()=>R(e)),2e3),()=>clearTimeout(t);const a=o+O;R(s),d()({path:a}).then((({url:t,template:a})=>{S&&P({profileURL:O,template:a}),R(u),setTimeout((()=>{window.open(t,"_blank"),R(e)}),200)})).catch((()=>{R(f),setTimeout((()=>R(e)),2e3)}))}),[O]);return(0,r.createElement)("div",{className:"activitypub__dialog",role:"dialog","aria-labelledby":"dialog-title"},(0,r.createElement)("div",{className:"activitypub-dialog__section"},(0,r.createElement)("h4",{id:"dialog-title"},g),(0,r.createElement)("div",{className:"activitypub-dialog__description",id:"copy-description"},t),(0,r.createElement)("div",{className:"activitypub-dialog__button-group"},(0,r.createElement)("label",{htmlFor:"profile-handle",className:"screen-reader-text"},t),(0,r.createElement)("input",{type:"text",id:"profile-handle",value:a,readOnly:!0}),(0,r.createElement)(n.Button,{ref:x,"aria-label":(0,c.__)("Copy handle to clipboard","activitypub")},(0,r.createElement)(m,{icon:k}),(0,c.__)("Copy","activitypub")))),(0,r.createElement)("div",{className:"activitypub-dialog__section"},(0,r.createElement)("h4",{id:"remote-profile-title"},(0,c.__)("Your Profile","activitypub")),(0,r.createElement)("div",{className:"activitypub-dialog__description",id:"remote-profile-description"},(0,i.createInterpolateElement)((0,c.__)("Or, if you know your own profile, we can start things that way! (eg @yourusername@example.com
)","activitypub"),{code:(0,r.createElement)("code",null)})),(0,r.createElement)("div",{className:"activitypub-dialog__button-group"},(0,r.createElement)("label",{htmlFor:"remote-profile",className:"screen-reader-text"},(0,c.__)("Enter your ActivityPub profile","activitypub")),(0,r.createElement)("input",{type:"text",id:"remote-profile",value:O,onKeyDown:e=>{"Enter"===e?.code&&M()},onChange:e=>U(e.target.value),"aria-invalid":C===E}),(0,r.createElement)(n.Button,{onClick:M,"aria-label":(0,c.__)("Submit profile","activitypub")},(0,r.createElement)(m,{icon:b}),C)),p&&(0,r.createElement)("div",{className:"activitypub-dialog__remember"},(0,r.createElement)(n.CheckboxControl,{checked:S,label:(0,c.__)("Remember me for easier comments","activitypub"),onChange:()=>{N(!S)}}))))}function g({selectedComment:e,commentId:t}){const{namespace:a}=window._activityPubOptions||{},i=(0,c.__)("Reply","activitypub"),o=`/${a}/comments/${t}/remote-reply?resource=`,l=(0,c.__)("Copy and paste the Comment URL into the search field of your favorite fediverse app or server.","activitypub");return(0,r.createElement)(E,{actionText:i,copyDescription:l,handle:e,resourceUrl:o,myProfile:(0,c.__)("Original Comment URL","activitypub"),rememberProfile:!0})}function C({profileURL:e,template:t,commentURL:a,deleteRemoteUser:i}){return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(n.Button,{variant:"link",className:"comment-reply-link activitypub-remote-reply__button",onClick:()=>{const e=t.replace("{uri}",a);window.open(e,"_blank")}},(0,c.sprintf)((0,c.__)("Reply as %s","activitypub"),e)),(0,r.createElement)(n.Button,{className:"activitypub-remote-profile-delete",onClick:i,title:(0,c.__)("Delete Remote Profile","activitypub")},(0,r.createElement)(m,{icon:s,size:18})))}function R({selectedComment:e,commentId:t}){const[a,o]=(0,i.useState)(!1),l=(0,c.__)("Remote Reply","activitypub"),{profileURL:m,template:p,deleteRemoteUser:s}=w(),u=m&&p;return(0,r.createElement)(r.Fragment,null,u?(0,r.createElement)(C,{profileURL:m,template:p,commentURL:e,deleteRemoteUser:s}):(0,r.createElement)(n.Button,{variant:"link",className:"comment-reply-link activitypub-remote-reply__button",onClick:()=>o(!0)},(0,c.__)("Reply on the Fediverse","activitypub")),a&&(0,r.createElement)(n.Modal,{className:"activitypub-remote-reply__modal activitypub__modal",onRequestClose:()=>o(!1),title:l},(0,r.createElement)(g,{selectedComment:e,commentId:t})))}let k=1;l()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-remote-reply"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,i.createRoot)(e).render((0,r.createElement)(R,{...t,id:"activitypub-remote-reply-link-"+k++,useId:!0}))}))}))}},a={};function r(e){var i=a[e];if(void 0!==i)return i.exports;var o=a[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.m=t,e=[],r.O=(t,a,i,o)=>{if(!a){var l=1/0;for(p=0;p=o)&&Object.keys(r.O).every((e=>r.O[e](a[c])))?a.splice(c--,1):(n=!1,o0&&e[p-1][2]>o;p--)e[p]=e[p-1];e[p]=[a,i,o]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={227:0,739:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var i,o,[l,n,c]=a,m=0;if(l.some((t=>0!==e[t]))){for(i in n)r.o(n,i)&&(r.m[i]=n[i]);if(c)var p=c(r)}for(t&&t(a);mr(786)));i=r.O(i)})();
\ No newline at end of file
diff --git a/build/reply/index.asset.php b/build/reply/index.asset.php
index 2e7cd8438..76928c260 100644
--- a/build/reply/index.asset.php
+++ b/build/reply/index.asset.php
@@ -1 +1 @@
- array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '808c98599517db815fc5');
+ array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '6e4203d933b0e0349c2a');
diff --git a/build/reply/index.js b/build/reply/index.js
index 9cabdce19..58c6c7202 100644
--- a/build/reply/index.js
+++ b/build/reply/index.js
@@ -1 +1 @@
-(()=>{"use strict";var e={20:(e,t,r)=>{var o=r(609),n=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,r){var o,l={},p=null,c=null;for(o in void 0!==r&&(p=""+r),void 0!==t.key&&(p=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,o)&&!s.hasOwnProperty(o)&&(l[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===l[o]&&(l[o]=t[o]);return{$$typeof:n,type:e,key:p,ref:c,props:l,_owner:a.current}}},848:(e,t,r)=>{e.exports=r(20)},609:e=>{e.exports=window.React}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}const o=window.wp.blocks,n=window.wp.primitives;var i=r(848);const a=(0,i.jsx)(n.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)(n.Path,{d:"M6.68822 10.625L6.24878 11.0649L5.5 11.8145L5.5 5.5L12.5 5.5V8L14 6.5V5C14 4.44772 13.5523 4 13 4H5C4.44772 4 4 4.44771 4 5V13.5247C4 13.8173 4.16123 14.086 4.41935 14.2237C4.72711 14.3878 5.10601 14.3313 5.35252 14.0845L7.31 12.125H8.375L9.875 10.625H7.31H6.68822ZM14.5605 10.4983L11.6701 13.75H16.9975C17.9963 13.75 18.7796 14.1104 19.3553 14.7048C19.9095 15.2771 20.2299 16.0224 20.4224 16.7443C20.7645 18.0276 20.7543 19.4618 20.7487 20.2544C20.7481 20.345 20.7475 20.4272 20.7475 20.4999L19.2475 20.5001C19.2475 20.4191 19.248 20.3319 19.2484 20.2394V20.2394C19.2526 19.4274 19.259 18.2035 18.973 17.1307C18.8156 16.5401 18.586 16.0666 18.2778 15.7483C17.9909 15.4521 17.5991 15.25 16.9975 15.25H11.8106L14.5303 17.9697L13.4696 19.0303L8.96956 14.5303L13.4394 9.50171L14.5605 10.4983Z"})});var s=r(609);const l=window.wp.i18n,p=window.wp.blockEditor,c=window.wp.components,w=window.wp.element,u=window.wp.data;(0,o.registerBlockType)("activitypub/reply",{edit:function({attributes:e,setAttributes:t,clientId:r,isSelected:o}){const[n,i]=(0,w.useState)(""),{insertAfterBlock:a,removeBlock:d}=(0,u.useDispatch)(p.store),v=(0,l.__)("For example: Paste a URL from a Mastodon post or note into the field above to leave a comment.","activitypub"),[f,y]=(0,w.useState)(v);return(0,s.createElement)("div",{...(0,p.useBlockProps)()},(0,s.createElement)(c.TextControl,{label:(0,l.__)("This post is a reply to the following URL","activitypub"),value:e.url,onChange:e=>{!function(e){try{return new URL(e),!0}catch(e){return!1}}(e)?(i("error"),y((0,l.__)("Please enter a valid URL.","activitypub"))):(i(""),y(v)),t({url:e})},onKeyDown:t=>{"Enter"===t.key&&a(r),!e.url&&["Backspace","Delete"].includes(t.key)&&d(r)},type:"url",placeholder:"https://example.org/path",className:n,help:o?f:""}))},save:()=>null,icon:a})})();
\ No newline at end of file
+(()=>{"use strict";const e=window.wp.blocks,t=window.React,o=window.wp.primitives,i=(0,t.createElement)(o.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)(o.Path,{d:"M6.68822 10.625L6.24878 11.0649L5.5 11.8145L5.5 5.5L12.5 5.5V8L14 6.5V5C14 4.44772 13.5523 4 13 4H5C4.44772 4 4 4.44771 4 5V13.5247C4 13.8173 4.16123 14.086 4.41935 14.2237C4.72711 14.3878 5.10601 14.3313 5.35252 14.0845L7.31 12.125H8.375L9.875 10.625H7.31H6.68822ZM14.5605 10.4983L11.6701 13.75H16.9975C17.9963 13.75 18.7796 14.1104 19.3553 14.7048C19.9095 15.2771 20.2299 16.0224 20.4224 16.7443C20.7645 18.0276 20.7543 19.4618 20.7487 20.2544C20.7481 20.345 20.7475 20.4272 20.7475 20.4999L19.2475 20.5001C19.2475 20.4191 19.248 20.3319 19.2484 20.2394V20.2394C19.2526 19.4274 19.259 18.2035 18.973 17.1307C18.8156 16.5401 18.586 16.0666 18.2778 15.7483C17.9909 15.4521 17.5991 15.25 16.9975 15.25H11.8106L14.5303 17.9697L13.4696 19.0303L8.96956 14.5303L13.4394 9.50171L14.5605 10.4983Z"})),n=window.wp.i18n,r=window.wp.blockEditor,a=window.wp.components,l=window.wp.element,s=window.wp.data;(0,e.registerBlockType)("activitypub/reply",{edit:function({attributes:e,setAttributes:o,clientId:i,isSelected:c}){const[w,p]=(0,l.useState)(""),{insertAfterBlock:u,removeBlock:d}=(0,s.useDispatch)(r.store),L=(0,n.__)("For example: Paste a URL from a Mastodon post or note into the field above to leave a comment.","activitypub"),[h,m]=(0,l.useState)(L);return(0,t.createElement)("div",{...(0,r.useBlockProps)()},(0,t.createElement)(a.TextControl,{label:(0,n.__)("This post is a reply to the following URL","activitypub"),value:e.url,onChange:e=>{!function(e){try{return new URL(e),!0}catch(e){return!1}}(e)?(p("error"),m((0,n.__)("Please enter a valid URL.","activitypub"))):(p(""),m(L)),o({url:e})},onKeyDown:t=>{"Enter"===t.key&&u(i),!e.url&&["Backspace","Delete"].includes(t.key)&&d(i)},type:"url",placeholder:"https://example.org/path",className:w,help:c?h:""}))},save:()=>null,icon:i})})();
\ No newline at end of file
diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php
index e214f40db..cee9a9e8f 100644
--- a/includes/class-activitypub.php
+++ b/includes/class-activitypub.php
@@ -8,6 +8,7 @@
namespace Activitypub;
use Exception;
+use Activitypub\Transformer\Factory;
use Activitypub\Collection\Outbox;
use Activitypub\Collection\Followers;
use Activitypub\Collection\Extra_Fields;
@@ -101,17 +102,16 @@ public static function render_activitypub_template( $template ) {
return $template;
}
+ self::add_headers();
+
if ( ! is_activitypub_request() ) {
return $template;
}
$activitypub_template = false;
+ $activitypub_object = Query::get_instance()->get_activitypub_object();
- if ( \is_author() && ! is_user_disabled( \get_the_author_meta( 'ID' ) ) ) {
- $activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/user-json.php';
- } elseif ( is_comment() ) {
- $activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/comment-json.php';
- } elseif ( \is_singular() && ! is_post_disabled( \get_the_ID() ) ) {
+ if ( $activitypub_object ) {
if ( \get_query_var( 'preview' ) ) {
\define( 'ACTIVITYPUB_PREVIEW', true );
@@ -122,10 +122,8 @@ public static function render_activitypub_template( $template ) {
*/
$activitypub_template = apply_filters( 'activitypub_preview_template', ACTIVITYPUB_PLUGIN_DIR . '/templates/post-preview.php' );
} else {
- $activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/post-json.php';
+ $activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/activitypub-json.php';
}
- } elseif ( \is_home() && ! is_user_type_disabled( 'blog' ) ) {
- $activitypub_template = ACTIVITYPUB_PLUGIN_DIR . '/templates/blog-json.php';
}
/*
@@ -145,6 +143,12 @@ public static function render_activitypub_template( $template ) {
}
if ( $activitypub_template ) {
+ // Check if header already sent.
+ if ( ! \headers_sent() && ACTIVITYPUB_SEND_VARY_HEADER ) {
+ // Send Vary header for Accept header.
+ \header( 'Vary: Accept' );
+ }
+
return $activitypub_template;
}
@@ -155,32 +159,14 @@ public static function render_activitypub_template( $template ) {
* Add the 'self' link to the header.
*/
public static function add_headers() {
- // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
- $request_uri = $_SERVER['REQUEST_URI'];
-
- if ( ! $request_uri ) {
- return;
- }
-
- $id = false;
-
- // Only add self link to author pages...
- if ( is_author() ) {
- if ( ! is_user_disabled( get_queried_object_id() ) ) {
- $id = get_user_id( get_queried_object_id() );
- }
- } elseif ( is_singular() ) { // or posts/pages/custom-post-types...
- if ( \post_type_supports( \get_post_type(), 'activitypub' ) ) {
- $id = get_post_id( get_queried_object_id() );
- }
- }
+ $id = Query::get_instance()->get_activitypub_object_id();
if ( ! $id ) {
return;
}
if ( ! headers_sent() ) {
- header( 'Link: <' . esc_url( $id ) . '>; title="ActivityPub (JSON)"; rel="alternate"; type="application/activity+json"' );
+ header( 'Link: <' . esc_url( $id ) . '>; title="ActivityPub (JSON)"; rel="alternate"; type="application/activity+json"', false );
}
add_action(
@@ -234,8 +220,6 @@ public static function redirect_canonical( $redirect_url, $requested_url ) {
* @return void
*/
public static function template_redirect() {
- self::add_headers();
-
$comment_id = get_query_var( 'c', null );
// Check if it seems to be a comment.
diff --git a/includes/class-blocks.php b/includes/class-blocks.php
index c34cd32ea..aa8d0642a 100644
--- a/includes/class-blocks.php
+++ b/includes/class-blocks.php
@@ -21,7 +21,7 @@ public static function init() {
// This is already being called on the init hook, so just add it.
self::register_blocks();
- \add_action( 'wp_footer', array( self::class, 'inject_activitypub_options' ) );
+ \add_action( 'wp_head', array( self::class, 'inject_activitypub_options' ), 11 );
\add_action( 'admin_print_scripts', array( self::class, 'inject_activitypub_options' ) );
\add_action( 'load-post-new.php', array( self::class, 'handle_in_reply_to_get_param' ) );
// Add editor plugin.
diff --git a/includes/class-migration.php b/includes/class-migration.php
index cb39f31c0..9cb65aa4e 100644
--- a/includes/class-migration.php
+++ b/includes/class-migration.php
@@ -164,6 +164,21 @@ public static function maybe_migrate() {
if ( \version_compare( $version_from_db, '4.7.1', '<' ) ) {
self::migrate_to_4_7_1();
}
+ if ( \version_compare( $version_from_db, '4.7.2', '<' ) ) {
+ self::migrate_to_4_7_2();
+ }
+
+ /*
+ * Add new update routines above this comment. ^
+ *
+ * Use 'unreleased' as the version number for new migrations and add tests for the callback directly.
+ * The release script will automatically replace it with the actual version number.
+ * Example:
+ *
+ * if ( version_compare( $version, 'unreleased', '<' ) ) {
+ * // Update routine.
+ * }
+ */
/**
* Fires when the system has to be migrated.
@@ -410,6 +425,20 @@ public static function migrate_to_4_7_1() {
}
}
+ /**
+ * Clears the post cache for Followers, we should have done this in 4.7.1 when we renamed those keys.
+ */
+ public static function migrate_to_4_7_2() {
+ global $wpdb;
+ // phpcs:ignore WordPress.DB
+ $followers = $wpdb->get_col(
+ $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s", Followers::POST_TYPE )
+ );
+ foreach ( $followers as $id ) {
+ clean_post_cache( $id );
+ }
+ }
+
/**
* Update comment counts for posts in batches.
*
diff --git a/includes/class-query.php b/includes/class-query.php
new file mode 100644
index 000000000..943f5a8d8
--- /dev/null
+++ b/includes/class-query.php
@@ -0,0 +1,263 @@
+activitypub_object ) {
+ return $this->activitypub_object;
+ }
+
+ $queried_object = $this->get_queried_object();
+
+ if ( ! $queried_object ) {
+ // If the object is not a valid ActivityPub object, try to get a virtual object.
+ $this->activitypub_object = $this->maybe_get_virtual_object();
+ return $this->activitypub_object;
+ }
+
+ $transformer = Factory::get_transformer( $queried_object );
+
+ if ( $transformer && ! is_wp_error( $transformer ) ) {
+ $this->activitypub_object = $transformer->to_object();
+ }
+
+ return $this->activitypub_object;
+ }
+
+ /**
+ * Get the ActivityPub object ID.
+ *
+ * @return int The ActivityPub object ID.
+ */
+ public function get_activitypub_object_id() {
+ if ( $this->activitypub_object_id ) {
+ return $this->activitypub_object_id;
+ }
+
+ $queried_object = $this->get_queried_object();
+ $this->activitypub_object_id = null;
+
+ if ( ! $queried_object ) {
+ // If the object is not a valid ActivityPub object, try to get a virtual object.
+ $virtual_object = $this->maybe_get_virtual_object();
+
+ if ( $virtual_object ) {
+ $this->activitypub_object_id = $virtual_object->get_id();
+
+ return $this->activitypub_object_id;
+ }
+ }
+
+ $transformer = Factory::get_transformer( $queried_object );
+
+ if ( $transformer && ! is_wp_error( $transformer ) ) {
+ $this->activitypub_object_id = $transformer->to_id();
+ }
+
+ return $this->activitypub_object_id;
+ }
+
+ /**
+ * Get the queried object.
+ *
+ * This adds support for Comments by `?c=123` IDs and Users by `?author=123` and `@username` IDs.
+ *
+ * @return \WP_Term|\WP_Post_Type|\WP_Post|\WP_User|\WP_Comment|null The queried object.
+ */
+ public function get_queried_object() {
+ $queried_object = \get_queried_object();
+
+ if ( $queried_object ) {
+ return $queried_object;
+ }
+
+ // Check Comment by ID.
+ $comment_id = \get_query_var( 'c' );
+ if ( $comment_id ) {
+ return \get_comment( $comment_id );
+ }
+
+ // Try to get Author by ID.
+ $url = $this->get_request_url();
+ $author_id = url_to_authorid( $url );
+ if ( $author_id ) {
+ return \get_user_by( 'id', $author_id );
+ }
+
+ return null;
+ }
+
+ /**
+ * Get the virtual object.
+ *
+ * Virtual objects are objects that are not stored in the database, but are created on the fly.
+ * The plugins currently supports two virtual objects: The Blog-Actor and the Application-Actor.
+ *
+ * @see \Activitypub\Blog
+ * @see \Activitypub\Application
+ *
+ * @return object|null The virtual object.
+ */
+ protected function maybe_get_virtual_object() {
+ $url = $this->get_request_url();
+
+ if ( ! $url ) {
+ return null;
+ }
+
+ $author_id = url_to_authorid( $url );
+
+ if ( ! is_numeric( $author_id ) ) {
+ return null;
+ }
+
+ $user = Actors::get_by_id( $author_id );
+
+ if ( \is_wp_error( $user ) || ! $user ) {
+ return null;
+ }
+
+ return $user;
+ }
+
+ /**
+ * Get the request URL.
+ *
+ * @return string|null The request URL.
+ */
+ protected function get_request_url() {
+ if ( ! isset( $_SERVER['REQUEST_URI'] ) ) {
+ return null;
+ }
+
+ // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+ $url = \wp_unslash( $_SERVER['REQUEST_URI'] );
+ $url = \WP_Http::make_absolute_url( $url, \home_url() );
+ $url = \sanitize_url( $url );
+
+ return $url;
+ }
+
+ /**
+ * Check if the current request is an ActivityPub request.
+ *
+ * @return bool True if the request is an ActivityPub request, false otherwise.
+ */
+ public function is_activitypub_request() {
+ if ( isset( $this->is_activitypub_request ) ) {
+ return $this->is_activitypub_request;
+ }
+
+ global $wp_query;
+
+ // One can trigger an ActivityPub request by adding ?activitypub to the URL.
+ if ( isset( $wp_query->query_vars['activitypub'] ) ) {
+ $this->is_activitypub_request = true;
+
+ return true;
+ }
+
+ /*
+ * The other (more common) option to make an ActivityPub request
+ * is to send an Accept header.
+ */
+ if ( isset( $_SERVER['HTTP_ACCEPT'] ) ) {
+ $accept = \sanitize_text_field( \wp_unslash( $_SERVER['HTTP_ACCEPT'] ) );
+
+ /*
+ * $accept can be a single value, or a comma separated list of values.
+ * We want to support both scenarios,
+ * and return true when the header includes at least one of the following:
+ * - application/activity+json
+ * - application/ld+json
+ * - application/json
+ */
+ if ( \preg_match( '/(application\/(ld\+json|activity\+json|json))/i', $accept ) ) {
+ $this->is_activitypub_request = true;
+
+ return true;
+ }
+ }
+
+ $this->is_activitypub_request = false;
+
+ return false;
+ }
+}
diff --git a/includes/functions.php b/includes/functions.php
index ea86f057a..380777e27 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -365,63 +365,14 @@ function ( $matches ) {
* @return bool False by default.
*/
function is_activitypub_request() {
- global $wp_query;
-
- /*
- * ActivityPub requests are currently only made for
- * author archives, singular posts, and the homepage.
- */
- if ( ! \is_author() && ! \is_singular() && ! \is_home() && ! defined( '\REST_REQUEST' ) ) {
- return false;
- }
-
- // Check if the current post type supports ActivityPub.
- if ( \is_singular() ) {
- $queried_object = \get_queried_object();
- $post_type = \get_post_type( $queried_object );
-
- if ( ! \post_type_supports( $post_type, 'activitypub' ) ) {
- return false;
- }
- }
-
- // Check if header already sent.
- if ( ! \headers_sent() && ACTIVITYPUB_SEND_VARY_HEADER ) {
- // Send Vary header for Accept header.
- \header( 'Vary: Accept' );
- }
-
- // One can trigger an ActivityPub request by adding ?activitypub to the URL.
- if ( isset( $wp_query->query_vars['activitypub'] ) ) {
- return true;
- }
-
- /*
- * The other (more common) option to make an ActivityPub request
- * is to send an Accept header.
- */
- if ( isset( $_SERVER['HTTP_ACCEPT'] ) ) {
- $accept = sanitize_text_field( wp_unslash( $_SERVER['HTTP_ACCEPT'] ) );
-
- /*
- * $accept can be a single value, or a comma separated list of values.
- * We want to support both scenarios,
- * and return true when the header includes at least one of the following:
- * - application/activity+json
- * - application/ld+json
- * - application/json
- */
- if ( preg_match( '/(application\/(ld\+json|activity\+json|json))/i', $accept ) ) {
- return true;
- }
- }
-
- return false;
+ return Query::get_instance()->is_activitypub_request();
}
/**
* Check if a post is disabled for ActivityPub.
*
+ * This function checks if the post type supports ActivityPub and if the post is set to be local.
+ *
* @param mixed $post The post object or ID.
*
* @return boolean True if the post is disabled, false otherwise.
@@ -431,7 +382,10 @@ function is_post_disabled( $post ) {
$disabled = false;
$visibility = \get_post_meta( $post->ID, 'activitypub_content_visibility', true );
- if ( ACTIVITYPUB_CONTENT_VISIBILITY_LOCAL === $visibility ) {
+ if (
+ ACTIVITYPUB_CONTENT_VISIBILITY_LOCAL === $visibility ||
+ ! \post_type_supports( $post->post_type, 'activitypub' )
+ ) {
$disabled = true;
}
diff --git a/includes/transformer/class-base.php b/includes/transformer/class-base.php
index 9e382c71b..94537c9b9 100644
--- a/includes/transformer/class-base.php
+++ b/includes/transformer/class-base.php
@@ -110,7 +110,7 @@ protected function transform_object_properties( $activity_object ) {
}
/**
- * Transform the WordPress Object into an ActivityPub Object.
+ * Transform the item into an ActivityPub Object.
*
* @return Base_Object|object The Activity-Object.
*/
@@ -120,6 +120,15 @@ public function to_object() {
return $this->transform_object_properties( $activity_object );
}
+ /**
+ * Transform the item to an ActivityPub ID.
+ *
+ * @return string The ID of the WordPress Object.
+ */
+ public function to_id() {
+ return $this->get_id();
+ }
+
/**
* Transforms the ActivityPub Object to an Activity
*
diff --git a/includes/transformer/class-comment.php b/includes/transformer/class-comment.php
index 7145c926f..36c4856f4 100644
--- a/includes/transformer/class-comment.php
+++ b/includes/transformer/class-comment.php
@@ -14,6 +14,7 @@
use function Activitypub\is_single_user;
use function Activitypub\get_rest_url_by_path;
+use function Activitypub\was_comment_received;
use function Activitypub\get_comment_ancestors;
/**
@@ -73,6 +74,11 @@ public function to_object() {
* @return string The User-URL.
*/
protected function get_attributed_to() {
+ // If the comment was received via ActivityPub, return the author URL.
+ if ( was_comment_received( $this->wp_object ) ) {
+ return $this->wp_object->comment_author_url;
+ }
+
return $this->get_actor_object()->get_id();
}
diff --git a/includes/transformer/class-factory.php b/includes/transformer/class-factory.php
index ae67a6f16..95aa4c625 100644
--- a/includes/transformer/class-factory.php
+++ b/includes/transformer/class-factory.php
@@ -9,6 +9,9 @@
use WP_Error;
+use function Activitypub\is_user_disabled;
+use function Activitypub\is_post_disabled;
+use function Activitypub\is_local_comment;
/**
* Transformer Factory.
*/
@@ -74,18 +77,28 @@ public static function get_transformer( $data ) {
// Use default transformer.
switch ( $class ) {
case 'WP_Post':
- if ( 'attachment' === $data->post_type ) {
+ if ( 'attachment' === $data->post_type && ! is_post_disabled( $data ) ) {
return new Attachment( $data );
+ } elseif ( ! is_post_disabled( $data ) ) {
+ return new Post( $data );
}
- return new Post( $data );
+ break;
case 'WP_Comment':
- return new Comment( $data );
+ if ( ! is_local_comment( $data ) ) {
+ return new Comment( $data );
+ }
+ break;
+ case 'WP_User':
+ if ( ! is_user_disabled( $data->ID ) ) {
+ return new User( $data );
+ }
+ break;
case 'Base_Object':
return new Activity_Object( $data );
case 'json':
return new Json( $data );
- default:
- return new WP_Error( 'invalid_object', __( 'Invalid object', 'activitypub' ) );
}
+
+ return new WP_Error( 'invalid_object', __( 'Invalid object', 'activitypub' ) );
}
}
diff --git a/includes/transformer/class-user.php b/includes/transformer/class-user.php
new file mode 100644
index 000000000..357d9a049
--- /dev/null
+++ b/includes/transformer/class-user.php
@@ -0,0 +1,63 @@
+wp_object;
+ $actor = Actors::get_by_id( $user->ID );
+
+ return $actor;
+ }
+
+ /**
+ * Get the User ID.
+ *
+ * @return int The User ID.
+ */
+ public function get_id() {
+ // TODO: Will be removed with the new Outbox implementation.
+ return $this->wp_object->ID;
+ }
+
+ /**
+ * Change the User ID.
+ *
+ * @param int $user_id The new user ID.
+ *
+ * @return User The User Object.
+ */
+ public function change_wp_user_id( $user_id ) {
+ // TODO: Will be removed with the new Outbox implementation.
+ $this->wp_object->ID = $user_id;
+
+ return $this;
+ }
+
+ /**
+ * Get the WP_User ID.
+ *
+ * @return int The WP_User ID.
+ */
+ public function get_wp_user_id() {
+ // TODO: Will be removed with the new Outbox implementation.
+ return $this->wp_object->ID;
+ }
+}
diff --git a/integration/class-wpml.php b/integration/class-wpml.php
new file mode 100644
index 000000000..81c314ce8
--- /dev/null
+++ b/integration/class-wpml.php
@@ -0,0 +1,40 @@
+ {
+ const { defaultAvatarUrl } = useOptions();
const [activeIndices, setActiveIndices] = useState(new Set());
const [rotationStates, setRotationStates] = useState(new Map());
const timeoutRefs = useRef([]);
@@ -302,6 +297,7 @@ export function Reactions( {
reactions: providedReactions = null,
titleComponent = null,
} ) {
+ const { namespace } = useOptions();
const [ reactions, setReactions ] = useState( providedReactions );
const [ loading, setLoading ] = useState( ! providedReactions );
diff --git a/src/remote-reply/remote-reply.js b/src/remote-reply/remote-reply.js
index 3486c9e43..bcb09db4a 100644
--- a/src/remote-reply/remote-reply.js
+++ b/src/remote-reply/remote-reply.js
@@ -4,11 +4,11 @@ import { __, sprintf } from '@wordpress/i18n';
import { Icon, cancelCircleFilled } from '@wordpress/icons';
import { Dialog } from '../shared/dialog';
import { useRemoteUser } from '../shared/use-remote-user';
+import { useOptions } from '../shared/use-options';
import './style.scss';
-const { namespace } = window._activityPubOptions;
-
function DialogReply( { selectedComment, commentId } ) {
+ const { namespace } = useOptions();
const actionText = __( 'Reply', 'activitypub' );
const resourceUrl = `/${ namespace }/comments/${commentId}/remote-reply?resource=`;
const copyDescription = __( 'Copy and paste the Comment URL into the search field of your favorite fediverse app or server.', 'activitypub' );
diff --git a/src/shared/inherit-block-fallback.js b/src/shared/inherit-block-fallback.js
index 787d9861f..723dbe445 100644
--- a/src/shared/inherit-block-fallback.js
+++ b/src/shared/inherit-block-fallback.js
@@ -1,9 +1,10 @@
import { Card, CardBody } from '@wordpress/components';
import { sprintf, __ } from '@wordpress/i18n';
import { createInterpolateElement } from '@wordpress/element';
-const enabled = window._activityPubOptions?.enabled;
+import { useOptions } from './use-options';
export function InheritModeBlockFallback( { name } ) {
+ const { enabled } = useOptions();
const nonAuthorExtra = enabled?.site ? '' : __( 'It will be empty in other non-author contexts.', 'activitypub' );
const text = sprintf(
/* translators: %1$s: block name, %2$s: extra information for non-author context */
diff --git a/src/shared/use-options.js b/src/shared/use-options.js
new file mode 100644
index 000000000..fe3bf20a9
--- /dev/null
+++ b/src/shared/use-options.js
@@ -0,0 +1,8 @@
+/**
+ * Returns the ActivityPub options object.
+ *
+ * @return {Object} The options object.
+ */
+export function useOptions() {
+ return window._activityPubOptions || {};
+}
diff --git a/src/shared/use-user-options.js b/src/shared/use-user-options.js
index e1ac98407..4b4f5f9af 100644
--- a/src/shared/use-user-options.js
+++ b/src/shared/use-user-options.js
@@ -1,9 +1,10 @@
import { __ } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { useMemo } from '@wordpress/element';
-const enabled = window._activityPubOptions?.enabled;
+import { useOptions } from './use-options';
export function useUserOptions( { withInherit = false } ) {
+ const { enabled } = useOptions();
const users = enabled?.users ? useSelect( ( select ) => select( 'core' ).getUsers( { who: 'authors' } ) ) : [];
return useMemo( () => {
if ( ! users ) {
diff --git a/templates/blog-json.php b/templates/activitypub-json.php
similarity index 66%
rename from templates/blog-json.php
rename to templates/activitypub-json.php
index ece2181c7..52eb48609 100644
--- a/templates/blog-json.php
+++ b/templates/activitypub-json.php
@@ -5,21 +5,21 @@
* @package Activitypub
*/
-$user = new \Activitypub\Model\Blog();
+$object = \Activitypub\Query::get_instance()->get_activitypub_object();
/**
* Fires before an ActivityPub blog profile is generated and sent to the client.
*
* @param int $user_id The ID of the WordPress blog user whose profile is being generated.
*/
-\do_action( 'activitypub_json_author_pre', $user->get__id() );
+\do_action( 'activitypub_json_pre', $object );
\header( 'Content-Type: application/activity+json' );
-echo $user->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+echo $object->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
/**
* Fires after an ActivityPub blog profile has been generated and sent to the client.
*
* @param int $user_id The ID of the WordPress blog user whose profile was generated.
*/
-\do_action( 'activitypub_json_author_post', $user->get__id() );
+\do_action( 'activitypub_json_post', $object );
diff --git a/templates/comment-json.php b/templates/comment-json.php
deleted file mode 100644
index 3a2df1062..000000000
--- a/templates/comment-json.php
+++ /dev/null
@@ -1,29 +0,0 @@
-get_error_message() ),
- 404
- );
-}
-
-/**
- * Fires before an ActivityPub comment object is generated and sent to the client.
- */
-\do_action( 'activitypub_json_comment_pre' );
-
-\header( 'Content-Type: application/activity+json' );
-echo $transformer->to_object()->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
-
-/**
- * Fires after an ActivityPub comment object has been generated and sent to the client.
- */
-\do_action( 'activitypub_json_comment_post' );
diff --git a/templates/post-json.php b/templates/post-json.php
deleted file mode 100644
index 4be19296a..000000000
--- a/templates/post-json.php
+++ /dev/null
@@ -1,30 +0,0 @@
-get_error_message() ),
- 404
- );
-}
-
-
-/**
- * Fires before an ActivityPub post object is generated and sent to the client.
- */
-\do_action( 'activitypub_json_post_pre' );
-
-\header( 'Content-Type: application/activity+json' );
-echo $transformer->to_object()->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
-
-/**
- * Fires after an ActivityPub post object has been generated and sent to the client.
- */
-\do_action( 'activitypub_json_post_post' );
diff --git a/templates/user-json.php b/templates/user-json.php
deleted file mode 100644
index 340f6e519..000000000
--- a/templates/user-json.php
+++ /dev/null
@@ -1,25 +0,0 @@
-get__id() );
-
-\header( 'Content-Type: application/activity+json' );
-echo $user->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
-
-/**
- * Fires after an ActivityPub user profile has been generated and sent to the client.
- *
- * @param int $user_id The ID of the WordPress user whose profile was generated.
- */
-\do_action( 'activitypub_json_author_post', $user->get__id() );
diff --git a/tests/includes/class-test-query.php b/tests/includes/class-test-query.php
new file mode 100644
index 000000000..47b698ac2
--- /dev/null
+++ b/tests/includes/class-test-query.php
@@ -0,0 +1,288 @@
+user->create(
+ array(
+ 'role' => 'author',
+ )
+ );
+
+ self::$post_id = $factory->post->create(
+ array(
+ 'post_author' => self::$user_id,
+ 'post_title' => 'Test Post',
+ 'post_content' => 'Test Content',
+ 'post_status' => 'publish',
+ )
+ );
+ }
+
+ /**
+ * Clean up after tests.
+ */
+ public static function wpTearDownAfterClass() {
+ wp_delete_post( self::$post_id, true );
+ wp_delete_user( self::$user_id );
+ }
+
+ /**
+ * Test get_instance method.
+ *
+ * @covers ::get_instance
+ */
+ public function test_get_instance() {
+ $instance1 = Query::get_instance();
+ $instance2 = Query::get_instance();
+
+ $this->assertInstanceOf( Query::class, $instance1 );
+ $this->assertSame( $instance1, $instance2, 'Multiple calls should return same instance' );
+ }
+
+ /**
+ * Test get_activitypub_object method.
+ *
+ * @covers ::get_activitypub_object
+ */
+ public function test_get_activitypub_object() {
+ // Test with post.
+ Query::get_instance()->__destruct();
+ $this->go_to( get_permalink( self::$post_id ) );
+ $query = Query::get_instance();
+
+ $object = $query->get_activitypub_object();
+ $this->assertNotNull( $object );
+ $this->assertEquals( get_permalink( self::$post_id ), $object->get_id() );
+ }
+
+ /**
+ * Test get_activitypub_object_id method.
+ *
+ * @covers ::get_activitypub_object_id
+ */
+ public function test_get_activitypub_object_id() {
+ // Test with no queried object.
+ Query::get_instance()->__destruct();
+ $query = Query::get_instance();
+ $this->assertNull( $query->get_activitypub_object_id() );
+
+ // Set up post query.
+ Query::get_instance()->__destruct();
+ $this->go_to( get_permalink( self::$post_id ) );
+ $query = Query::get_instance();
+
+ $this->assertEquals( get_permalink( self::$post_id ), $query->get_activitypub_object_id() );
+ }
+
+ /**
+ * Test get_queried_object method.
+ *
+ * @covers ::get_queried_object
+ */
+ public function test_get_queried_object() {
+ // Test with post.
+ Query::get_instance()->__destruct();
+ $this->go_to( get_permalink( self::$post_id ) );
+ $query = Query::get_instance();
+ $object = $query->get_queried_object();
+
+ $this->assertInstanceOf( 'WP_Post', $object );
+ $this->assertEquals( self::$post_id, $object->ID );
+
+ // Test with author.
+ Query::get_instance()->__destruct();
+ $this->go_to( get_author_posts_url( self::$user_id ) );
+ $query = Query::get_instance();
+ $object = $query->get_queried_object();
+
+ $this->assertInstanceOf( 'WP_User', $object );
+ $this->assertEquals( self::$user_id, $object->ID );
+ }
+
+ /**
+ * Test is_activitypub_request method.
+ *
+ * @covers ::is_activitypub_request
+ */
+ public function test_is_activitypub_request() {
+ // Test without ActivityPub headers.
+ Query::get_instance()->__destruct();
+ $this->assertFalse( Query::get_instance()->is_activitypub_request() );
+
+ // Test with ActivityPub query var.
+ Query::get_instance()->__destruct();
+ $this->go_to( get_permalink( self::$post_id ) );
+ set_query_var( 'activitypub', '1' );
+ $this->assertTrue( Query::get_instance()->is_activitypub_request() );
+ set_query_var( 'activitypub', '' );
+
+ // Test with Accept header.
+ Query::get_instance()->__destruct();
+ $_SERVER['HTTP_ACCEPT'] = 'application/activity+json';
+ $this->go_to( get_permalink( self::$post_id ) );
+ $this->assertTrue( Query::get_instance()->is_activitypub_request() );
+
+ Query::get_instance()->__destruct();
+ $_SERVER['HTTP_ACCEPT'] = 'application/ld+json';
+ $this->go_to( get_permalink( self::$post_id ) );
+ $this->assertTrue( Query::get_instance()->is_activitypub_request() );
+
+ Query::get_instance()->__destruct();
+ $_SERVER['HTTP_ACCEPT'] = 'application/json';
+ $this->go_to( get_permalink( self::$post_id ) );
+ $this->assertTrue( Query::get_instance()->is_activitypub_request() );
+
+ Query::get_instance()->__destruct();
+ $_SERVER['HTTP_ACCEPT'] = 'text/html';
+ $this->go_to( get_permalink( self::$post_id ) );
+ $this->assertFalse( Query::get_instance()->is_activitypub_request() );
+
+ unset( $_SERVER['HTTP_ACCEPT'] );
+ }
+
+ /**
+ * Test maybe_get_virtual_object method.
+ *
+ * @covers ::maybe_get_virtual_object
+ */
+ public function test_maybe_get_virtual_object() {
+ $reflection = new \ReflectionClass( Query::class );
+ $method = $reflection->getMethod( 'maybe_get_virtual_object' );
+ $method->setAccessible( true );
+
+ $query = Query::get_instance();
+
+ // Test with invalid URL.
+ $_SERVER['REQUEST_URI'] = '/invalid/url';
+ $this->assertNull( $method->invoke( $query ) );
+
+ // Test with author URL.
+ $_SERVER['REQUEST_URI'] = '/?author=' . self::$user_id;
+ $object = $method->invoke( $query );
+ $this->assertNotNull( $object );
+ $this->assertEquals( get_author_posts_url( self::$user_id ), $object->get_id() );
+
+ unset( $_SERVER['REQUEST_URI'] );
+ }
+
+ /**
+ * Test comment activitypub object.
+ *
+ * @covers ::get_activitypub_object
+ */
+ public function test_comment_activitypub_object() {
+ Query::get_instance()->__destruct();
+ // New comment.
+ $comment_id = wp_insert_comment(
+ array(
+ 'user_id' => self::$user_id,
+ 'comment_post_ID' => self::$post_id,
+ 'comment_author' => 'Test Author',
+ 'comment_content' => 'Test Content',
+ 'comment_approved' => 1,
+ 'comment_type' => 'comment',
+ 'comment_meta' => array(
+ 'activitypub_status' => 'federated',
+ ),
+ )
+ );
+
+ $this->go_to( home_url( '/?c=' . $comment_id ) );
+ $query = Query::get_instance();
+
+ $object = $query->get_activitypub_object();
+ $this->assertNotNull( $object );
+ $this->assertEquals( 'Test Content
', $object->get_content() );
+
+ // Test unsupported comment.
+ Query::get_instance()->__destruct();
+
+ // New comment.
+ $comment_id = wp_insert_comment(
+ array(
+ 'comment_post_ID' => self::$post_id,
+ 'comment_author' => 'Test Author',
+ 'comment_content' => 'Test Content 2',
+ 'comment_approved' => 1,
+ 'comment_type' => 'comment',
+ )
+ );
+
+ $this->go_to( home_url( '/?c=' . $comment_id ) );
+ $this->assertNull( Query::get_instance()->get_activitypub_object() );
+ }
+
+ /**
+ * Test user activitypub object.
+ *
+ * @covers ::get_activitypub_object
+ */
+ public function test_user_activitypub_object() {
+ Query::get_instance()->__destruct();
+ $this->go_to( get_author_posts_url( self::$user_id ) );
+ $this->assertNotNull( Query::get_instance()->get_activitypub_object() );
+
+ Query::get_instance()->__destruct();
+ $user = get_user_by( 'id', self::$user_id );
+ $user->remove_cap( 'activitypub' );
+ $this->go_to( get_author_posts_url( self::$user_id ) );
+ $this->assertNull( Query::get_instance()->get_activitypub_object() );
+
+ $user->add_cap( 'activitypub' );
+ }
+
+ /**
+ * Test post activitypub object.
+ *
+ * @covers ::get_activitypub_object
+ */
+ public function test_post_activity_object() {
+ Query::get_instance()->__destruct();
+ $this->go_to( get_permalink( self::$post_id ) );
+ $this->assertNotNull( Query::get_instance()->get_activitypub_object() );
+
+ Query::get_instance()->__destruct();
+ add_post_meta( self::$post_id, 'activitypub_content_visibility', ACTIVITYPUB_CONTENT_VISIBILITY_LOCAL );
+ $this->go_to( get_permalink( self::$post_id ) );
+ $this->assertNull( Query::get_instance()->get_activitypub_object() );
+
+ Query::get_instance()->__destruct();
+ delete_post_meta( self::$post_id, 'activitypub_content_visibility' );
+ $this->go_to( get_permalink( self::$post_id ) );
+ $this->assertNotNull( Query::get_instance()->get_activitypub_object() );
+ }
+}