diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 0000000..3c72a86
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,90 @@
+name: Bug Report
+description: Helps us improve our product!
+labels: "Needs triage, [Type] Bug"
+body:
+ - type: markdown
+ attributes:
+ value: |
+ ### Thanks for contributing!
+
+ Please write a clear title, then fill in the fields below and submit.
+
+ Please **do not** link to image hosting services such as Cloudup, Droplr, Imgur, etc…
+ Instead, directly embed screenshot(s) or recording(s) in any of the text areas below: click, then drag and drop.
+ - type: markdown
+ attributes:
+ value: |
+ ---
+ ## Core Information
+ - type: textarea
+ id: summary
+ attributes:
+ label: Quick summary
+ - type: textarea
+ id: steps
+ attributes:
+ label: Steps to reproduce
+ placeholder: |
+ 1. Start at `site-domain.com/blog`.
+ 2. Click on any blog post.
+ 3. ...
+ validations:
+ required: true
+ - type: textarea
+ id: expected
+ attributes:
+ label: What you expected to happen
+ placeholder: |
+ e.g. The post should appear.
+ validations:
+ required: true
+ - type: textarea
+ id: actual
+ attributes:
+ label: What actually happened
+ placeholder: |
+ e.g. The post did not appear.
+ validations:
+ required: true
+ - type: dropdown
+ id: users-affected
+ attributes:
+ label: Impact
+ description: Approximately how many users are impacted?
+ options:
+ - One
+ - Some (< 50%)
+ - Most (> 50%)
+ - All
+ validations:
+ required: true
+ - type: dropdown
+ id: workarounds
+ attributes:
+ label: Available workarounds?
+ options:
+ - No and the platform is unusable
+ - No but the platform is still usable
+ - Yes, difficult to implement
+ - Yes, easy to implement
+ - There is no user impact
+ validations:
+ required: true
+
+ - type: markdown
+ attributes:
+ value: |
+
+
+ ## Optional Information
+
+ The following section is optional.
+ - type: textarea
+ id: logs
+ attributes:
+ label: Logs or notes
+ placeholder: |
+ Add any information that may be relevant, such as:
+ - Browser/Platform
+ - Theme
+ - Logs/Errors
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 0000000..2fc3601
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,34 @@
+name: Feature Request
+description: Suggest an idea for the ActivityPub plugin!
+title: "Feature Request:"
+labels: ["[Type] Feature Request"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Please, be as descriptive as possible. Issues lacking detail, or for any other reason than to request a feature, may be closed without action.
+
+ - type: textarea
+ id: what
+ attributes:
+ label: What
+ description: Add a concise description of the feature being requested.
+ placeholder: eg. I would like a new dropdown at ...
+ validations:
+ required: true
+
+ - type: textarea
+ id: why
+ attributes:
+ label: Why
+ description: Add a description of the problem this feature solves.
+ placeholder: |
+ eg. This will solve my accessibility needs.
+ validations:
+ required: true
+
+ - type: textarea
+ id: how
+ attributes:
+ label: How
+ description: If applicable, add screenshots, mockup, animations and/or videos to help illustrate how the feature could be done.
diff --git a/.github/stale.yml b/.github/stale.yml
deleted file mode 100644
index e6e3287..0000000
--- a/.github/stale.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-# Number of days of inactivity before an issue becomes stale
-daysUntilStale: 120
-# Number of days of inactivity before a stale issue is closed
-daysUntilClose: 7
-# Issues with these labels will never be considered stale
-exemptLabels:
- - pinned
- - security
-# Label to use when marking an issue as stale
-staleLabel: wontfix
-# Comment to post when marking an issue as stale. Set to `false` to disable
-markComment: >
- This issue has been automatically marked as stale because it has not had
- recent activity. It will be closed if no further activity occurs. Thank you
- for your contributions.
-# Comment to post when closing a stale issue. Set to `false` to disable
-closeComment: false
diff --git a/.github/workflows/gardening.yml b/.github/workflows/gardening.yml
new file mode 100644
index 0000000..2055d66
--- /dev/null
+++ b/.github/workflows/gardening.yml
@@ -0,0 +1,50 @@
+# Repo gardening. Automate some of the triage tasks in the repo.
+name: Repo Gardening
+
+on:
+ pull_request_target: # When a PR is opened, edited, updated, closed, or a label is added.
+ types: [opened, reopened, synchronize, edited, labeled, closed]
+ issues: # For auto-triage of issues.
+ types: [opened, labeled, reopened, edited, closed]
+ issue_comment: # To gather support references in issue comments.
+ types: [created]
+concurrency:
+ # For pull_request_target, cancel any concurrent jobs with the same type (e.g. "opened", "labeled") and branch.
+ # Don't cancel any for other events, accomplished by grouping on the unique run_id.
+ group: gardening-${{ github.event_name }}-${{ github.event.action }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ repo-gardening:
+ name: 'Automated repo gardening.'
+ runs-on: ubuntu-latest
+ if: github.event_name == 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
+ timeout-minutes: 10
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Setup Node
+ uses: actions/setup-node@v3
+ with:
+ node-version: lts/*
+
+ - name: Wait for prior instances of the workflow to finish
+ uses: softprops/turnstyle@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: 'Automate triage (add labels, clean labels, ...).'
+ uses: automattic/action-repo-gardening@trunk
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ slack_token: ${{ secrets.SLACK_TOKEN }}
+ slack_team_channel: ${{ secrets.SLACK_TEAM_CHANNEL }}
+ slack_he_triage_channel: ${{ secrets.SLACK_HE_TRIAGE_CHANNEL }}
+ slack_quality_channel: ${{ secrets.SLACK_QUALITY_CHANNEL }}
+ tasks: 'addLabels,cleanLabels,assignIssues,flagOss,gatherSupportReferences,replyToCustomersReminder'
+ add_labels: '[
+ {"path": "src/followers", "label": "[Block] Followers"},
+ {"path": "src/follow-me", "label": "[Block] Follow Me"}
+ ]'
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..03882cb
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,19 @@
+name: 'Close stale issues and PRs'
+on:
+ schedule:
+ - cron: '30 1 * * *'
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v8
+ with:
+ stale-issue-message: 'This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
+ days-before-stale: 120
+ days-before-close: 7
+ exempt-all-pr-assignees: true
+ exempt-all-assignees: true
+ exempt-all-pr-milestones: true
+ exempt-all-issue-milestones: true
+ start-date: '2019-02-01T00:00:00Z'
diff --git a/.php_cs b/.php_cs
deleted file mode 100644
index 7f81780..0000000
--- a/.php_cs
+++ /dev/null
@@ -1,15 +0,0 @@
-exclude('vendor')
- ->exclude('node_modules')
- ->exclude('bin')
- ->in(__DIR__)
-;
-
-return PhpCsFixer\Config::create()
- ->setRules([
- 'native_function_invocation' => ['include' => ['@all']],
- 'native_constant_invocation' => true,
- ])
- ->setFinder($finder)
-;
diff --git a/README.md b/README.md
index cdc6d62..eef27a0 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
# ActivityPub #
-**Contributors:** [automattic](https://profiles.wordpress.org/automattic/), [pfefferle](https://profiles.wordpress.org/pfefferle/), [mediaformat](https://profiles.wordpress.org/mediaformat/), [mattwiebe](https://profiles.wordpress.org/mattwiebe/), [akirk](https://profiles.wordpress.org/akirk/), [jeherve](https://profiles.wordpress.org/jeherve/), [nuriapena](https://profiles.wordpress.org/nuriapena/)
+**Contributors:** [automattic](https://profiles.wordpress.org/automattic/), [pfefferle](https://profiles.wordpress.org/pfefferle/), [mediaformat](https://profiles.wordpress.org/mediaformat/), [mattwiebe](https://profiles.wordpress.org/mattwiebe/), [akirk](https://profiles.wordpress.org/akirk/), [jeherve](https://profiles.wordpress.org/jeherve/), [nuriapena](https://profiles.wordpress.org/nuriapena/), [cavalierlife](https://profiles.wordpress.org/cavalierlife/)
**Tags:** OStatus, fediverse, activitypub, activitystream
**Requires at least:** 4.7
**Tested up to:** 6.3
-**Stable tag:** 1.0.0
+**Stable tag:** 1.0.1
**Requires PHP:** 5.6
**License:** MIT
**License URI:** http://opensource.org/licenses/MIT
@@ -12,39 +12,39 @@ The ActivityPub protocol is a decentralized social networking protocol based upo
## Description ##
-This is BETA software, see the FAQ to see the current feature set or rather what is still planned.
+Enter the fediverse with **ActivityPub**, broadcasting your blog to a wider audience! Attract followers, deliver updates, and receive comments from a diverse user base of **ActivityPub**\-compliant platforms.
-The plugin implements the ActivityPub protocol for your blog, which means that your readers will be able to follow your blog posts on Mastodon and other federated platforms that support ActivityPub. In addition, replies to your posts on Mastodon and related platforms will automatically become comments on your blog post.
+With the ActivityPub plugin installed, your WordPress blog itself function as a federated profile, along with profiles for each author. For instance, if your website is `example.com`, then the blog-wide profile can be found at `@example.com@example.com`, and authors like Jane and Bob would have their individual profiles at `@jane@example.com` and `@bobz@example.com`, respectively.
+
+An example: I give you my Mastodon profile name: `@pfefferle@mastodon.social`. You search, see my profile, and hit follow. Now, any post I make appears in your Home feed. Similarly, with the ActivityPub plugin, you can find and follow Jane's profile at `@jane@example.com`.
+
+Once you follow Jane's `@jane@example.com` profile, any blog post she crafts on `example.com` will land in your Home feed. Simultaneously, by following the blog-wide profile `@example.com@example.com`, you'll receive updates from all authors.
+
+**Note**: if no one follows your author or blog instance, your posts remain unseen. The simplest method to verify the plugin's operation is by following your profile. If you possess a Mastodon profile, initiate by following your new one.
The plugin works with the following tested federated platforms, but there may be more that it works with as well:
* [Mastodon](https://joinmastodon.org/)
-* [Pleroma](https://pleroma.social/)
+* [Pleroma](https://pleroma.social/)/[Akkoma](https://akkoma.social/)
* [friendica](https://friendi.ca/)
* [Hubzilla](https://hubzilla.org/)
* [Pixelfed](https://pixelfed.org/)
* [Socialhome](https://socialhome.network/)
* [Misskey](https://join.misskey.page/)
-* [Calckey](https://calckey.org/)
-
-Here’s what that means and what you can expect.
-
-Once the ActivityPub plugin is installed, each author’s page on your WordPress blog will become its own federated instance. In other words, if you have two authors, Jane and Bob, on your website, `example.com`, then your authors would have their own author pages at `example.com/author/jane` and `example.com/author/bob`. Each of those author pages would now be available to Mastodon users (and all other federated platform users) as a profile that can be followed. Let’s break that down further. Let’s say you have a friend on Mastodon who tells you to follow them and they give you their profile name `@janelivesheresomeofthetime@mastodon.social`. You search for her name, see her profile, and click the follow button, right? From then on, everything Jane posts on her profile shows up in your Home feed. Okay, similarly, now that Jane has installed the ActivityPub plugin on her `example.com` site, her friends can also follow her on Mastodon by searching for `@jane@example.com` and clicking the Follow button on that profile.
-
-From now on, every blog post Jane publishes on example.com will show up on your Home feed because you follow her `@jane@example.com` profile.
-Of course, if no one follows your author instance, then no one will ever see the posts - including you! So the easiest way to even know if the plugin is working is to follow your new profile yourself. If you already have a Mastodon profile, just follow your new one from there.
+* [Firefish](https://joinfirefish.org/) (rebrand of Calckey)
Some things to note:
-1. Many single-author blogs have chosen to turn off or redirect their author profile pages, usually via an SEO plugin like Yoast or Rank Math. This is usually done to avoid duplicate content with your blog’s home page. If your author page has been deactivated in this way, then ActivityPub won’t work for you. Instead, you can turn your author profile page back on, and then use the option in your SEO plugin to noindex the author page. This will enable the page to be live and ActivityPub will now work, but the live page won’t cause any duplicate content issues with search engines.
-1. Once ActivityPub is installed, only new posts going forward will be available in the fediverse. Likewise, even if you’ve been using ActivityPub for a while, anyone who follows your site, will only see new posts you publish from that moment on. They will never see previously-published posts in their Home feed. This process is very similar to subscribing to a newsletter. If you subscribe to a newsletter, you will only receive future emails, but not the old archived ones. With ActivityPub, if someone follows your site, they will only receive new blog posts you publish from then on.
+1. The blog-wide profile is only compatible with sites with rewrite rules enabled. If your site does not have rewrite rules enabled, the author-specific profiles may still work.
+1. Many single-author blogs have chosen to turn off or redirect their author profile pages, usually via an SEO plugin like Yoast or Rank Math. This is usually done to avoid duplicate content with your blog’s home page. If your author page has been deactivated in this way, then ActivityPub author profiles won’t work for you. Instead, you can turn your author profile page back on, and then use the option in your SEO plugin to noindex the author page. This will duplicate content issues with search engines and will enable ActivityPub author profiles to work.
+1. Once ActivityPub is installed, *only new posts going forward* will be available in the fediverse. Likewise, even if you’ve been using ActivityPub for a while, anyone who follows your site, will only see new posts you publish from that moment on. They will never see previously-published posts in their Home feed. This process is very similar to subscribing to a newsletter. If you subscribe to a newsletter, you will only receive future emails, but not the old archived ones. With ActivityPub, if someone follows your site, they will only receive new blog posts you publish from then on.
So what’s the process?
1. Install the ActivityPub plugin.
1. Go to the plugin’s settings page and adjust the settings to your liking. Click the Save button when ready.
-1. Make sure your blog’s author profile page is active.
-1. Go to Mastodon or any other federated platform, search for your author’s new federated profile, and follow it. Your new profile will be in the form of @yourauthorname@yourwebsite.com, so that is what you’ll search for.
+1. Make sure your blog’s author profile page is active if you are using author profiles.
+1. Go to Mastodon or any other federated platform, and search for your profile, and follow it. Your new profile will be in the form of either `@your_username@example.com` or `@example.com@example.com`, so that is what you’ll search for.
1. On your blog, publish a new post.
1. From Mastodon, check to see if the new post appears in your Home feed.
@@ -54,22 +54,14 @@ Please note that it may take up to 15 minutes or so for the new post to show up
### tl;dr ###
-This plugin connects your WordPress blog to popular social platforms like Mastodon, making your posts more accessible to a wider audience. Once installed, your blog's author pages can be followed by users on these platforms, allowing them to receive your new posts in their feeds.
-
-Here's how it works:
-
-1. Install the plugin and adjust settings as needed.
-1. Ensure your blog's author profile page is active.
-1. On Mastodon or other supported platforms, search for and follow your author's new profile (e.g., `@yourauthorname@yourwebsite.com`).
-1. Publish a new post on your blog and check if it appears in your Mastodon feed.
-
-Please note that it may take up to 15 minutes for a new post to appear in your feed, as messages are sent on a delay to avoid overwhelming your followers. Be patient and give it some time.
+This plugin connects your WordPress blog to popular social platforms like Mastodon, making your posts more accessible to a wider audience. Once installed, your blog can be followed by users on these platforms, allowing them to receive your new posts in their feeds.
### What is the status of this plugin? ###
Implemented:
-* profile pages (JSON representation)
+* blog profile pages (JSON representation)
+* author profile pages (JSON representation)
* custom links
* functional inbox/outbox
* follow (accept follows)
@@ -79,8 +71,8 @@ Implemented:
To implement:
-* better configuration possibilities
* threaded comments support
+* replace shortcodes with blocks for layout
### What is "ActivityPub for WordPress" ###
@@ -94,7 +86,7 @@ In order for webfinger to work, it must be mapped to the root directory of the U
Add the following to the .htaccess file in the root directory:
- RedirectMatch "^\/\.well-known/(webfinger|nodeinfo|x-nodeinfo2)(.*)$" "\/blog\/\.well-known$1$2"
+ RedirectMatch "^\/\.well-known/(webfinger|nodeinfo|x-nodeinfo2)(.*)$" /blog/.well-known/$1$2
Where 'blog' is the path to the subdirectory at which your blog resides.
@@ -113,20 +105,36 @@ Where 'blog' is the path to the subdirectory at which your blog resides.
Project maintained on GitHub at [automattic/wordpress-activitypub](https://github.com/automattic/wordpress-activitypub).
+### 1.0.1 ###
+
+* Update: improve image attachment detection using the block editor
+* Update: better error code handling for API responses
+* Update: use a tag stack instead of regex for protecting tags for Hashtags and @-Mentions
+* Compatibility: better signature support for subpath-installations
+* Compatibility: allow deactivating blocks registered by the plugin
+* Compatibility: avoid Fatal Errors when using ClassicPress
+* Compatibility: improve the Group-Actor to play nicely with existing implementations
+* Fixed: truncate long blog titles and handles for the "Follow me" block
+* Fixed: ensure that only a valid user can be selected for the "Follow me" block
+* Fixed: fix a typo in a hook name
+* Fixed: a problem with signatures when running WordPress in a sub-path
+
### 1.0.0 ###
-* Add: blog-wide Account (catchall, like `mydomain.com@mydomain.com`)
-* Add: Signature Verification: https://docs.joinmastodon.org/spec/security/ .
-* Add: a Followers Block.
+* Add: blog-wide Account (catchall, like `example.com@example.com`)
+* Add: a Follow Me block (help visitors to follow your Profile)
+* Add: Signature Verification: https://docs.joinmastodon.org/spec/security/
+* Add: a Followers Block (show off your Followers)
* Add: Simple caching
* Add: Collection endpoints for Featured Tags and Featured Posts
-* Update: Complete rewrite of the Follower-System based on Custom Post Types.
+* Add: Better handling of Hashtags in mobile apps
+* Update: Complete rewrite of the Follower-System based on Custom Post Types
* Update: Improved linter (PHPCS)
-* Compatibility: Add a new conditional, `\Activitypub\is_activitypub_request()`, to allow third-party plugins to detect ActivityPub requests.
-* Compatibility: Add hooks to allow modifying images returned in ActivityPub requests.
-* Compatibility: Indicate that the plugin is compatible and has been tested with the latest version of WordPress, 6.3.
-* Compatibility: Avoid PHP notice on sites using PHP 8.2.
-* Fixed: Load the plugin later in the WordPress code lifecycle to avoid errors in some requests.
+* Compatibility: Add a new conditional, `\Activitypub\is_activitypub_request()`, to allow third-party plugins to detect ActivityPub requests
+* Compatibility: Add hooks to allow modifying images returned in ActivityPub requests
+* Compatibility: Indicate that the plugin is compatible and has been tested with the latest version of WordPress, 6.3
+* Compatibility: Avoid PHP notice on sites using PHP 8.2
+* Fixed: Load the plugin later in the WordPress code lifecycle to avoid errors in some requests
* Fixed: Updating posts
* Fixed: Hashtag now support CamelCase and UTF-8
diff --git a/activitypub.php b/activitypub.php
index eb61c57..9b9f8f2 100644
--- a/activitypub.php
+++ b/activitypub.php
@@ -3,7 +3,7 @@
* Plugin Name: ActivityPub
* Plugin URI: https://github.com/pfefferle/wordpress-activitypub/
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
- * Version: 1.0.0
+ * Version: 1.0.1
* Author: Matthias Pfefferle & Automattic
* Author URI: https://automattic.com/
* License: MIT
@@ -15,6 +15,8 @@
namespace Activitypub;
+use function Activitypub\site_supports_blocks;
+
\defined( 'ACTIVITYPUB_REST_NAMESPACE' ) || \define( 'ACTIVITYPUB_REST_NAMESPACE', 'activitypub/1.0' );
/**
@@ -53,10 +55,13 @@ function init() {
Admin::init();
Hashtag::init();
Shortcodes::init();
- Blocks::init();
Mention::init();
Health_Check::init();
Scheduler::init();
+
+ if ( site_supports_blocks() ) {
+ Blocks::init();
+ }
}
\add_action( 'init', __NAMESPACE__ . '\init' );
diff --git a/assets/img/mp.jpg b/assets/img/mp.jpg
index 0356f91..05964b4 100644
Binary files a/assets/img/mp.jpg and b/assets/img/mp.jpg differ
diff --git a/assets/img/wp-logo.png b/assets/img/wp-logo.png
new file mode 100644
index 0000000..b48f08e
Binary files /dev/null and b/assets/img/wp-logo.png differ
diff --git a/build/follow-me/block.json b/build/follow-me/block.json
new file mode 100644
index 0000000..8dcb824
--- /dev/null
+++ b/build/follow-me/block.json
@@ -0,0 +1,47 @@
+{
+ "$schema": "https://schemas.wp.org/trunk/block.json",
+ "name": "activitypub/follow-me",
+ "apiVersion": 3,
+ "version": "1.0.0",
+ "title": "Follow me on the Fediverse",
+ "category": "widgets",
+ "description": "Display your Fediverse profile so that visitors can follow you.",
+ "textdomain": "activitypub",
+ "icon": "groups",
+ "supports": {
+ "html": false,
+ "color": {
+ "gradients": true,
+ "link": true,
+ "__experimentalDefaultControls": {
+ "background": true,
+ "text": true,
+ "link": true
+ }
+ },
+ "__experimentalBorder": {
+ "radius": true,
+ "width": true,
+ "color": true,
+ "style": true
+ },
+ "typography": {
+ "fontSize": true,
+ "__experimentalDefaultControls": {
+ "fontSize": true
+ }
+ }
+ },
+ "attributes": {
+ "selectedUser": {
+ "type": "string",
+ "default": "site"
+ }
+ },
+ "editorScript": "file:./index.js",
+ "viewScript": "file:./view.js",
+ "style": [
+ "file:./style-index.css",
+ "wp-components"
+ ]
+}
\ No newline at end of file
diff --git a/build/follow-me/index.asset.php b/build/follow-me/index.asset.php
new file mode 100644
index 0000000..28ba373
--- /dev/null
+++ b/build/follow-me/index.asset.php
@@ -0,0 +1 @@
+ array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '5e11f2fcd4dc9ac6d7ee');
diff --git a/build/follow-me/index.js b/build/follow-me/index.js
new file mode 100644
index 0000000..5226a1d
--- /dev/null
+++ b/build/follow-me/index.js
@@ -0,0 +1 @@
+(()=>{"use strict";var e,t={843:(e,t,n)=>{const r=window.wp.blocks,o=window.wp.element,l=window.wp.primitives,a=(0,o.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(l.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"}));function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:null;return n?`${e}${arguments.length>3&&void 0!==arguments[3]?arguments[3]:""} { ${t}: ${n}; }\n`:""}function g(e,t,n,r){return E(e,"background-color",t)+E(e,"color",n)+E(e,"background-color",r,":hover")+E(e,"background-color",r,":focus")}function k(e){let{selector:t,style:n,backgroundColor:r}=e;const l=function(e,t,n){const r=`${e} .components-button`,o=("string"==typeof(l=n)?h(l):l?.color?.background||null)||t?.color?.background;var l;return g(r,_(t?.elements?.link?.color?.text),o,_(t?.elements?.link?.[":hover"]?.color?.text))}(t,n,r);return(0,o.createElement)("style",null,l)}const{namespace:O}=window._activityPubOptions,x={avatar:"",resource:"@well@hello.dolly",name:(0,s.__)("Hello Dolly Fan Account","activitypub"),url:"#"};function C(e){if(!e)return x;const t={...x,...e};return t.avatar=t?.icon?.url,t}function S(e){let{profile:t,popupStyles:n,userId:r}=e;const{avatar:l,name:a,resource:c}=t;return(0,o.createElement)("div",{className:"activitypub-profile"},(0,o.createElement)("img",{className:"activitypub-profile__avatar",src:l}),(0,o.createElement)("div",{className:"activitypub-profile__content"},(0,o.createElement)("div",{className:"activitypub-profile__name"},a),(0,o.createElement)("div",{className:"activitypub-profile__handle"},c)),(0,o.createElement)(N,{profile:t,popupStyles:n,userId:r}))}function N(e){let{profile:t,popupStyles:n,userId:r}=e;const[l,a]=(0,o.useState)(!1),c=(0,s.sprintf)((0,s.__)("Follow %s","activitypub"),t?.name);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(u.Button,{className:"activitypub-profile__follow",onClick:()=>a(!0)},(0,s.__)("Follow","activitypub")),l&&(0,o.createElement)(u.Modal,{className:"activitypub-profile__confirm",onRequestClose:()=>a(!1),title:c},(0,o.createElement)(P,{profile:t,userId:r}),(0,o.createElement)("style",null,n)))}function $(e){try{return new URL(e),!0}catch(e){return!1}}function P(e){let{profile:t,userId:n}=e;const{resource:r}=t,l=(0,s.__)("Follow","activitypub"),a=(0,s.__)("Loading...","activitypub"),c=(0,s.__)("Opening...","activitypub"),i=(0,s.__)("Error","activitypub"),p=(0,s.__)("Invalid","activitypub"),[m,v]=(0,o.useState)(l),[h,_]=(0,o.useState)(f),E=(0,b.useCopyToClipboard)(r,(()=>{_(w),setTimeout((()=>_(f)),1e3)})),[g,k]=(0,o.useState)(""),x=(0,o.useCallback)((()=>{let e;if(!$(g)&&!function(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&$(`https://${t[1]}`)}(g))return v(p),e=setTimeout((()=>v(l)),2e3),()=>clearTimeout(e);const t=`/${O}/users/${n}/remote-follow?resource=${g}`;v(a),d()({path:t}).then((e=>{let{url:t}=e;v(c),setTimeout((()=>{window.open(t,"_blank"),v(l)}),200)})).catch((()=>{v(i),setTimeout((()=>v(l)),2e3)}))}),[g]);return(0,o.createElement)("div",{className:"activitypub-follow-me__dialog"},(0,o.createElement)("div",{className:"apmfd__section"},(0,o.createElement)("h4",null,(0,s.__)("My Profile","activitypub")),(0,o.createElement)("div",{className:"apfmd-description"},(0,s.__)("Copy and paste my profile into the search field of your favorite fediverse app or server.","activitypub")),(0,o.createElement)("div",{className:"apfmd__button-group"},(0,o.createElement)("input",{type:"text",value:r,readOnly:!0}),(0,o.createElement)(u.Button,{ref:E},(0,o.createElement)(y,{icon:h}),(0,s.__)("Copy","activitypub")))),(0,o.createElement)("div",{className:"apmfd__section"},(0,o.createElement)("h4",null,(0,s.__)("Your Profile","activitypub")),(0,o.createElement)("div",{className:"apfmd-description"},(0,o.createInterpolateElement)((0,s.__)("Or, if you know your own profile, we can start things that way! (eg https://example.com/yourusername or yourusername@example.com)","activitypub"),{code:(0,o.createElement)("code",null)})),(0,o.createElement)("div",{className:"apfmd__button-group"},(0,o.createElement)("input",{type:"text",value:g,onKeyDown:e=>{"Enter"===e?.code&&x()},onChange:e=>k(e.target.value)}),(0,o.createElement)(u.Button,{onClick:x},m))))}function z(e){let{selectedUser:t,style:n,backgroundColor:r,id:l,useId:a=!1}=e;const[c,i]=(0,o.useState)(C()),s="site"===t?0:t,u=function(e){return g(".apfmd__button-group .components-button",_(e?.elements?.link?.color?.text)||"#111","#fff",_(e?.elements?.link?.[":hover"]?.color?.text)||"#333")}(n),p=a?{id:l}:{};function m(e){i(C(e))}return(0,o.useEffect)((()=>{(function(e){const t={headers:{Accept:"application/activity+json"},path:`/${O}/users/${e}`};return d()(t)})(s).then(m)}),[s]),(0,o.createElement)("div",p,(0,o.createElement)(k,{selector:`#${l}`,style:n,backgroundColor:r}),(0,o.createElement)(S,{profile:c,userId:s,popupStyles:u}))}(0,r.registerBlockType)("activitypub/follow-me",{edit:function(e){let{attributes:t,setAttributes:n}=e;const r=(0,i.useBlockProps)(),l=function(){const e=m?.users?(0,p.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,o.useMemo)((()=>{if(!e)return[];const t=m?.site?[{label:(0,s.__)("Whole Site","activitypub"),value:"site"}]:[];return e.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),t)}),[e])}(),{selectedUser:a}=t;return(0,o.useEffect)((()=>{l.length&&(l.find((e=>{let{value:t}=e;return t===a}))||n({selectedUser:l[0].value}))}),[a,l]),(0,o.createElement)("div",r,(0,o.createElement)(i.InspectorControls,{key:"setting"},(0,o.createElement)(u.PanelBody,{title:(0,s.__)("Followers Options","activitypub")},(0,o.createElement)(u.SelectControl,{label:(0,s.__)("Select User","activitypub"),value:t.selectedUser,options:l,onChange:e=>n({selectedUser:e})}))),(0,o.createElement)(z,c({},t,{id:r.id})))},save:()=>null,icon:a})}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var l=n[e]={exports:{}};return t[e](l,l.exports,r),l.exports}r.m=t,e=[],r.O=(t,n,o,l)=>{if(!n){var a=1/0;for(u=0;u=l)&&Object.keys(r.O).every((e=>r.O[e](n[i])))?n.splice(i--,1):(c=!1,l0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[n,o,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 n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={127:0,740:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var o,l,[a,c,i]=n,s=0;if(a.some((t=>0!==e[t]))){for(o in c)r.o(c,o)&&(r.m[o]=c[o]);if(i)var u=i(r)}for(t&&t(n);sr(843)));o=r.O(o)})();
\ No newline at end of file
diff --git a/build/follow-me/style-index.css b/build/follow-me/style-index.css
new file mode 100644
index 0000000..ad2ac9c
--- /dev/null
+++ b/build/follow-me/style-index.css
@@ -0,0 +1 @@
+.activitypub-follow-me-block-wrapper .activitypub-profile,.editor-styles-wrapper .activitypub-profile{align-items:self-start;display:flex;padding:1rem}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__avatar,.editor-styles-wrapper .activitypub-profile .activitypub-profile__avatar{border-radius:50%;height:75px;margin-right:1rem;width:75px}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__content,.editor-styles-wrapper .activitypub-profile .activitypub-profile__content{flex:1;min-width:0}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__handle,.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__name,.editor-styles-wrapper .activitypub-profile .activitypub-profile__handle,.editor-styles-wrapper .activitypub-profile .activitypub-profile__name{line-height:1.2;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__name,.editor-styles-wrapper .activitypub-profile .activitypub-profile__name{font-size:1.25em}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__follow,.editor-styles-wrapper .activitypub-profile .activitypub-profile__follow{align-self:center;background-color:var(--wp--preset--color--black);color:var(--wp--preset--color--white);margin-left:1rem}.activitypub-follow-me__dialog{max-width:30em}.activitypub-follow-me__dialog h4{line-height:1;margin:0}.activitypub-follow-me__dialog .apmfd__section{margin-bottom:2em}.activitypub-follow-me__dialog .apfmd-description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub-follow-me__dialog .apfmd__button-group{display:flex;justify-content:flex-end}.activitypub-follow-me__dialog .apfmd__button-group svg{height:21px;margin-right:.5em;width:21px}.activitypub-follow-me__dialog .apfmd__button-group input{flex:1;padding-left:1em;padding-right:1em}
diff --git a/build/follow-me/view.asset.php b/build/follow-me/view.asset.php
new file mode 100644
index 0000000..56862e5
--- /dev/null
+++ b/build/follow-me/view.asset.php
@@ -0,0 +1 @@
+ array('wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '06a922cf2e58c94b6431');
diff --git a/build/follow-me/view.js b/build/follow-me/view.js
new file mode 100644
index 0000000..e55d91b
--- /dev/null
+++ b/build/follow-me/view.js
@@ -0,0 +1 @@
+(()=>{"use strict";var e,t={810:(e,t,r)=>{function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:null;return r?`${e}${arguments.length>3&&void 0!==arguments[3]?arguments[3]:""} { ${t}: ${r}; }\n`:""}function _(e,t,r,n){return w(e,"background-color",t)+w(e,"color",r)+w(e,"background-color",n,":hover")+w(e,"background-color",n,":focus")}function h(e){let{selector:t,style:r,backgroundColor:n}=e;const l=function(e,t,r){const n=`${e} .components-button`,o=("string"==typeof(l=r)?y(l):l?.color?.background||null)||t?.color?.background;var l;return _(n,b(t?.elements?.link?.color?.text),o,b(t?.elements?.link?.[":hover"]?.color?.text))}(t,r,n);return(0,o.createElement)("style",null,l)}const{namespace:E}=window._activityPubOptions,g={avatar:"",resource:"@well@hello.dolly",name:(0,s.__)("Hello Dolly Fan Account","activitypub"),url:"#"};function k(e){if(!e)return g;const t={...g,...e};return t.avatar=t?.icon?.url,t}function O(e){let{profile:t,popupStyles:r,userId:n}=e;const{avatar:l,name:a,resource:c}=t;return(0,o.createElement)("div",{className:"activitypub-profile"},(0,o.createElement)("img",{className:"activitypub-profile__avatar",src:l}),(0,o.createElement)("div",{className:"activitypub-profile__content"},(0,o.createElement)("div",{className:"activitypub-profile__name"},a),(0,o.createElement)("div",{className:"activitypub-profile__handle"},c)),(0,o.createElement)(x,{profile:t,popupStyles:r,userId:n}))}function x(e){let{profile:t,popupStyles:r,userId:n}=e;const[l,a]=(0,o.useState)(!1),c=(0,s.sprintf)((0,s.__)("Follow %s","activitypub"),t?.name);return(0,o.createElement)(o.Fragment,null,(0,o.createElement)(u.Button,{className:"activitypub-profile__follow",onClick:()=>a(!0)},(0,s.__)("Follow","activitypub")),l&&(0,o.createElement)(u.Modal,{className:"activitypub-profile__confirm",onRequestClose:()=>a(!1),title:c},(0,o.createElement)(N,{profile:t,userId:n}),(0,o.createElement)("style",null,r)))}function C(e){try{return new URL(e),!0}catch(e){return!1}}function N(e){let{profile:t,userId:r}=e;const{resource:n}=t,l=(0,s.__)("Follow","activitypub"),a=(0,s.__)("Loading...","activitypub"),c=(0,s.__)("Opening...","activitypub"),p=(0,s.__)("Error","activitypub"),y=(0,s.__)("Invalid","activitypub"),[b,w]=(0,o.useState)(l),[_,h]=(0,o.useState)(m),g=(0,f.useCopyToClipboard)(n,(()=>{h(d),setTimeout((()=>h(m)),1e3)})),[k,O]=(0,o.useState)(""),x=(0,o.useCallback)((()=>{let e;if(!C(k)&&!function(e){const t=e.replace(/^@/,"").split("@");return 2===t.length&&C(`https://${t[1]}`)}(k))return w(y),e=setTimeout((()=>w(l)),2e3),()=>clearTimeout(e);const t=`/${E}/users/${r}/remote-follow?resource=${k}`;w(a),i()({path:t}).then((e=>{let{url:t}=e;w(c),setTimeout((()=>{window.open(t,"_blank"),w(l)}),200)})).catch((()=>{w(p),setTimeout((()=>w(l)),2e3)}))}),[k]);return(0,o.createElement)("div",{className:"activitypub-follow-me__dialog"},(0,o.createElement)("div",{className:"apmfd__section"},(0,o.createElement)("h4",null,(0,s.__)("My Profile","activitypub")),(0,o.createElement)("div",{className:"apfmd-description"},(0,s.__)("Copy and paste my profile into the search field of your favorite fediverse app or server.","activitypub")),(0,o.createElement)("div",{className:"apfmd__button-group"},(0,o.createElement)("input",{type:"text",value:n,readOnly:!0}),(0,o.createElement)(u.Button,{ref:g},(0,o.createElement)(v,{icon:_}),(0,s.__)("Copy","activitypub")))),(0,o.createElement)("div",{className:"apmfd__section"},(0,o.createElement)("h4",null,(0,s.__)("Your Profile","activitypub")),(0,o.createElement)("div",{className:"apfmd-description"},(0,o.createInterpolateElement)((0,s.__)("Or, if you know your own profile, we can start things that way! (eg https://example.com/yourusername or yourusername@example.com)","activitypub"),{code:(0,o.createElement)("code",null)})),(0,o.createElement)("div",{className:"apfmd__button-group"},(0,o.createElement)("input",{type:"text",value:k,onKeyDown:e=>{"Enter"===e?.code&&x()},onChange:e=>O(e.target.value)}),(0,o.createElement)(u.Button,{onClick:x},b))))}function S(e){let{selectedUser:t,style:r,backgroundColor:n,id:l,useId:a=!1}=e;const[c,u]=(0,o.useState)(k()),s="site"===t?0:t,p=function(e){return _(".apfmd__button-group .components-button",b(e?.elements?.link?.color?.text)||"#111","#fff",b(e?.elements?.link?.[":hover"]?.color?.text)||"#333")}(r),m=a?{id:l}:{};function d(e){u(k(e))}return(0,o.useEffect)((()=>{(function(e){const t={headers:{Accept:"application/activity+json"},path:`/${E}/users/${e}`};return i()(t)})(s).then(d)}),[s]),(0,o.createElement)("div",m,(0,o.createElement)(h,{selector:`#${l}`,style:r,backgroundColor:n}),(0,o.createElement)(O,{profile:c,userId:s,popupStyles:p}))}let $=1;a()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follow-me-block-wrapper"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,o.render)((0,o.createElement)(S,n({},t,{id:"activitypub-follow-me-block-"+$++,useId:!0})),e)}))}))}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var l=r[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,r,o,l)=>{if(!r){var a=1/0;for(s=0;s=l)&&Object.keys(n.O).every((e=>n.O[e](r[i])))?r.splice(i--,1):(c=!1,l0&&e[s-1][2]>l;s--)e[s]=e[s-1];e[s]=[r,o,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 r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={529:0,740:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var o,l,[a,c,i]=r,u=0;if(a.some((t=>0!==e[t]))){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(i)var s=i(n)}for(t&&t(r);un(810)));o=n.O(o)})();
\ No newline at end of file
diff --git a/build/followers/index.asset.php b/build/followers/index.asset.php
index 06c1d9d..da1854a 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-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '284dffd27ea0242085be');
+ array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '423cdeefa42e7c7cabd1');
diff --git a/build/followers/index.js b/build/followers/index.js
index df9590b..1685162 100644
--- a/build/followers/index.js
+++ b/build/followers/index.js
@@ -1,3 +1,3 @@
-(()=>{var e={184:(e,t)=>{var a;!function(){"use strict";var n={}.hasOwnProperty;function l(){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.wp.element,n=window.wp.primitives,l=(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"}));function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault(),!a&&r(l)}},n)}const g={outlined:"outlined",minimal:"minimal"};function f(e){let{compact:a,nextLabel:n,page:l,pageClick:r,perPage:o,prevLabel:i,total:c,variant:s=g.outlined}=e;const p=((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})(l,Math.ceil(c/o)),u=w()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${s}`,{"is-compact":a});return(0,t.createElement)("nav",{className:u},i&&(0,t.createElement)(d,{key:"prev",page:l-1,pageClick:r,active:1===l,"aria-label":i,className:"wp-block-query-pagination-previous block-editor-block-list__block"},i),!a&&(0,t.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},p.map((e=>(0,t.createElement)(d,{key:e,page:e,pageClick:r,active:e===l,className:"page-numbers"},e)))),n&&(0,t.createElement)(d,{key:"next",page:l+1,pageClick:r,active:l===Math.ceil(c/o),"aria-label":n,className:"wp-block-query-pagination-next block-editor-block-list__block"},n))}const{namespace:y}=window._activityPubOptions;function h(e){let{selectedUser:a,per_page:n,order:l,title:o,page:i,setPage:c,className:u="",followLinks:b=!0}=e;const w="site"===a?0:a,[d,g]=(0,p.useState)([]),[h,_]=(0,p.useState)(0),[E,x]=(0,p.useState)(0),[C,S]=function(){const[e,t]=(0,p.useState)(1);return[e,t]}(),O=i||C,N=c||S,P=(0,t.createInterpolateElement)(/* translators: arrow for previous followers link */
-(0,s.__)("← Less","activitypub"),{span:(0,t.createElement)("span",{class:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(0,t.createInterpolateElement)(/* translators: arrow for next followers link */
-(0,s.__)("More →","activitypub"),{span:(0,t.createElement)("span",{class:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})});return(0,p.useEffect)((()=>{const e=function(e,t,a,n){const l=`/${y}/users/${e}/followers`,r={per_page:t,order:a,page:n,context:"full"};return(0,m.addQueryArgs)(l,r)}(w,n,l,O);v()({path:e}).then((e=>{_(Math.ceil(e.totalItems/n)),x(e.totalItems),g(e.orderedItems)})).catch((e=>console.error(e)))}),[w,n,l,O]),(0,t.createElement)("div",{className:"activitypub-follower-block "+u},(0,t.createElement)("h3",null,o),(0,t.createElement)("ul",null,d&&d.map((e=>(0,t.createElement)("li",{key:e.url},(0,t.createElement)(k,r({},e,{followLinks:b})))))),h>1&&(0,t.createElement)(f,{page:O,perPage:n,total:E,pageClick:N,nextLabel:L,prevLabel:P,compact:"is-style-compact"===u}))}function k(e){let{name:a,icon:n,url:l,preferredUsername:i,followLinks:c=!0}=e;const s=`@${i}`,p={};return c||(p.onClick=e=>e.preventDefault()),(0,t.createElement)(o.ExternalLink,r({className:"activitypub-link",href:l,title:s},p),(0,t.createElement)("img",{width:"40",height:"40",src:n.url,class:"avatar activitypub-avatar"}),(0,t.createElement)("span",{class:"activitypub-actor"},(0,t.createElement)("strong",{className:"activitypub-name"},a),(0,t.createElement)("span",{class:"sep"},"/"),(0,t.createElement)("span",{class:"activitypub-handle"},s)))}const _=window._activityPubOptions?.enabled;(0,e.registerBlockType)("activitypub/followers",{edit:function(e){let{attributes:a,setAttributes:n}=e;const{order:l,per_page:p,selectedUser:u,title:v}=a,m=(0,c.useBlockProps)(),[b,w]=(0,t.useState)(1),d=[{label:(0,s.__)("New to old","activitypub"),value:"desc"},{label:(0,s.__)("Old to new","activitypub"),value:"asc"}],g=function(){const e=_?.users?(0,i.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,t.useMemo)((()=>{if(!e)return[];const t=_?.site?[{label:(0,s.__)("Whole Site","activitypub"),value:"site"}]:[];return e.reduce(((e,t)=>(e.push({label:t.name,value:t.id}),e)),t)}),[e])}(),f=e=>t=>{w(1),n({[e]:t})};return(0,t.createElement)("div",m,(0,t.createElement)(c.InspectorControls,{key:"setting"},(0,t.createElement)(o.PanelBody,{title:(0,s.__)("Followers Options","activitypub")},(0,t.createElement)(o.TextControl,{label:(0,s.__)("Title","activitypub"),help:(0,s.__)("Title to display above the list of followers. Blank for none.","activitypub"),value:v,onChange:e=>n({title:e})}),(0,t.createElement)(o.SelectControl,{label:(0,s.__)("Select User","activitypub"),value:u,options:g,onChange:f("selectedUser")}),(0,t.createElement)(o.SelectControl,{label:(0,s.__)("Sort","activitypub"),value:l,options:d,onChange:f("order")}),(0,t.createElement)(o.RangeControl,{label:(0,s.__)("Number of Followers","activitypub"),value:p,onChange:f("per_page"),min:1,max:10}))),(0,t.createElement)(h,r({},a,{page:b,setPage:w,followLinks:!1})))},save:()=>null,icon:l})})()})();
\ No newline at end of file
+(()=>{var e={184:(e,t)=>{var a;!function(){"use strict";var n={}.hasOwnProperty;function l(){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.wp.element,n=window.wp.primitives,l=(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"}));function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault(),!a&&r(l)}},n)}const d={outlined:"outlined",minimal:"minimal"};function g(e){let{compact:a,nextLabel:n,page:l,pageClick:r,perPage:o,prevLabel:i,total:c,variant:s=d.outlined}=e;const p=((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})(l,Math.ceil(c/o)),u=b()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${s}`,{"is-compact":a});return(0,t.createElement)("nav",{className:u},i&&(0,t.createElement)(w,{key:"prev",page:l-1,pageClick:r,active:1===l,"aria-label":i,className:"wp-block-query-pagination-previous block-editor-block-list__block"},i),!a&&(0,t.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},p.map((e=>(0,t.createElement)(w,{key:e,page:e,pageClick:r,active:e===l,className:"page-numbers"},e)))),n&&(0,t.createElement)(w,{key:"next",page:l+1,pageClick:r,active:l===Math.ceil(c/o),"aria-label":n,className:"wp-block-query-pagination-next block-editor-block-list__block"},n))}const{namespace:f}=window._activityPubOptions;function y(e){let{selectedUser:a,per_page:n,order:l,title:o,page:i,setPage:p,className:m="",followLinks:b=!0}=e;const w="site"===a?0:a,[d,y]=(0,s.useState)([]),[k,E]=(0,s.useState)(0),[_,x]=(0,s.useState)(0),[C,S]=function(){const[e,t]=(0,s.useState)(1);return[e,t]}(),O=i||C,N=p||S,P=(0,t.createInterpolateElement)(/* translators: arrow for previous followers link */
+(0,c.__)("← Less","activitypub"),{span:(0,t.createElement)("span",{class:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(0,t.createInterpolateElement)(/* translators: arrow for next followers link */
+(0,c.__)("More →","activitypub"),{span:(0,t.createElement)("span",{class:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})});return(0,s.useEffect)((()=>{const e=function(e,t,a,n){const l=`/${f}/users/${e}/followers`,r={per_page:t,order:a,page:n,context:"full"};return(0,v.addQueryArgs)(l,r)}(w,n,l,O);u()({path:e}).then((e=>{E(Math.ceil(e.totalItems/n)),x(e.totalItems),y(e.orderedItems)})).catch((()=>{}))}),[w,n,l,O]),(0,t.createElement)("div",{className:"activitypub-follower-block "+m},(0,t.createElement)("h3",null,o),(0,t.createElement)("ul",null,d&&d.map((e=>(0,t.createElement)("li",{key:e.url},(0,t.createElement)(h,r({},e,{followLinks:b})))))),k>1&&(0,t.createElement)(g,{page:O,perPage:n,total:_,pageClick:N,nextLabel:L,prevLabel:P,compact:"is-style-compact"===m}))}function h(e){let{name:a,icon:n,url:l,preferredUsername:i,followLinks:c=!0}=e;const s=`@${i}`,p={};return c||(p.onClick=e=>e.preventDefault()),(0,t.createElement)(o.ExternalLink,r({className:"activitypub-link",href:l,title:s},p),(0,t.createElement)("img",{width:"40",height:"40",src:n.url,class:"avatar activitypub-avatar"}),(0,t.createElement)("span",{class:"activitypub-actor"},(0,t.createElement)("strong",{className:"activitypub-name"},a),(0,t.createElement)("span",{class:"sep"},"/"),(0,t.createElement)("span",{class:"activitypub-handle"},s)))}const k=window.wp.data,E=window._activityPubOptions?.enabled;(0,e.registerBlockType)("activitypub/followers",{edit:function(e){let{attributes:a,setAttributes:n}=e;const{order:l,per_page:s,selectedUser:p,title:u}=a,v=(0,i.useBlockProps)(),[m,b]=(0,t.useState)(1),w=[{label:(0,c.__)("New to old","activitypub"),value:"desc"},{label:(0,c.__)("Old to new","activitypub"),value:"asc"}],d=function(){const e=E?.users?(0,k.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,t.useMemo)((()=>{if(!e)return[];const t=E?.site?[{label:(0,c.__)("Whole Site","activitypub"),value:"site"}]:[];return e.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),t)}),[e])}(),g=e=>t=>{b(1),n({[e]:t})};return(0,t.useEffect)((()=>{d.length&&(d.find((e=>{let{value:t}=e;return t===p}))||n({selectedUser:d[0].value}))}),[p,d]),(0,t.createElement)("div",v,(0,t.createElement)(i.InspectorControls,{key:"setting"},(0,t.createElement)(o.PanelBody,{title:(0,c.__)("Followers Options","activitypub")},(0,t.createElement)(o.TextControl,{label:(0,c.__)("Title","activitypub"),help:(0,c.__)("Title to display above the list of followers. Blank for none.","activitypub"),value:u,onChange:e=>n({title:e})}),(0,t.createElement)(o.SelectControl,{label:(0,c.__)("Select User","activitypub"),value:p,options:d,onChange:g("selectedUser")}),(0,t.createElement)(o.SelectControl,{label:(0,c.__)("Sort","activitypub"),value:l,options:w,onChange:g("order")}),(0,t.createElement)(o.RangeControl,{label:(0,c.__)("Number of Followers","activitypub"),value:s,onChange:g("per_page"),min:1,max:10}))),(0,t.createElement)(y,r({},a,{page:m,setPage:b,followLinks:!1})))},save:()=>null,icon:l})})()})();
\ No newline at end of file
diff --git a/build/followers/view.asset.php b/build/followers/view.asset.php
index 7f57812..32ae6d5 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' => 'd645fd4aa610b479e8f4');
+ array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '6384e801c2802d2fecee');
diff --git a/build/followers/view.js b/build/followers/view.js
index f28d93f..29367a8 100644
--- a/build/followers/view.js
+++ b/build/followers/view.js
@@ -1,3 +1,3 @@
-(()=>{var e,t={189:(e,t,a)=>{"use strict";const r=window.wp.element;function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault(),!t&&l(n)}},a)}const v={outlined:"outlined",minimal:"minimal"};function b(e){let{compact:t,nextLabel:a,page:n,pageClick:l,perPage:o,prevLabel:i,total:c,variant:s=v.outlined}=e;const p=((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})(n,Math.ceil(c/o)),b=u()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${s}`,{"is-compact":t});return(0,r.createElement)("nav",{className:b},i&&(0,r.createElement)(m,{key:"prev",page:n-1,pageClick:l,active:1===n,"aria-label":i,className:"wp-block-query-pagination-previous block-editor-block-list__block"},i),!t&&(0,r.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},p.map((e=>(0,r.createElement)(m,{key:e,page:e,pageClick:l,active:e===n,className:"page-numbers"},e)))),a&&(0,r.createElement)(m,{key:"next",page:n+1,pageClick:l,active:n===Math.ceil(c/o),"aria-label":a,className:"wp-block-query-pagination-next block-editor-block-list__block"},a))}const f=window.wp.components,{namespace:d}=window._activityPubOptions;function w(e){let{selectedUser:t,per_page:a,order:o,title:p,page:u,setPage:m,className:v="",followLinks:f=!0}=e;const w="site"===t?0:t,[y,k]=(0,l.useState)([]),[h,E]=(0,l.useState)(0),[O,x]=(0,l.useState)(0),[_,N]=function(){const[e,t]=(0,l.useState)(1);return[e,t]}(),j=u||_,S=m||N,C=(0,r.createInterpolateElement)(/* translators: arrow for previous followers link */
+(()=>{var e,t={189:(e,t,a)=>{"use strict";const r=window.wp.element;function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t{e.preventDefault(),!t&&l(n)}},a)}const v={outlined:"outlined",minimal:"minimal"};function b(e){let{compact:t,nextLabel:a,page:n,pageClick:l,perPage:i,prevLabel:o,total:c,variant:s=v.outlined}=e;const p=((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})(n,Math.ceil(c/i)),b=u()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${s}`,{"is-compact":t});return(0,r.createElement)("nav",{className:b},o&&(0,r.createElement)(m,{key:"prev",page:n-1,pageClick:l,active:1===n,"aria-label":o,className:"wp-block-query-pagination-previous block-editor-block-list__block"},o),!t&&(0,r.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},p.map((e=>(0,r.createElement)(m,{key:e,page:e,pageClick:l,active:e===n,className:"page-numbers"},e)))),a&&(0,r.createElement)(m,{key:"next",page:n+1,pageClick:l,active:n===Math.ceil(c/i),"aria-label":a,className:"wp-block-query-pagination-next block-editor-block-list__block"},a))}const f=window.wp.components,{namespace:d}=window._activityPubOptions;function w(e){let{selectedUser:t,per_page:a,order:i,title:p,page:u,setPage:m,className:v="",followLinks:f=!0}=e;const w="site"===t?0:t,[y,k]=(0,l.useState)([]),[h,E]=(0,l.useState)(0),[O,x]=(0,l.useState)(0),[_,N]=function(){const[e,t]=(0,l.useState)(1);return[e,t]}(),j=u||_,S=m||N,C=(0,r.createInterpolateElement)(/* translators: arrow for previous followers link */
(0,s.__)("← Less","activitypub"),{span:(0,r.createElement)("span",{class:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(0,r.createInterpolateElement)(/* translators: arrow for next followers link */
-(0,s.__)("More →","activitypub"),{span:(0,r.createElement)("span",{class:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})});return(0,l.useEffect)((()=>{const e=function(e,t,a,r){const n=`/${d}/users/${e}/followers`,l={per_page:t,order:a,page:r,context:"full"};return(0,c.addQueryArgs)(n,l)}(w,a,o,j);i()({path:e}).then((e=>{E(Math.ceil(e.totalItems/a)),x(e.totalItems),k(e.orderedItems)})).catch((e=>console.error(e)))}),[w,a,o,j]),(0,r.createElement)("div",{className:"activitypub-follower-block "+v},(0,r.createElement)("h3",null,p),(0,r.createElement)("ul",null,y&&y.map((e=>(0,r.createElement)("li",{key:e.url},(0,r.createElement)(g,n({},e,{followLinks:f})))))),h>1&&(0,r.createElement)(b,{page:j,perPage:a,total:O,pageClick:S,nextLabel:L,prevLabel:C,compact:"is-style-compact"===v}))}function g(e){let{name:t,icon:a,url:l,preferredUsername:o,followLinks:i=!0}=e;const c=`@${o}`,s={};return i||(s.onClick=e=>e.preventDefault()),(0,r.createElement)(f.ExternalLink,n({className:"activitypub-link",href:l,title:c},s),(0,r.createElement)("img",{width:"40",height:"40",src:a.url,class:"avatar activitypub-avatar"}),(0,r.createElement)("span",{class:"activitypub-actor"},(0,r.createElement)("strong",{className:"activitypub-name"},t),(0,r.createElement)("span",{class:"sep"},"/"),(0,r.createElement)("span",{class:"activitypub-handle"},c)))}const y=window.wp.domReady;a.n(y)()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follower-block"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,r.render)((0,r.createElement)(w,t),e)}))}))},184:(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={638:0,962: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(189)));n=r.O(n)})();
\ No newline at end of file
+(0,s.__)("More →","activitypub"),{span:(0,r.createElement)("span",{class:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})});return(0,l.useEffect)((()=>{const e=function(e,t,a,r){const n=`/${d}/users/${e}/followers`,l={per_page:t,order:a,page:r,context:"full"};return(0,c.addQueryArgs)(n,l)}(w,a,i,j);o()({path:e}).then((e=>{E(Math.ceil(e.totalItems/a)),x(e.totalItems),k(e.orderedItems)})).catch((()=>{}))}),[w,a,i,j]),(0,r.createElement)("div",{className:"activitypub-follower-block "+v},(0,r.createElement)("h3",null,p),(0,r.createElement)("ul",null,y&&y.map((e=>(0,r.createElement)("li",{key:e.url},(0,r.createElement)(g,n({},e,{followLinks:f})))))),h>1&&(0,r.createElement)(b,{page:j,perPage:a,total:O,pageClick:S,nextLabel:L,prevLabel:C,compact:"is-style-compact"===v}))}function g(e){let{name:t,icon:a,url:l,preferredUsername:i,followLinks:o=!0}=e;const c=`@${i}`,s={};return o||(s.onClick=e=>e.preventDefault()),(0,r.createElement)(f.ExternalLink,n({className:"activitypub-link",href:l,title:c},s),(0,r.createElement)("img",{width:"40",height:"40",src:a.url,class:"avatar activitypub-avatar"}),(0,r.createElement)("span",{class:"activitypub-actor"},(0,r.createElement)("strong",{className:"activitypub-name"},t),(0,r.createElement)("span",{class:"sep"},"/"),(0,r.createElement)("span",{class:"activitypub-handle"},c)))}const y=window.wp.domReady;a.n(y)()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follower-block"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,r.render)((0,r.createElement)(w,t),e)}))}))},184:(e,t)=>{var a;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e=[],t=0;t{if(!a){var i=1/0;for(p=0;p=l)&&Object.keys(r.O).every((e=>r.O[e](a[c])))?a.splice(c--,1):(o=!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={638:0,962:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var n,l,[i,o,c]=a,s=0;if(i.some((t=>0!==e[t]))){for(n in o)r.o(o,n)&&(r.m[n]=o[n]);if(c)var p=c(r)}for(t&&t(a);sr(189)));n=r.O(n)})();
\ No newline at end of file
diff --git a/composer.json b/composer.json
index d34d110..054226f 100644
--- a/composer.json
+++ b/composer.json
@@ -41,6 +41,9 @@
],
"lint": [
"vendor/bin/phpcs -n -q"
+ ],
+ "lint:fix": [
+ "vendor/bin/phpcbf"
]
}
}
diff --git a/includes/activity/class-activity.php b/includes/activity/class-activity.php
index 8799238..6c59866 100644
--- a/includes/activity/class-activity.php
+++ b/includes/activity/class-activity.php
@@ -26,7 +26,9 @@ class Activity extends Base_Object {
'schema' => 'http://schema.org#',
'pt' => 'https://joinpeertube.org/ns#',
'toot' => 'http://joinmastodon.org/ns#',
+ 'webfinger' => 'https://webfinger.net/#',
'litepub' => 'http://litepub.social/ns#',
+ 'lemmy' => 'https://join-lemmy.org/ns#',
'value' => 'schema:value',
'Hashtag' => 'as:Hashtag',
'featured' => array(
@@ -37,8 +39,19 @@ class Activity extends Base_Object {
'@id' => 'toot:featuredTags',
'@type' => '@id',
),
+ 'alsoKnownAs' => array(
+ '@id' => 'as:alsoKnownAs',
+ '@type' => '@id',
+ ),
+ 'moderators' => array(
+ '@id' => 'lemmy:moderators',
+ '@type' => '@id',
+ ),
+ 'postingRestrictedToMods' => 'lemmy:postingRestrictedToMods',
'discoverable' => 'toot:discoverable',
+ 'indexable' => 'toot:indexable',
'sensitive' => 'as:sensitive',
+ 'resource' => 'webfinger:resource',
),
);
diff --git a/includes/activity/class-base-object.php b/includes/activity/class-base-object.php
index 3b6703b..a75ed16 100644
--- a/includes/activity/class-base-object.php
+++ b/includes/activity/class-base-object.php
@@ -450,7 +450,7 @@ class Base_Object {
if ( \strncasecmp( $method, 'get', 3 ) === 0 ) {
if ( ! $this->has( $var ) ) {
- return new WP_Error( 'invalid_key', 'Invalid key' );
+ return new WP_Error( 'invalid_key', __( 'Invalid key', 'activitypub' ), array( 'status' => 404 ) );
}
return $this->$var;
@@ -492,7 +492,7 @@ class Base_Object {
*/
public function get( $key ) {
if ( ! $this->has( $key ) ) {
- return new WP_Error( 'invalid_key', 'Invalid key' );
+ return new WP_Error( 'invalid_key', __( 'Invalid key', 'activitypub' ), array( 'status' => 404 ) );
}
return call_user_func( array( $this, 'get_' . $key ) );
@@ -519,7 +519,7 @@ class Base_Object {
*/
public function set( $key, $value ) {
if ( ! $this->has( $key ) ) {
- return new WP_Error( 'invalid_key', 'Invalid key' );
+ return new WP_Error( 'invalid_key', __( 'Invalid key', 'activitypub' ), array( 'status' => 404 ) );
}
$this->$key = $value;
@@ -537,7 +537,7 @@ class Base_Object {
*/
public function add( $key, $value ) {
if ( ! $this->has( $key ) ) {
- return new WP_Error( 'invalid_key', 'Invalid key' );
+ return new WP_Error( 'invalid_key', __( 'Invalid key', 'activitypub' ), array( 'status' => 404 ) );
}
if ( ! isset( $this->$key ) ) {
@@ -562,6 +562,10 @@ class Base_Object {
public static function init_from_json( $json ) {
$array = \json_decode( $json, true );
+ if ( ! is_array( $array ) ) {
+ $array = array();
+ }
+
return self::init_from_array( $array );
}
@@ -573,6 +577,10 @@ class Base_Object {
* @return \Activitypub\Activity\Base_Object An Object built from the JSON string.
*/
public static function init_from_array( $array ) {
+ if ( ! is_array( $array ) ) {
+ return new WP_Error( 'invalid_array', __( 'Invalid array', 'activitypub' ), array( 'status' => 404 ) );
+ }
+
$object = new static();
foreach ( $array as $key => $value ) {
@@ -636,7 +644,7 @@ class Base_Object {
}
// if value is still empty, ignore it for the array and continue.
- if ( $value ) {
+ if ( isset( $value ) ) {
$array[ snake_to_camel_case( $key ) ] = $value;
}
}
diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php
index cddbd1d..e54249d 100644
--- a/includes/class-activitypub.php
+++ b/includes/class-activitypub.php
@@ -17,6 +17,7 @@ class Activitypub {
\add_filter( 'template_include', array( self::class, 'render_json_template' ), 99 );
\add_filter( 'query_vars', array( self::class, 'add_query_vars' ) );
\add_filter( 'pre_get_avatar_data', array( self::class, 'pre_get_avatar_data' ), 11, 2 );
+ \add_filter( 'get_comment_link', array( self::class, 'remote_comment_link' ), 11, 3 );
// Add support for ActivityPub to custom post types
$post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) : array();
@@ -188,6 +189,22 @@ class Activitypub {
return \get_comment_meta( $comment->comment_ID, 'avatar_url', true );
}
+ /**
+ * Link remote comments to source url.
+ *
+ * @param string $comment_link
+ * @param object|WP_Comment $comment
+ *
+ * @return string $url
+ */
+ public static function remote_comment_link( $comment_link, $comment ) {
+ $remote_comment_link = get_comment_meta( $comment->comment_ID, 'source_url', true );
+ if ( $remote_comment_link ) {
+ $comment_link = esc_url( $remote_comment_link );
+ }
+ return $comment_link;
+ }
+
/**
* Store permalink in meta, to send delete Activity.
*
diff --git a/includes/class-admin.php b/includes/class-admin.php
index 70d1206..827012a 100644
--- a/includes/class-admin.php
+++ b/includes/class-admin.php
@@ -1,6 +1,9 @@
'string',
'description' => \esc_html__( 'The Identifier of the Blog-User', 'activitypub' ),
'show_in_rest' => true,
- 'default' => \Activitypub\Model\Blog_User::get_default_username(),
+ 'default' => Blog_User::get_default_username(),
'sanitize_callback' => function( $value ) {
// hack to allow dots in the username
$parts = explode( '.', $value );
@@ -179,7 +182,31 @@ class Admin {
$sanitized[] = \sanitize_title( $part );
}
- return implode( '.', $sanitized );
+ $sanitized = implode( '.', $sanitized );
+
+ // check for login or nicename.
+ $user = new WP_User_Query(
+ array(
+ 'search' => $sanitized,
+ 'search_columns' => array( 'user_login', 'user_nicename' ),
+ 'number' => 1,
+ 'hide_empty' => true,
+ 'fields' => 'ID',
+ )
+ );
+
+ if ( $user->results ) {
+ add_settings_error(
+ 'activitypub_blog_user_identifier',
+ 'activitypub_blog_user_identifier',
+ \esc_html__( 'You cannot use an existing author\'s name for the blog profile ID.', 'activitypub' ),
+ 'error'
+ );
+
+ return Blog_User::get_default_username();
+ }
+
+ return $sanitized;
},
)
);
diff --git a/includes/class-blocks.php b/includes/class-blocks.php
index a59c4df..fca634c 100644
--- a/includes/class-blocks.php
+++ b/includes/class-blocks.php
@@ -13,7 +13,9 @@ class Blocks {
}
public static function add_data() {
- $handle = is_admin() ? 'activitypub-followers-editor-script' : 'activitypub-followers-view-script';
+ $context = is_admin() ? 'editor' : 'view';
+ $followers_handle = 'activitypub-followers-' . $context . '-script';
+ $follow_me_handle = 'activitypub-follow-me-' . $context . '-script';
$data = array(
'namespace' => ACTIVITYPUB_REST_NAMESPACE,
'enabled' => array(
@@ -22,7 +24,8 @@ class Blocks {
),
);
$js = sprintf( 'var _activityPubOptions = %s;', wp_json_encode( $data ) );
- \wp_add_inline_script( $handle, $js, 'before' );
+ \wp_add_inline_script( $followers_handle, $js, 'before' );
+ \wp_add_inline_script( $follow_me_handle, $js, 'before' );
}
public static function register_blocks() {
@@ -32,6 +35,12 @@ class Blocks {
'render_callback' => array( self::class, 'render_follower_block' ),
)
);
+ \register_block_type_from_metadata(
+ ACTIVITYPUB_PLUGIN_DIR . '/build/follow-me',
+ array(
+ 'render_callback' => array( self::class, 'render_follow_me_block' ),
+ )
+ );
}
private static function get_user_id( $user_string ) {
@@ -42,7 +51,24 @@ class Blocks {
return 0;
}
- public static function render_follower_block( $attrs, $content, $block ) {
+ /**
+ * Render the follow me block.
+ * @param array $attrs The block attributes.
+ * @return string The HTML to render.
+ */
+ public static function render_follow_me_block( $attrs ) {
+ $wrapper_attributes = get_block_wrapper_attributes(
+ array(
+ 'aria-label' => __( 'Follow me on the Fediverse', 'activitypub' ),
+ 'class' => 'activitypub-follow-me-block-wrapper',
+ 'data-attrs' => wp_json_encode( $attrs ),
+ )
+ );
+ // todo: render more than an empty div?
+ return '';
+ }
+
+ public static function render_follower_block( $attrs ) {
$followee_user_id = self::get_user_id( $attrs['selectedUser'] );
$per_page = absint( $attrs['per_page'] );
$followers = Followers::get_followers( $followee_user_id, $per_page );
@@ -55,7 +81,7 @@ class Blocks {
)
);
- $html = '
';
+ $html = '
';
if ( $title ) {
$html .= '
' . $title . '
';
}
diff --git a/includes/class-hashtag.php b/includes/class-hashtag.php
index 1a76577..2d03ac4 100644
--- a/includes/class-hashtag.php
+++ b/includes/class-hashtag.php
@@ -43,38 +43,56 @@ class Hashtag {
* @return string the filtered post-content
*/
public static function the_content( $the_content ) {
- $protected_tags = array();
- $protect = function( $m ) use ( &$protected_tags ) {
- $c = \wp_rand( 100000, 999999 );
- $protect = '!#!#PROTECT' . $c . '#!#!';
- while ( isset( $protected_tags[ $protect ] ) ) {
- $c = \wp_rand( 100000, 999999 );
- $protect = '!#!#PROTECT' . $c . '#!#!';
+ $tag_stack = array();
+ $protected_tags = array(
+ 'pre',
+ 'code',
+ 'textarea',
+ 'style',
+ 'a',
+ );
+ $content_with_links = '';
+ $in_protected_tag = false;
+ foreach ( wp_html_split( $the_content ) as $chunk ) {
+ if ( preg_match( '#^$#i', $chunk, $m ) ) {
+ $content_with_links .= $chunk;
+ continue;
}
- $protected_tags[ $protect ] = $m[0];
- return $protect;
- };
- $the_content = preg_replace_callback(
- '##is',
- $protect,
- $the_content
- );
- $the_content = preg_replace_callback(
- '#<(pre|code|textarea|style)\b[^>]*>.*?\1[^>]*>#is',
- $protect,
- $the_content
- );
- $the_content = preg_replace_callback(
- '#<[^>]+>#i',
- $protect,
- $the_content
- );
- $the_content = \preg_replace_callback( '/' . ACTIVITYPUB_HASHTAGS_REGEXP . '/i', array( '\Activitypub\Hashtag', 'replace_with_links' ), $the_content );
+ if ( preg_match( '#^<(/)?([a-z-]+)\b[^>]*>$#i', $chunk, $m ) ) {
+ $tag = strtolower( $m[2] );
+ if ( '/' === $m[1] ) {
+ // Closing tag.
+ $i = array_search( $tag, $tag_stack );
+ // We can only remove the tag from the stack if it is in the stack.
+ if ( false !== $i ) {
+ $tag_stack = array_slice( $tag_stack, 0, $i );
+ }
+ } else {
+ // Opening tag, add it to the stack.
+ $tag_stack[] = $tag;
+ }
- $the_content = str_replace( array_reverse( array_keys( $protected_tags ) ), array_reverse( array_values( $protected_tags ) ), $the_content );
+ // If we're in a protected tag, the tag_stack contains at least one protected tag string.
+ // The protected tag state can only change when we encounter a start or end tag.
+ $in_protected_tag = array_intersect( $tag_stack, $protected_tags );
- return $the_content;
+ // Never inspect tags.
+ $content_with_links .= $chunk;
+ continue;
+ }
+
+ if ( $in_protected_tag ) {
+ // Don't inspect a chunk inside an inspected tag.
+ $content_with_links .= $chunk;
+ continue;
+ }
+
+ // Only reachable when there is no protected tag in the stack.
+ $content_with_links .= \preg_replace_callback( '/' . ACTIVITYPUB_HASHTAGS_REGEXP . '/i', array( '\Activitypub\Hashtag', 'replace_with_links' ), $chunk );
+ }
+
+ return $content_with_links;
}
/**
@@ -89,7 +107,7 @@ class Hashtag {
if ( $tag_object ) {
$link = \get_term_link( $tag_object, 'post_tag' );
- return \sprintf( '#%s', $link, $tag );
+ return \sprintf( '#%s', $link, $tag );
}
return '#' . $tag;
diff --git a/includes/class-health-check.php b/includes/class-health-check.php
index 18cd48e..a802e6f 100644
--- a/includes/class-health-check.php
+++ b/includes/class-health-check.php
@@ -1,6 +1,12 @@
array( self::class, 'test_webfinger' ),
);
+ $tests['direct']['activitypub_test_system_cron'] = array(
+ 'label' => __( 'System Cron Test', 'activitypub' ),
+ 'test' => array( self::class, 'test_system_cron' ),
+ );
+
return $tests;
}
@@ -70,6 +81,49 @@ class Health_Check {
return $result;
}
+ /**
+ * System Cron tests
+ *
+ * @return array
+ */
+ public static function test_system_cron() {
+ $result = array(
+ 'label' => \__( 'System Task Scheduler configured', 'activitypub' ),
+ 'status' => 'good',
+ 'badge' => array(
+ 'label' => \__( 'ActivityPub', 'activitypub' ),
+ 'color' => 'green',
+ ),
+ 'description' => \sprintf(
+ '
%s
',
+ \esc_html__( 'You seem to use the System Task Scheduler to process WP_Cron tasks.', 'activitypub' )
+ ),
+ 'actions' => '',
+ 'test' => 'test_system_cron',
+ );
+
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
+ return $result;
+ }
+
+ $result['status'] = 'recommended';
+ $result['label'] = \__( 'System Task Scheduler not configured', 'activitypub' );
+ $result['badge']['color'] = 'orange';
+ $result['description'] = \sprintf(
+ '
%s
',
+ \__( 'Enhance your WordPress site’s performance and mitigate potential heavy loads caused by plugins like ActivityPub by setting up a system cron job to run WP Cron. This ensures scheduled tasks are executed consistently and reduces the reliance on website traffic for trigger events.', 'activitypub' )
+ );
+ $result['actions'] .= sprintf(
+ '
+ { __( 'Copy and paste my profile into the search field of your favorite fediverse app or server.', 'activitypub' ) }
+
+
+
+
+
+
+
+
{ __( 'Your Profile', 'activitypub' ) }
+
+ { createInterpolateElement(
+ __( 'Or, if you know your own profile, we can start things that way! (eg https://example.com/yourusername or yourusername@example.com)', 'activitypub' ),
+ { code: }
+ ) }
+