Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a6c0ccf
Refactor to filter-based architecture
pfefferle Dec 8, 2025
216b1b8
Add per-version integration classes
pfefferle Dec 8, 2025
a5cae1a
Centralize JRD discovery in controller
pfefferle Dec 8, 2025
fd502cf
Switch to wp-env and update test setup
pfefferle Dec 8, 2025
deb64d7
Fix PHPCS issues and add unit tests
pfefferle Dec 8, 2025
f24b9f4
Fix PHPUnit workflow database creation
pfefferle Dec 8, 2025
d63b498
Fix test failures
pfefferle Dec 8, 2025
b4dd90b
Remove unused get_plugin_meta and get_plugin_version functions
pfefferle Dec 8, 2025
f3a66b6
Remove translatable strings from schema descriptions
pfefferle Dec 8, 2025
e87028e
Add schema to NodeInfo 1.1 and add NodeInfo 2.2 support
pfefferle Dec 8, 2025
4852312
Update NodeInfo schema definitions and protocol handling
pfefferle Dec 8, 2025
71f2846
Bump NodeInfo plugin version to 3.0.0
pfefferle Dec 8, 2025
55ff527
Update requirements and changelog for 3.0.0 release
pfefferle Dec 8, 2025
da08d84
Expand README with plugin usage details
pfefferle Dec 8, 2025
f696505
Add Site Health checks for NodeInfo endpoints
pfefferle Dec 8, 2025
43aa84d
Prefix WordPress core functions with backslash
pfefferle Dec 8, 2025
86be1c2
Add backwards compatibility and update package.json
pfefferle Dec 8, 2025
cd88863
Update .gitattributes with new config files
pfefferle Dec 8, 2025
99d31f2
Update includes/controller/class-nodeinfo2.php
pfefferle Dec 8, 2025
fd8d381
Update phpcs.xml
pfefferle Dec 8, 2025
f49831f
Fix issues from code review
pfefferle Dec 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
.editorconfig export-ignore
.git export-ignore
.gitignore export-ignore
.gitattributes export-ignore
.github export-ignore
.wordpress-org export-ignore
.wp-env.json export-ignore
.travis.yml export-ignore
.codeclimate.yml export-ignore
.data export-ignore
.github export-ignore
.gitattributes export-ignore
.wordpress-org export-ignore
Gruntfile.js export-ignore
LINGUAS export-ignore
Makefile export-ignore
CODE_OF_CONDUCT.md export-ignore
LICENSE.md export-ignore
_site export-ignore
bin export-ignore
CODE_OF_CONDUCT.md export-ignore
composer.json export-ignore
composer.lock export-ignore
docker-compose.yml export-ignore
Gruntfile.js export-ignore
gulpfile.js export-ignore
package.json export-ignore
LICENSE.md export-ignore
LINGUAS export-ignore
Makefile export-ignore
node_modules export-ignore
npm-debug.log export-ignore
phpcs.xml export-ignore
package.json export-ignore
package-lock.json export-ignore
phpcs.xml export-ignore
phpunit.xml export-ignore
phpunit.xml.dist export-ignore
tests export-ignore
node_modules export-ignore
vendor export-ignore
37 changes: 21 additions & 16 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
name: PHP_CodeSniffer
on: push
on:
push:
branches:
- master
paths:
- '**/*.php'
- 'composer.json'
- 'composer.lock'
- 'phpcs.xml'
- '.github/workflows/phpcs.yml'
pull_request:
paths:
- '**/*.php'
- 'composer.json'
- 'composer.lock'
- 'phpcs.xml'
- '.github/workflows/phpcs.yml'
jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup cache
uses: pat-s/always-upload-cache@v1.1.4
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use the hash of composer.json as the key for your cache if you do not commit composer.lock.
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
#key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Install Composer dependencies for PHP
uses: ramsey/composer-install@v3
- name: Detect coding standard violations
run: ./vendor/bin/phpcs -n -q
run: ./vendor/bin/phpcs
69 changes: 69 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: PHPUnit
on:
push:
branches:
- master
paths:
- '**/*.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml.dist'
- '.github/workflows/phpunit.yml'
pull_request:
paths:
- '**/*.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml.dist'
- '.github/workflows/phpunit.yml'

