This is an MPP server currently in development for [MPP.dev](https://www.multiplayerpiano.dev). The original server is old and the site desperately needs a new one.
This server uses Bun - not just the runtime, but the libraries as well. This is because Bun provides easy access to uWebSockets.js, a speedy implementation of WebSockets that heavily outperforms the old `ws` module that is used so frequently.
I have tried to comply well with Brandon Lockaby's original MPP server so that this server stays widely accessible for any frontend implementation, including the ones used by MultiplayerPiano.net, LapisHusky's frontend, and the frontends used by nagalun's server, as well as the smnmpp and mpp.hri7566.info frontends.
Of course, most of the ones I have listed probably won't work yet because I haven't implemented a way to switch between token authentication and legacy connections yet.
Regardless, this server is meant for speed, stability, and compatability.
This server uses Prisma as an ORM for saving user data, and is currently setup to interface with SQLite. I may be switching this to PostgreSQL in the very near future, so don't get too comfortable with SQLite.
Brandon's server originally used MongoDB for storing user data, but there are too many reasons to list why it isn't fit for this project here, so I will link [this video by Theo](https://www.youtube.com/watch?v=cC6HFd1zcbo) instead.
## List of features
- Chat
- Original chat filter by chacha and Brandon Lockaby
Don't expect these instructions to stay the same. They might not even be up to date already! This is due to frequent changes in this repository, as this project is still in active development.
For token auth, there are a few options to consider. In `config/users.yml`, you can set `tokenAuth` to a few different values:
-`jwt`: Use JWT token authentication
-`uuid`: Use UUID token authentication
-`none`: Disable token authentication
If you are using UUID token authentication, the server will generate a UUID token for each user when they first connect.
If you are using JWT token authentication, you will need to generate a key for the server to use.
This can be done by running the following command:
```
$ openssl genrsa -out mppkey 2048
```
For antibot/browser detection there are also a few options to consider. In `config/users.yml`, you can set `browserChallenge` to a few different values:
-`none`: Disable browser challenge
-`basic`: Use a simple function to detect browsers
-`obf`: Use an obfuscated function to detect browsers - TODO: implement this
The `basic` option only sends a simple function to the client, and the `obf` option sends an obfuscated mess to the client.
This option requires the newer-style (MPP.net) frontend to be used.