matrixbridge/ppfun-bridge/README.md

2.5 KiB

ppfun-bridge Matrix Application Service

Sends chat messages from ppfun to matrix and vice versa.

Uses the matrix Application Service API and pixelplanet.fun admin-API (ApiWebsocket and ./adminapi, so admin-access and set APISOCKET_KEY is required).

It is supposed to run on the same server as matrix-synapse.

The Application Service communicaties with matrix via HTTP and listens itself on the port 8009.

Running

Install dependencies

npm install

Edit ppfun-registration.yaml keys hs_key and as_key into some random strings and move the file somewhere where both the ppfun-bridge and matrix-synapse can access it. Don't change the pp_ aliases, because they are hardcoded in the module and bridge.

Edit your homeserver.yml matrix-synapse config file and add a path to the ppfun-registration.yml like this:

app_service_config_files:
  - /etc/matrix-synapse/ppfun-registration.yaml

Edit ecosystem.yml and set the path to the ppfun-registration.yml as REGISTRATION_YAML. Set the pixelplanet APISOCKET_KEY and APISOCKET_URL (like https://pixelplanet.fun/mcws) and PPFUN_UID to a user-id from pixelplanet that the bridge sends messages as (can be any number, but its better if its an existing user made for the bridge). HOMESERVER_URL should be the local url to matrix-synapse like http://localhost:8008 and HOMESERVER_DOMAIN its base_url / server_name like pixelplanet.fun

Now you can start the brige with pm2:

pm2 start ecosystem.yml

and stop it with

pm2 stop ppfun-bridge

and watch its logs with

pm2 log ppfun-bridge

Room Creation

The bridge automatically creates matrix rooms for all public pixelplanet channels available and makes the '@pp_admin:pixelplanet.fun' user admin. You want to create this admin user first to be able to login as it. Or change the room-creation code in src/ppfunMatrixBridge.js in the connectRooms method. Some things are hardcoded there. And the URL where to fetch chunks from pixelplanet is hardcoded in src/pixelplanet/loadChunk.js.

References