The first fully opensource Skyblock mod backend lol.

Related tags

Miscellaneous dws
Overview

DWS

The first fully opensource Skyblock mod backend lol.

Running

export BROADCAST_SECRET="supersecretkey"
export PORT="3000"
export HOST="0.0.0.0"
export DISCORD_PUBLIC_KEY=
export DISCORD_TOKEN=
export DISCORD_CLIENT_ID=
cargo run --release

Features

  • Discord bot
  • Cosmetics
  • Checking if players are online
  • Irc
  • Prometheus metrics
  • Discord linking
  • Admin dashboard

Rest

GET /cosmetics

{
  "cosmetics": [
    {
      "data": "&a",
      "description": "Prefix: invis_test1",
      "id": 0,
      "name": "invis_test1",
      "required_flags": 2,
      "type": 1
    },
    {
      "data": "§e",
      "description": "Prefix: supporter2",
      "id": 1,
      "name": "supporter2",
      "required_flags": 32,
      "type": 1
    },
    {
      "data": "§b[l'élite]",
      "description": "Prefix: invis_plexus3",
      "id": 2,
      "name": "invis_plexus3",
      "required_flags": 2,
      "type": 2
    }
  ],
  "users": { "41a9b6aa-168a-4be8-8df8-cac17daf7384": 1 }
}

POST /broadcast

info this is a dashboard endpoint

to requires a list of uuids or nothing to send to all users.

{
  "message": "Hello world",
  "to": []
}

Ok

GET /metrics

info this is a dashboard endpoint

Returns a bunch of prometheus metrics

GET /users

info this is a dashboard endpoint

Returns the list of connected and saved user

DELETE /users?uuid=$uuid

info this is a dashboard endpoint

Deletes a user from the database

POST /users

info this is a dashboard endpoint

Create & Edit a user, payload: https://github.com/dg-continuum/dws/blob/master/src/admin/users.rs#L13-L20

GET /cosmetics

info this is a dashboard endpoint

Returns the list of cosmetics

DELETE /cosmetics?id=$id

info this is a dashboard endpoint

Deletes a cosmetic from the database

POST /cosmetics

info this is a dashboard endpoint

Creates a cosmetic, payload: https://github.com/dg-continuum/dws/blob/master/src/admin/cosmetics.rs#L11-L20

Websockets

See the insomnia example for more detailed info, Nonces are a optional field

Connecting

for development none of this validated. server_id is expected to be a hashed server id that is needed for https://wiki.vg/Protocol_Encryption#Authentication

{
  "t": "/connect",
  "c": {
    "server_id": "Hello world from irc ws lol",
    "username": "trickedmc"
  }
}

{
  "t": "/connected",
  "c": true
}

Requesting user status

{
  "t": "/is_online",
  "c": { "uuid": "41a9b6aa-168a-4be8-8df8-cac17daf6324", "nonce": "HI!" }
}

{
  "t": "/is_online",
  "c": {
    "is_online": true,
    "uuid": "41a9b6aa-168a-4be8-8df8-cac17daf6324",
    "nonce": "HI!"
  }
}

Requesting user status bulk

{
  "t": "/is_online/bulk",
  "c": { "uuids": ["41a9b6aa-168a-4be8-8df8-cac17daf6324"], "nonce": "HI!" }
}

{
  "t": "/is_online/bulk",
  "c": {
    "users": {
      "41a9b6aa-168a-4be8-8df8-cac17daf6324": true
    },
    "nonce": "HI!"
  }
}

Pings

{
  "t": "/ping"
}

{
  "t": "/pong"
}

Update cosmetic

{
  "t": "/cosmetics/update",
  "c": {
    "cosmetic_id": 1,
    "nonce": "hi1"
  }
}

{
  "t": "/cosmetics/updated",
  "c": {
    "cosmetic_id": 1,
    "nonce": "hi1"
  }
}

Cosmetic Ack event

It is suggested to update cosmetics between 1-5 minutes after this event is received to account for any other updates and to not trigger ddos protection.


{
  "t": "/cosmetics/ack"
}

Irc

The irc chat can be linked to discord and you can blacklist uuids from the irc using /irc blacklist Add <uuid>, if a user is blacklisted irc messages send by this user will be silently ignored.