jobs:
phpunit:
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.4
env:
MARIADB_ROOT_PASSWORD: root
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
ports:
- 3306:3306
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=5s
--health-timeout=2s
--health-retries=3

strategy:
fail-fast: false
matrix:
php-version: ['7.2', '8.3']
wp-version: ['latest']
include:
- php-version: '7.2'
wp-version: '6.5'

name: PHP ${{ matrix.php-version }} / WP ${{ matrix.wp-version }}
steps:
- name: Install svn
run: sudo apt-get update && sudo apt-get install -y subversion

- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180
coverage: none

- name: Install Composer dependencies
uses: ramsey/composer-install@v3

- name: Setup Test Environment
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 ${{ matrix.wp-version }}

- name: Run PHPUnit
run: vendor/bin/phpunit
19 changes: 19 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"core": null,
"plugins": [ "." ],
"port": 8891,
"testsPort": 8892,
"env": {
"tests": {
"config": {
"WP_ENVIRONMENT_TYPE": "production"
},
"mappings": {
"wp-content/plugins/nodeinfo": "."
}
}
},
"lifecycleScripts": {
"afterStart": "npx wp-env run cli wp rewrite structure /%year%/%monthnum%/%postname%/"
}
}
74 changes: 71 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
- Contributors: pfefferle
- Donate link: https://notiz.blog/donate/
- Tags: nodeinfo, fediverse, ostatus, diaspora, activitypub
- Requires at least: 4.9
- Requires at least: 6.6
- Tested up to: 6.9
- Stable tag: 2.3.1
- Requires PHP: 5.6
- Stable tag: 3.0.0
- Requires PHP: 7.2
- License: MIT
- License URI: https://opensource.org/licenses/MIT

Expand All @@ -18,12 +18,80 @@ NodeInfo and NodeInfo2 for WordPress!

