matrixbridge/ppfun-bridge/README.md

62 lines
2.3 KiB
Markdown
Raw Normal View History

2022-01-13 10:55:02 +00:00
# ppfun-bridge Matrix Application Service
Sends chat messages from ppfun to matrix and vice versa.
Uses the matrix [Application Service API](https://spec.matrix.org/v1.1/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](https://matrix.org/docs/projects/server/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
```
2022-01-14 00:18:47 +00:00
## 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.
2022-01-13 10:55:02 +00:00
## References
- its based on [matrix-appservice-bridge](https://github.com/matrix-org/matrix-appservice-bridge/blob/develop/HOWTO.md)
- [matrix-appservice-bridge docs](https://matrix-org.github.io/matrix-appservice-bridge/3.2.0/classes/Bridge.html#run)
- [matrix-appservice-bridge example](https://github.com/matrix-org/matrix-appservice-bridge/blob/develop/HOWTO.md)