Skip to content

Commit

Permalink
Merge branch 'trunk' into add/early-return-filter-for-upload-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwiebe authored Nov 22, 2024
2 parents e04bb3f + b729704 commit fec71ea
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 173 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* A `pre_activitypub_get_upload_baseurl` filter
* Fediverse Preview on post-overview page
* GitHub action to enforce Changelog updates.

### Improved

* Outsource Constants to a separate file
* Better handling of `readme.txt` and `README.md`

## 4.2.1 - 2024-11-20

Expand Down
2 changes: 1 addition & 1 deletion FEDERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ More information on HTTP Signatures, as well as examples, can be found here: htt
- Frequently Asked Questions: https://github.com/Automattic/wordpress-activitypub?tab=readme-ov-file#frequently-asked-questions
- Installation Instructions: https://github.com/Automattic/wordpress-activitypub?tab=readme-ov-file#installation
- Upgrade Notice: https://github.com/Automattic/wordpress-activitypub?tab=readme-ov-file#upgrade-notice
- Changelog: https://github.com/Automattic/wordpress-activitypub?tab=readme-ov-file#changelog
- Changelog: https://github.com/Automattic/wordpress-activitypub/blob/trunk/CHANGELOG.md
57 changes: 0 additions & 57 deletions Gruntfile.js

This file was deleted.

118 changes: 27 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,12 @@
# 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/), [cavalierlife](https://profiles.wordpress.org/cavalierlife/)
**Tags:** OStatus, fediverse, activitypub, activitystream
**Requires at least:** 5.5
**Tested up to:** 6.7
**Stable tag:** 4.2.1
**Requires PHP:** 7.0
**License:** MIT
**License URI:** http://opensource.org/licenses/MIT
# ActivityPub