This plugin provides a barebone JSON file with basic "node"-informations. The file can be extended by other WordPress plugins, like [OStatus](https://wordpress.org/plugins/ostatus-for-wordpress/), [Diaspora](https://github.com/pfefferle/wordpress-dandelion) or [ActivityPub](https://wordpress.org/plugins/activitypub/)/[Pterotype](https://wordpress.org/plugins/pterotype/).

### What information does this plugin share?

The plugin exposes the following public information about your site:

* **Software**: WordPress version (major version only for privacy)
* **Usage statistics**: Number of users, posts, and comments
* **Site info**: Your site name and description
* **Protocols**: Which federation protocols your site supports (e.g., ActivityPub)
* **Services**: Which external services your site can connect to (e.g., RSS feeds)

This information helps other servers in the Fediverse discover and interact with your site.

### Supported NodeInfo versions

This plugin supports all major NodeInfo specification versions:

* **NodeInfo 1.0** and **1.1** - Original specifications
* **NodeInfo 2.0**, **2.1**, and **2.2** - Current specifications with extended metadata
* **NodeInfo2** - Alternative single-endpoint format

### Endpoints

After activation, the following endpoints become available:

* `/.well-known/nodeinfo` - Discovery document (start here)
* `/wp-json/nodeinfo/2.2` - NodeInfo 2.2 (recommended)
* `/wp-json/nodeinfo/2.1` - NodeInfo 2.1
* `/wp-json/nodeinfo/2.0` - NodeInfo 2.0
* `/wp-json/nodeinfo/1.1` - NodeInfo 1.1
* `/wp-json/nodeinfo/1.0` - NodeInfo 1.0
* `/.well-known/x-nodeinfo2` - NodeInfo2 format

## Frequently Asked Questions

### Why do I need this plugin?

If you want your WordPress site to be part of the Fediverse (decentralized social networks like Mastodon), this plugin helps other servers discover information about your site. It works together with plugins like [ActivityPub](https://wordpress.org/plugins/activitypub/) to make your site fully federated.

### Is any private information shared?

No. Only public information about your site is shared, such as your site name, description, and post counts. No personal user data or private content is exposed.

### How can I verify it's working?

Visit `https://yoursite.com/.well-known/nodeinfo` in your browser. You should see a JSON document with links to the NodeInfo endpoints.

### Can other plugins extend the NodeInfo data?

Yes! This plugin is designed to be extensible. Other plugins can use WordPress filters to add their own protocols, services, or metadata. For example, the ActivityPub plugin automatically adds `activitypub` to the supported protocols list.

### How do I know if everything is configured correctly?

Go to **Tools > Site Health** in your WordPress admin. The plugin adds two health checks:

* **NodeInfo Well-Known Endpoint** - Verifies that `/.well-known/nodeinfo` is accessible
* **NodeInfo REST Endpoint** - Verifies that the NodeInfo 2.2 REST endpoint returns valid data

If either check fails, you'll see recommendations on how to fix the issue.

## Changelog

Project and support maintained on github at [pfefferle/wordpress-nodeinfo](https://github.com/pfefferle/wordpress-nodeinfo).

### 3.0.0

* Refactored to filter-based architecture for better extensibility
* Added support for NodeInfo 2.2
* Added separate integration classes for each NodeInfo version (1.0, 1.1, 2.0, 2.1, 2.2)
* Added PSR-4 style autoloader
* Updated schemas to match official NodeInfo specifications with enums and constraints
* Added `nodeinfo_protocols` filter for plugins to register protocols
* Added `software.homepage` field for NodeInfo 2.1 and 2.2
* Added Site Health checks to verify endpoints are accessible

### 2.3.1

* mask version number
Expand Down
86 changes: 47 additions & 39 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
{
"name": "pfefferle/wordpress-nodeinfo",
"description": "NodeInfo and NodeInfo2 for WordPress!",
"require": {
"php": ">=5.6.0",
"composer/installers": "^1.0 || ^2.0"
},
"type": "wordpress-plugin",
"license": "MIT",
"authors": [
{
"name": "Matthias Pfefferle",
"homepage": "https://notiz.blog"
}
],
"extra": {
"installer-name": "nodeinfo"
},
"require-dev": {
"phpunit/phpunit": "^5.7.21 || ^6.5 || ^7.5 || ^8",
"phpcompatibility/php-compatibility": "*",
"phpcompatibility/phpcompatibility-wp": "*",
"squizlabs/php_codesniffer": "3.*",
"wp-coding-standards/wpcs": "*",
"yoast/phpunit-polyfills": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0"
},
"config": {
"allow-plugins": true
},
"allow-plugins": {
"composer/installers": true
},
"scripts": {
"test": [
"composer install",
"bin/install-wp-tests.sh wordpress wordpress wordpress",
"vendor/bin/phpunit"
]
}
"name": "pfefferle/wordpress-nodeinfo",
"description": "NodeInfo and NodeInfo2 for WordPress!",
"type": "wordpress-plugin",
"license": "MIT",
"authors": [
{
"name": "Matthias Pfefferle",
"homepage": "https://notiz.blog"
}
],
"require": {
"php": ">=7.2",
"composer/installers": "^1.0 || ^2.0"
},
"require-dev": {
"phpunit/phpunit": "^8 || ^9",
"phpcompatibility/php-compatibility": "*",
"phpcompatibility/phpcompatibility-wp": "*",
"squizlabs/php_codesniffer": "3.*",
"wp-coding-standards/wpcs": "dev-develop",
"yoast/phpunit-polyfills": "^4.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"sirbrillig/phpcs-variable-analysis": "^2.11",
"phpcsstandards/phpcsextra": "^1.1.0"
},
"extra": {
"installer-name": "nodeinfo"
},
"config": {
"allow-plugins": true
},
"scripts": {
"test": [
"composer install",
"bin/install-wp-tests.sh nodeinfo-test root nodeinfo-test test-db latest true",
"vendor/bin/phpunit"
],
"test:wp-env": [
"wp-env run tests-cli --env-cwd=\"wp-content/plugins/nodeinfo\" vendor/bin/phpunit"
],
"lint": [
"vendor/bin/phpcs"
],
"lint:fix": [
"vendor/bin/phpcbf"
]
}
}
28 changes: 0 additions & 28 deletions docker-compose.yml

This file was deleted.

Loading