2024-07-15 20:46:44 +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 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';
|
2024-07-19 18:28:59 +02:00
|
|
|
create user if not exists 'federatoradmin'@'localhost' identified by '*change*me*as*well';
|
|
|
|
grant all privileges on federator.* to 'federatoradmin'@'localhost';
|
2024-07-15 20:46:44 +02:00
|
|
|
|
2024-07-23 22:37:02 +02:00
|
|
|
After this, change the settings in the ini file to match above changed passwords.
|
|
|
|
change to php/federator and run
|
|
|
|
php maintenance dbupgrade
|
|
|
|
to install all the needed table. Also run this after an update.
|
2024-07-15 20:46:44 +02:00
|
|
|
|
2024-07-17 21:45:33 +02:00
|
|
|
If the include redis cache is enabled, create a users.acl for redis with the content:
|
|
|
|
|
2024-07-22 17:27:48 +02:00
|
|
|
user federator on ~u_* +get +set ~s_* +get +setex ~m_* +get +setex >redis*change*password
|
2024-07-17 21:45:33 +02:00
|
|
|
|
|
|
|
change password in the rediscache.ini to match your given password.
|
|
|
|
|
2024-07-15 20:46:44 +02:00
|
|
|
To configure an apache server, add the following rewrite rules:
|
|
|
|
|
|
|
|
<Directory /where/ever/you/put/it>
|
|
|
|
RewriteEngine on
|
|
|
|
RewriteBase /
|
2024-07-23 22:37:02 +02:00
|
|
|
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 ^api/federator/(.+)$ federator.php?_call=$1 [L,END]
|
2024-07-22 15:40:16 +02:00
|
|
|
RewriteRule ^(\.well-known/.*)$ /federator.php?_call=$1 [L,END]
|
2024-07-23 22:37:02 +02:00
|
|
|
RewriteRule ^(nodeinfo/2\.[01])$ /federator.php?_call=$1 [L,END]
|
2024-07-15 20:46:44 +02:00
|
|
|
</Directory>
|
|
|
|
|
|
|
|
With the dummy plugin and everything installed correctly a
|
|
|
|
|
2024-07-22 15:40:16 +02:00
|
|
|
> curl -v http://localhost/api/federator/v1/dummy/moo -H "X-Session: somethingvalid" -H "X-Profile: ihaveone"
|
2024-07-15 20:46:44 +02:00
|
|
|
|
|
|
|
should return a piece of ascii art.
|