{
  "t": "/irc/create",
  "c": {
    "message": "HI!"
  }
}

{
  "t": "/irc/created",
  "c": {
    "message": "HI!",
    "sender": "41a9b6aa-168a-4be8-8df8-cac17daf7384",
    "date": 1668109163235
  }
}

Broadcasts

Broadcasts are only received not send you can view the broadcast post request to find out how those work


{
  "t": "/broadcast",
  "c": "Hello world"
}

Errors

Errors are only recieved and look like this, errors can include a nonce for when necessary


{
  "t": "/error",
  "c": {
    "error": "Already connected"
  }
}

Cosmetics

A cosmetics file looks something like this, The ran instance uses type 1 to identify colors and type 2 prefixes

{
  "cosmetics": [
    {
      "data": "&a",
      "description": "Prefix: invis_test1",
      "id": 0,
      "name": "invis_test1",
      "required_flags": 2,
      "type": 1
    },
    {
      "data": "§e",
      "description": "Prefix: supporter2",
      "id": 1,
      "name": "supporter2",
      "required_flags": 32,
      "type": 1
    },
    {
      "data": "§b[l'élite]",
      "description": "Prefix: invis_plexus3",
      "id": 2,
      "name": "invis_plexus3",
      "required_flags": 2,
      "type": 2
    }
  ],
  "users": {
    "a1937b73-ecff-4d6c-aa7b-6702b957dbd6": {
      "flags": 8,
      "enabled_prefix": 8
    },
    "4e29caf5-9317-454b-8863-eca22877e0ec": {
      "flags": 8,
      "enabled_prefix": 12
    }
  }
}

Dashboard

DWS has a simple dashboard that is enabled by default and on the next port the websocket/api is running this dashboard can be disabled by setting the ADMIN_DASH var to false, It is not secured you are supposed to secure it with nginx or cloudflare zero trust. The dashboard also exposes 4 api endpoints for creating/modifying users, deleting them, and adding cosmetics and deleting those.

image

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. To test out the websocket server you can use either insomnia or the provided test.ts tool with Deno, The tool automatically picks up the requests from the README file.

License

We use the Mozilla Public License 2.0. MPL tries to find a balance between permissive (MIT, Apache, Zlib) and copyleft licenses (GPL, LGPL). MORE INFO

You might also like...
A boilerplate++ for a minimal rust web backend

Boiler room A boilerplate++ for a minimal rust web backend Just fork/clone/download this repo and build your backend on it. Why? Both routing and erro

A complete, rate-limiting, asynchronous Rust wrapper of the Hypixel Public API with extensive SkyBlock support

rs-pixel   A complete, rate-limiting, asynchronous Rust implementation of the Hypixel Public API with extensive SkyBlock support. [dependencies] rs-pi

Opensource diagnostic software for Daimler vehicles, inspired by Xentry and DAS, written in Rust

OPENSTAR An opensource diagnostic application for Daimler vehicles inspired by DAS and Xentry. Some of the work here is based on OpenVehicleDiag If yo

Download Apple's open source code from opensource.apple.com

Apple Open Source Downloader This repository defines a Rust crate and CLI program to automate the downloading of Apple's open source code from https:/

TIF is a terminal_image_format. (theres no TIF editor, so i made TIF images through a hex editor lol)

Colors these are the colors you can use when displaying images on the terminal BYTES: 5A = BLUE 5B = BLACK 5C = RED 5D = GREEN 5E = PURPLE 5F = WHITE

quiz app? i dunno lol

quiz it's all kinda shoddy right now but, assuming sqlx cli is installed, and npm on lts or something recent-ish cd api docker-compose up -d sqlx data

A render-backend independant egui backend for sdl2

A Sdl2 + Egui Backend An egui backend for sdl2 unbound to any renderer-backend. You can include it like so: [dependencies] egui_sdl2_platform = "0.1.0

A fully asynchronous, futures-based Kafka client library for Rust based on librdkafka

rust-rdkafka A fully asynchronous, futures-enabled Apache Kafka client library for Rust based on librdkafka. The library rust-rdkafka provides a safe

Fully async-await http server framework

Saphir is a fully async-await http server framework for rust The goal is to give low-level control to your web stack (as hyper does) without the time

