Go to file
Hri7566 1f16715aa7 Implement chat banned words filter from a vague memory of a snippet 2024-07-13 14:10:20 -04:00
.vscode old changes 2024-01-06 04:15:27 -05:00
config Fix user limit in lobbies, implement lobby backdoor, admin chat messages, comment changes, various bugfixes 2024-07-13 05:52:16 -04:00
prisma Add rate limits for every message, fix lobby regex, implement tags into database, reword comments, add channel flags 2024-07-10 17:02:42 -04:00
public@ccc02f653a Add move and rename_channel admin messages 2024-07-13 02:34:31 -04:00
src Implement chat banned words filter from a vague memory of a snippet 2024-07-13 14:10:20 -04:00
.env.template Fix dotenv template 2023-09-11 00:50:10 -04:00
.eslintrc.js Add ch ratelimit, readline commands, various debugging 2024-01-23 01:19:51 -05:00
.gitignore User flags 2023-09-07 18:21:21 -04:00
.gitmodules Fix stupid submodules 2024-07-09 12:11:58 -04:00
.prettierrc big boi 2023-03-31 10:43:24 -04:00
LICENSE Create LICENSE 2023-09-06 20:03:55 -04:00
README.md Update README.md 2024-07-13 06:01:13 -04:00
bun.lockb Fix joining problems 2024-07-09 02:20:46 -04:00
package.json Move readline to commands and add something like jinja 2024-01-26 03:56:15 -05:00
tsconfig.json Add channels and migrate to bun 2023-09-09 05:06:27 -04:00

README.md

MPP

mpp-server-dev2

This is an MPP server currently in development for MPP.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 instead.

List of features

  • Chat
    • Original chat filter by chacha and Brandon Lockaby
  • Piano Notes
    • Uses the same NoteQuota implementation from the client
  • Usernames/colors
    • Allowing color changing can be toggled in the config
  • Channels
    • Channel list
    • Channel settings
  • Rate limits
    • Borrowed from Brandon's GitHub Gist account
  • Brandon-style admin messages
    • Remote name changing
    • Color changing
    • User flag settings
      • Ability to change the volume of users' notes (affects note velocity)
      • Chat muting
      • Rate limit bypasses
    • Channel/User-targeted notifications
  • New admin messages
    • Restart message
      • Triggers notification on every connected socket, then shuts down after 20 seconds
      • Server must be setup as a pm2/docker/systemd process
    • Ability to change tags

TODO

  • Document src/ws/Socket.ts
  • Admin message eval
  • Add configuration options
    • Admin message eval toggle
  • Implement both UUID-based and JWT-based token auth
  • Fully implement and test tags
  • Test every frontend
  • Test fishing bot

Backlog/Notes

  • Use template engine instead of raw HTML?
    • Change frontend files at runtime?
    • Split script.js into multiple files
    • Implement tags as a server option, toggles code on frontend
      • Same with color changing
  • Bun memory usage can skyrocket
  • Reload config files on save
  • Expose API?

How to run

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.

  1. Install bun

    $ curl -fsSL https://bun.sh/install | bash
    
  2. Setup Git submodules

    $ git submodule update --init --recursive
    
  3. Configure

    • Copy environment variables
    $ cp .env.template .env
    

    Edit .env to your needs.

    • Edit the files in the config folder to match your needs
  4. Install packages

    $ bun i
    
  5. Setup database

    $ bunx prisma generate
    $ bunx prisma db push
    
  6. Run

    $ bun .