Extension:ActivityWiki
Release status: stable |
|
|---|---|
| Implementation | Database |
| Description | Integrates a MediaWiki instance with the Fediverse via ActivityPub |
| Author(s) | Luca Mauri |
| Latest version | 1.1.0 |
| MediaWiki | 1.41+ |
| PHP | 8.0+ |
| Database changes | Yes |
| Composer | lucamauri/activitywiki |
| Licence | GNU General Public License 2.0 or later |
| Download | GitHub:
Note: https://github.com/lucamauri/ActivityWiki/blob/main/README.md |
ActivityWiki is a MediaWiki extension that integrates a wiki installation with the Fediverse via the ActivityPub W3C protocol. The wiki presents itself as a Fediverse actor, similar to a Mastodon account: Mastodon users and other Fediverse participants can follow the wiki and receive notifications directly in their Fediverse timeline whenever pages are created, edited, or deleted.
Features
[edit]- A fully-formed ActivityPub actor object, discoverable via WebFinger (RFC 7033)
- HTTP Signature signing (draft-cavage-http-signatures-12) on all outbound requests, using a self-managed RSA key pair
- Automatic federation of page creations, edits, deletions, and moves as
Create/Update/Deleteactivities - A real, database-backed outbox and followers collection
- Incoming
Follow/Undo|Followhandling, with automaticAcceptreplies - Configurable per-namespace federation, excerpt length, and delivery retry behaviour
- A maintenance script for manual key generation and rotation
All five ActivityPub-spec-required endpoints (actor, WebFinger, outbox, followers, inbox) are implemented and have been verified live against real Fediverse traffic (Mastodon).
Requirements
[edit]| Requirement | Minimum version |
|---|---|
| MediaWiki | 1.41 |
| PHP | 8.0 |
| Database | MySQL / MariaDB |
| Web server | Apache or Nginx, with the ability to add a rewrite rule (required for WebFinger — see below) |
Installation
[edit]Option A — Git
[edit]cd extensions/
git clone https://github.com/lucamauri/ActivityWiki.git ActivityWiki
Option B — Composer / Packagist
[edit]ActivityWiki is published on Packagist as lucamauri/activitywiki. If your MediaWiki installation is Composer-managed at the root, run this from the installation root (not the extensions/ directory):
composer require lucamauri/activitywiki
The package declares itself as a MediaWiki extension type, so the composer/installers plugin (bundled with MediaWiki core by default) places it directly into extensions/ActivityWiki/ automatically.
Common steps (either installation method)
[edit]Add to LocalSettings.php:
wfLoadExtension( 'ActivityWiki' );
Run the database update script:
php maintenance/run.php update.php
Set up WebFinger routing — this step is required; without it the wiki is invisible to Fediverse search even though every other endpoint functions correctly. See WebFinger routing below.
Configuration
[edit]All configuration variables are optional; defaults are shown below.
| Variable | Default | Description |
|---|---|---|
$wgActivityWikiEnabled | true | Master switch — disable to pause all federation without uninstalling. |
$wgActivityWikiActorName | null | Display name shown on Mastodon and other Fediverse clients. Defaults to $wgSitename. |
$wgActivityWikiActorUsername | null | The handle for the wiki actor (the part before @domain). Defaults to a slugified $wgSitename. |
$wgActivityWikiActorSummary | | Short bio shown on the Mastodon profile. |
$wgActivityWikiActorIcon | null | Absolute URL to the wiki logo used as the actor avatar. Defaults to $wgFavicon. |
$wgActivityWikiKeySize | 2048 | RSA key size in bits for HTTP Signature key generation. Minimum 2048, recommended 4096. |
$wgActivityWikiPublishNamespaces | [ NS_MAIN ] | Array of namespace constants to federate. |
$wgActivityWikiPublishCreations | true | Federate page creations as Create activities. |
$wgActivityWikiPublishEdits | true | Federate page edits as Update activities. |
$wgActivityWikiPublishDeletions | true | Federate page deletions as Delete activities. |
$wgActivityWikiPublishMoves | true | Federate page moves/renames as Update activities. |
$wgActivityWikiPublishMinorEdits | false | Whether minor edits are federated. Suppressed by default. |
$wgActivityWikiPublishProtections | false | Whether page protection changes are federated. |
$wgActivityWikiExcerptLength | 500 | Maximum plain-text excerpt length (characters) included in activities. |
$wgActivityWikiDeliveryRetries | 3 | Retry attempts for failed HTTP deliveries (outbound activities and Accept replies). |
$wgActivityWikiOutboxLimit | 20 | Maximum number of activities returned by the outbox endpoint (most recent first). Does not affect the reported totalItems count. |
$wgActivityWikiEnableUserActors | false | Enable per-user ActivityPub actors. Post-MVP, not yet implemented — do not enable in production. |
$wgActivityWikiDebugLevel | 0 | Debug logging level (0 = off, 1 = verbose). |
To see ActivityWiki's debug log output, add a dedicated log channel:
$wgDebugLogGroups['ActivityWiki'] = '/path/to/your/logs/ActivityWiki.log';
WebFinger routing
[edit]The WebFinger protocol (RFC 7033) requires requests to be served from a fixed, well-known path at the root of your domain:
https://yourdomain.org/.well-known/webfinger?resource=acct:user@yourdomain.org
This path sits outside MediaWiki's normal URL space, so MediaWiki cannot serve it on its own. Two things are required: the bundled entry-point script, and a web-server rewrite rule pointing to it.
Why a separate entry-point file is needed
[edit]MediaWiki's REST router validates that every incoming REQUEST_URI starts with the REST base path. A plain web-server-level rewrite from /.well-known/webfinger straight to the REST path is not enough on its own, since the rewrite happens after PHP has already read $_SERVER['REQUEST_URI']. The bundled entry-points/webfinger.php corrects $_SERVER['REQUEST_URI'] itself before MediaWiki boots, then hands off to rest.php.
Apache
[edit]RewriteRule ^\.well-known/webfinger$ %{DOCUMENT_ROOT}/webfinger.php [QSA,L]
Do not anchor the pattern with a leading / — inside a <VirtualHost> block, Apache's RewriteRule matches the URL path without a leading slash.
Nginx
[edit]location = /.well-known/webfinger {
fastcgi_param REQUEST_URI /your-script-path/rest.php/activitywiki/webfinger;
fastcgi_param QUERY_STRING $query_string;
}
Full step-by-step instructions, including reverse-proxy notes (Anubis, Varnish, Cloudflare) and a troubleshooting table, are in the project README.
Key rotation
[edit]The RSA key pair used for HTTP Signature signing is generated automatically on first install. A maintenance script, maintenance/GenerateKeys.php, is available for manual generation and rotation:
# First-time generation / safe check (no existing key required):
php maintenance/run.php extensions/ActivityWiki/maintenance/GenerateKeys.php
# Deliberate rotation of an existing key (destructive, requires --force):
php maintenance/run.php extensions/ActivityWiki/maintenance/GenerateKeys.php --force
Rotating an existing key is gated behind --force since it immediately invalidates the previous key — remote servers with a cached copy of the old public key may continue rejecting signed requests until their cache expires.