The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
This is the [ActivityPub plugin](https://wordpress.org/plugins/activitypub/) repo.

## Description ##
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.

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.
## Demo

https://www.youtube.com/watch?v=QzYozbNneVc

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 `@[email protected]`, and authors like Jane and Bob would have their individual profiles at `@[email protected]` and `@[email protected]`, respectively.

An example: I give you my Mastodon profile name: `@[email protected]`. 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 `@[email protected]`.

Once you follow Jane's `@[email protected]` profile, any blog post she crafts on `example.com` will land in your Home feed. Simultaneously, by following the blog-wide profile `@[email protected]`, 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/)/[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/)
* [Firefish](https://joinfirefish.org/) (rebrand of Calckey)

Some things to note:

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 still resolve 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 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 `@[email protected]` or `@[email protected]`, 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.
You can test out the plugin (settings) with [WordPress Playground](https://wordpress.org/plugins/activitypub/?preview=1).

> [!NOTE]
> It may take up to 15 minutes or so for the new post to show up in your federated feed. This is because the messages are sent to the federated platforms using a delayed cron. This avoids breaking the publishing process for those cases where users might have lots of followers. So please don’t assume that just because you didn’t see it show up right away that something is broken. Give it some time. In most cases, it will show up within a few minutes, and you’ll know everything is working as expected.
Expand Down Expand Up @@ -204,63 +161,42 @@ For reasons of data protection, it is not possible to see the followers of other
* Improved: Provide contextual fallback for dynamic blocks

### 4.0.0 ###
=======
> [WordPress Playground](https://wordpress.org/playground/) is the platform that lets you run WordPress instantly on any device without a host. It’s your place to build, experiment, test, and grow.
* Added: Fire an action before a follower is removed
* Added: Make Intent-URL filterable
* Added: `title` attribute to link headers for better readability
* Added: Post "visibility" feature
* Added: Attribution-Domains support
* Improved: Inbox validation
* Improved: WordPress-Post-Type - Detection
* Improved: Only validate POST params and do not fall back to GET params
* Improved: ID handling for a better compatibility with caching plugins
* Fixed: The "Shared Inbox" endpoint
* Fixed: Ensure that sticky_posts is an array
* Fixed: URLs and Hashtags in profiles were not converted
* Fixed: A lot of small improvements and fixes
## Documentation

See full Changelog on [GitHub](https://github.com/Automattic/wordpress-activitypub/blob/trunk/CHANGELOG.md).
WIP.

## Upgrade Notice ##
## Federation

### 1.0.0 ###
ActivityPub is a protocol for federated social networks, enabling communication between different platforms. For details on what the plugin supports, refer to the [FEDERATION.md](.FEDERATION.md) file.

For version 1.0.0 we have completely rebuilt the followers lists. There is a migration from the old format to the new, but it may take some time until the migration is complete. No data will be lost in the process, please give the migration some time.
## Support

## Installation ##
If you need help, [check out the support forums on WordPress.org](https://wordpress.org/support/plugin/activitypub/).

Follow the normal instructions for [installing WordPress plugins](https://wordpress.org/support/article/managing-plugins/).
## Contribute

### Automatic Plugin Installation ###
Thank you for thinking about contributing to the ActivityPub plugin! If you're unsure of anything, feel free to submit an issue or pull request on any topic. The worst that can happen is that you'll be politely directed to the best location to ask your question or to change something in your pull request. There are a variety of options for how you can help:

To add a WordPress Plugin using the [built-in plugin installer](https://codex.wordpress.org/Administration_Screens#Add_New_Plugins):
* Write and submit patches.
* [Discuss new features and enhancements](https://github.com/Automattic/wordpress-activitypub/discussions).
* If you found a bug, [file a report here](https://github.com/Automattic/wordpress-activitypub/issues/new?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen&template=bug_report.yml).
* [Translate the ActivityPub plugin in your language](https://translate.wordpress.org/projects/wp-plugins/activitypub/).

1. Go to [Plugins](https://codex.wordpress.org/Administration_Screens#Plugins) > [Add New](https://codex.wordpress.org/Plugins_Add_New_Screen).
1. Type "`activitypub`" into the **Search Plugins** box.
1. Find the WordPress Plugin you wish to install.
1. Click **Details** for more information about the Plugin and instructions you may wish to print or save to help setup the Plugin.
1. Click **Install Now** to install the WordPress Plugin.
1. The resulting installation screen will list the installation as successful or note any problems during the install.
1. If successful, click **Activate Plugin** to activate it, or **Return to Plugin Installer** for further actions.
To clarify these expectations, we have adopted the code of conduct defined by the Contributor Covenant. [It can be read in full here](./CODE_OF_CONDUCT.md).

### Manual Plugin Installation ###
## Security

There are a few cases when manually installing a WordPress Plugin is appropriate.
Need to report a security vulnerability? Go to https://automattic.com/security/ or directly to our security bug bounty site https://hackerone.com/automattic.

* If you wish to control the placement and the process of installing a WordPress Plugin.
* If your server does not permit automatic installation of a WordPress Plugin.
* If you want to try the [latest development version](https://github.com/pfefferle/wordpress-activitypub).
You can find more information on reporting security vulnerabilities in our [SECURITY.md](./SECURITY.md) file.

Installation of a WordPress Plugin manually requires FTP familiarity and the awareness that you may put your site at risk if you install a WordPress Plugin incompatible with the current version or from an unreliable source.
## License

Backup your site completely before proceeding.
The ActivityPub plugin is licensed under the [MIT license](./LICENSE).

To install a WordPress Plugin manually:
## Join us!

* Download your WordPress Plugin to your desktop.
* Download from [the WordPress directory](https://wordpress.org/plugins/activitypub/)
* Download from [GitHub](https://github.com/pfefferle/wordpress-activitypub/releases)
* If downloaded as a zip archive, extract the Plugin folder to your desktop.
* With your FTP program, upload the Plugin folder to the `wp-content/plugins` folder in your WordPress directory online.
* Go to [Plugins screen](https://codex.wordpress.org/Administration_Screens#Plugins) and find the newly uploaded Plugin in the list.
* Click **Activate** to activate it.
Interested in working on awesome open-source code all day? [Join us](https://automattic.com/work-with-us/)!
33 changes: 33 additions & 0 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public static function init() {
\add_action( 'load-comment.php', array( self::class, 'edit_comment' ) );
\add_action( 'load-post.php', array( self::class, 'edit_post' ) );
\add_action( 'load-edit.php', array( self::class, 'list_posts' ) );
\add_filter( 'page_row_actions', array( self::class, 'row_actions' ), 10, 2 );
\add_filter( 'post_row_actions', array( self::class, 'row_actions' ), 10, 2 );
\add_action( 'personal_options_update', array( self::class, 'save_user_settings' ) );
\add_action( 'admin_enqueue_scripts', array( self::class, 'enqueue_scripts' ) );
\add_action( 'admin_notices', array( self::class, 'admin_notices' ) );
Expand Down Expand Up @@ -794,4 +796,35 @@ public static function dashboard_glance_items( $items ) {

return $items;
}

/**
* Add a "⁂ Preview" link to the row actions.
*
* @param array $actions The existing actions.
* @param \WP_Post $post The post object.
*
* @return array The modified actions.
*/
public static function row_actions( $actions, $post ) {
// check if the post is enabled for ActivityPub.
if (
! \post_type_supports( \get_post_type( $post ), 'activitypub' ) ||
! in_array( $post->post_status, array( 'pending', 'draft', 'future', 'publish' ), true ) ||
! \current_user_can( 'edit_post', $post->ID ) ||
ACTIVITYPUB_CONTENT_VISIBILITY_LOCAL === get_content_visibility( $post ) ||
site_supports_blocks()
) {
return $actions;
}

$preview_url = add_query_arg( 'activitypub', 'true', \get_preview_post_link( $post ) );

$actions['activitypub'] = sprintf(
'<a href="%s" target="_blank">%s</a>',
\esc_url( $preview_url ),
\esc_html__( '⁂ Fediverse Preview', 'activitypub' )
);

return $actions;
}
}
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"scripts": {
"dev": "wp-scripts start",
"build": "wp-scripts build",
"readme": "grunt wp_readme_to_markdown",
"env-start": "wp-env start && wp-env run cli wp rewrite structure '/%year%/%monthnum%/%postname%/'",
"env-stop": "wp-env stop"
},
Expand All @@ -30,10 +29,6 @@
"@wordpress/env": "^10.10.0",
"@wordpress/icons": "^10.10.0",
"@wordpress/scripts": "^27.0.0",
"classnames": "^2.3.2",
"grunt": "^1.1.0",
"grunt-checktextdomain": "^1.0.1",
"grunt-wp-i18n": "^1.0.3",
"grunt-wp-readme-to-markdown": "^2.0.1"
"classnames": "^2.3.2"
}
}
20 changes: 2 additions & 18 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,6 @@ So what’s the process?

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:

* blog profile pages (JSON representation)
* author profile pages (JSON representation)
* custom links
* functional inbox/outbox
* follow (accept follows)
* share posts
* receive comments/reactions
* signature verification
* threaded comments support

To implement:

* replace shortcodes with blocks for layout

= What is "ActivityPub for WordPress" =

*ActivityPub for WordPress* extends WordPress with some Fediverse features, but it does not compete with platforms like Friendica or Mastodon. If you want to run a **decentralized social network**, please use [Mastodon](https://joinmastodon.org/) or [GNU social](https://gnusocial.network/).
Expand Down Expand Up @@ -153,8 +135,10 @@ For reasons of data protection, it is not possible to see the followers of other
= Dev =

* Added: A `pre_activitypub_get_upload_baseurl` filter
* Added: Fediverse Preview on post-overview page
* Added: GitHub action to enforce Changelog updates.
* Improved: Outsource Constants to a separate file
* Improved: Better handling of `readme.txt` and `README.md`

= 4.2.1 =

Expand Down

0 comments on commit fec71ea

Please sign in to comment.