An open-source and fully-featured Digital Audio Workstation, made by musicians, for musicians
An open-source and fully-featured Digital Audio Workstation, made by musicians, for musicians

Meadowlark An open-source and fully-featured Digital Audio Workstation, made by musicians, for musicians. *Current design mockup, not a functioning pr

Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

An implementation of the Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

A fully-featured lexer generator, implement as a proc macro

lexgen: A fully-featured lexer generator, implemented as a proc macro lexer! { // First line specifies name of the lexer and the token type return

An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous and blocking clients respectively.

eithers_rust An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous a

A simple implementation of Conway's Game of Life using Fully homomorphic Encryption

Game of life using Fully homomorphic encryption A simple implementation of Conway's Game of Life built using Zama's concrete-boolean library. Build Ju

Blackmarlin is a chess engine fully written in Rust.

Blackmarlin WIP UCI Chess Engine Blackmarlin is a chess engine fully written in Rust. Make sure to compile the chess engine with cargo build --release

Ecosystem of libraries and tools for writing and executing extremely fast GPU code fully in Rust.

Ecosystem of libraries and tools for writing and executing extremely fast GPU code fully in Rust.

Ratchet is a fast, robust, lightweight and fully asynchronous implementation of RFC6455 (The WebSocket protocol).

Ratchet 🚧 Ratchet is a fast, robust, lightweight and fully asynchronous implementation of RFC6455 (The WebSocket protocol). Complete with an optional

Ecosystem of libraries and tools for writing and executing fast GPU code fully in Rust.

The Rust CUDA Project An ecosystem of libraries and tools for writing and executing extremely fast GPU code fully in Rust Guide | Getting Started | Fe

A fully p2p cli chat utility written in rust.

P2P Chat Client This is a simple demonstration of a peer to peer chat client, written entirely in rust utilising the libp2p library. Demo On two seper

Owner
null
Download Apple's open source code from opensource.apple.com

Apple Open Source Downloader This repository defines a Rust crate and CLI program to automate the downloading of Apple's open source code from https:/

Gregory Szorc 6 Aug 19, 2022
A simple, fast and fully-typed JSPaste API wrapper for Rust

rspaste A simple, fast and fully-typed JSPaste API wrapper for Rust. aidak.tk » Installation Put the desired version of the crate into the dependencie

Aidak 2 May 17, 2022
A Garry's Mod module that lets you check which fonts are available on the system

gm_fontsx Since apparently we're never getting a proper way to check for installed fonts on Garry's Mod, this has to exist ?? Usage require("fontsx")

Earu 4 Mar 14, 2022
Shows only the first page of rustc output

cargo-first-page Shows only the first page of rustc output. Installation cargo install cargo-firstpage Usage Prefix the cargo command by firstpage: T

Cecile Tonglet 11 Dec 19, 2021
Try to find the correct word with only first letter and unknown letter count

Try to find the correct word with only first letter and unknown letter count

Alexandre 6 Apr 11, 2022
First Git on Rust is reimplementation with rust in order to learn about rust, c and git.

First Git on Rust First Git on Rust is reimplementation with rust in order to learn about rust, c and git. Reference project This project refer to the

Nobkz 1 Jan 28, 2022
unFlow is a Design as Code implementation, a DSL for UX & backend modeling. DSL to Sketch file, Sketch to DSL, DSL to code.

unflow 是一个低代码、无代码设计语言。unFlow is a Design as Code implementation, a DSL for UX & backend modeling. DSL to Sketch file, Sketch to DSL, DSL to code.

Inherd OS Team (硬核开源小组) 69 Sep 6, 2022
The 峨眉 (EMei) JIT/AOT backend framework.

emei The 峨眉 (EMei) JIT/AOT backend framework. Support Instructions x86_64 mov mov mov_zero_extend_bit8/16 mov_sign_extend_bit8/16/32 mov_rev movs(is m

Lyzh 14 Apr 11, 2022
A backend API starter with Rust & postgres

Rust backend starter Rust backend starter with OpenAPI spec & swagger with rocket_okapi

Ilkka Poutanen 3 Feb 1, 2022
A Litecord compatible/inspired OSS implementation of Discord's backend for fun and profit.

A Litecord compatible/inspired OSS implementation of Discord's backend for fun and profit.

Evie Viau 3 May 9, 2022