No description
Find a file
2025-05-28 18:02:05 +02:00
.phan added queue support and paths-refactoring 2025-05-15 17:39:12 +02:00
htdocs conditionally convert article to note 2025-05-26 16:17:23 +02:00
lang/federator outobx WIP, almost complete 2024-08-03 19:55:50 +02:00
php/federator support external services to comment&like on CN 2025-05-28 16:52:20 +02:00
plugins/federator ap prefix for ext-username sent to ContentNation 2025-05-28 18:02:05 +02:00
sql support external services to comment&like on CN 2025-05-28 16:52:20 +02:00
templates/federator small bug fixes 2025-05-07 17:01:11 +02:00
.gitattributes fix line endings 2025-04-21 14:56:44 +02:00
.gitignore initial mastodon support and minor improvements 2025-04-08 22:03:19 +02:00
composer.json added queue support and paths-refactoring 2025-05-15 17:39:12 +02:00
config.ini added queue support and paths-refactoring 2025-05-15 17:39:12 +02:00
contentnation.ini added queue support and paths-refactoring 2025-05-15 17:39:12 +02:00
Doxyfile documentation updates 2024-07-17 15:45:19 +02:00
formatsupport.json conditionally convert article to note 2025-05-26 16:17:23 +02:00
phan-stubs.php fix phan errors 2025-04-21 21:06:03 +02:00
phpdoc.dist.xml documentation updates 2024-07-17 15:45:19 +02:00
progress.md new checkbox 2024-07-22 17:39:59 +02:00
README.md small bug fixes 2025-05-07 17:01:11 +02:00
rediscache.ini small bug fixes 2025-05-07 17:01:11 +02:00
release.sh folder restructuring, namespace adjustments 2024-07-20 19:17:36 +02:00

A system to connect non-federated system to federation (ActivityPub)

NOTE: this is work in progress, it is nowhere near completion nor function

installation

install composer via your package manager or via the official documation install dependencies by using

composer install

Upload/copy the files to a directory where php can be run from. The files in the htdocs should be the only reachable, the others should not be served via the web server. Structure:

  • htdocs <= reachable
  • php <= implementation
  • plugins <= plugin directory for well - plugins
  • config.ini <= the configuration

The default config includes a dummy plugin to connect to a non-exisitng server. It accepts any session id and profile name. The database is not used yet, but it must be created and the user with given account data must be able to reach it.

Needed SQL commands:

create database federator;
create user if not exists 'federator'@'localhost' identified by '*change*me*';
grant select,insert,update,delete on federator.* to 'federator'@'localhost';
create user if not exists 'federatoradmin'@'localhost' identified by '*change*me*as*well';
grant all privileges on federator.* to 'federatoradmin'@'localhost';

After this, change the settings in the ini file to match above changed passwords. change to php/federator and run php maintenance.php dbupgrade to install all the needed table. Also run this after an update.

If the include redis cache is enabled,

  • install redis

  • create a users.acl for redis with the content:

    user federator on ~u_* +get +set ~s_* +get +setex ~m_* +get +setex ~publickey_* +get +setex >redischangepassword

  • change password in the rediscache.ini to match your given password.

  • install the redis plugin from pecl if not provided via your distro

  • enable openssl in php.ini if not already done

To configure an apache server, add the following rewrite rules:

<Directory /where/ever/you/put/it/htdocs>
  RewriteEngine on
  RewriteBase /
  RewriteCond expr "%{HTTP:accept} -strcmatch '*application/ld+json*'" [OR]
  RewriteCond expr "%{HTTP:accept} -strcmatch '*application/jrd+json*'" [OR]
  RewriteCond expr "%{HTTP:accept} -strcmatch '*application/activity+json*'" [OR]
  RewriteCond expr "%{HTTP:content-type} -strcmatch '*application/activity+json*'"
  RewriteRule ^@(.*)$ /federator.php?_call=fedusers/$1 [L,END]
  RewriteRule ^users/(.*)$ /federator.php?_call=fedusers/$1 [L,END]
  RewriteRule ^inbox[/]?$ /federator.php?_call=fedusers/inbox [L,END]
  RewriteRule ^api/federator/(.+)$ /federator.php?_call=$1 [L,END]
  RewriteRule ^(\.well-known/.*)$ /federator.php?_call=$1 [L,END]
  RewriteRule ^(nodeinfo/2\.[01])$ /federator.php?_call=$1 [L,END]
  RewriteRule ^([a-zA-Z0-9_-]+.*)$ /federator.php?_call=fedusers/$1 [L,END]
</Directory>

change your document root for the domain you want to use (or default one if using localhost) to the directory you installed it, with the /htdocs at the end. A user should only be able to open that file, not the other data.

With the dummy plugin and everything installed correctly a

curl -v http://localhost/api/federator/v1/dummy/moo -H "X-Session: somethingvalid" -H "X-Profile: ihaveone"

should return a piece of ascii art.