{"id":20518332,"url":"https://github.com/tricked-dev/dws","last_synced_at":"2025-03-05T23:42:35.592Z","repository":{"id":62823288,"uuid":"562078522","full_name":"Tricked-dev/dws","owner":"Tricked-dev","description":"The first fully opensource Skyblock mod backend lol.","archived":false,"fork":false,"pushed_at":"2022-11-20T10:41:33.000Z","size":175,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T10:17:17.688Z","etag":null,"topics":["axum","rust","websocket"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tricked-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-05T08:36:33.000Z","updated_at":"2023-06-03T22:08:03.000Z","dependencies_parsed_at":"2022-11-07T11:01:37.716Z","dependency_job_id":null,"html_url":"https://github.com/Tricked-dev/dws","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fdws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fdws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fdws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tricked-dev%2Fdws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tricked-dev","download_url":"https://codeload.github.com/Tricked-dev/dws/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242123200,"owners_count":20075344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axum","rust","websocket"],"created_at":"2024-11-15T21:40:10.455Z","updated_at":"2025-03-05T23:42:35.571Z","avatar_url":"https://github.com/Tricked-dev.png","language":"Rust","readme":"# DWS \u003c!-- omit in toc --\u003e\n\nThe first fully opensource Skyblock mod backend lol.\n\n- [Running](#running)\n- [Features](#features)\n- [Rest](#rest)\n  - [GET `/cosmetics`](#get-cosmetics)\n  - [POST `/broadcast`](#post-broadcast)\n  - [GET `/metrics`](#get-metrics)\n  - [GET `/users`](#get-users)\n  - [DELETE `/users?uuid=$uuid`](#delete-usersuuiduuid)\n  - [POST `/users`](#post-users)\n  - [GET `/cosmetics`](#get-cosmetics-1)\n  - [DELETE `/cosmetics?id=$id`](#delete-cosmeticsidid)\n  - [POST `/cosmetics`](#post-cosmetics)\n- [Websockets](#websockets)\n  - [Connecting](#connecting)\n  - [Requesting user status](#requesting-user-status)\n  - [Requesting user status bulk](#requesting-user-status-bulk)\n  - [Pings](#pings)\n  - [Update cosmetic](#update-cosmetic)\n  - [Cosmetic Ack event](#cosmetic-ack-event)\n  - [Irc](#irc)\n  - [Broadcasts](#broadcasts)\n  - [Errors](#errors)\n- [Cosmetics](#cosmetics)\n- [Dashboard](#dashboard)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Running\n\n```bash\nexport BROADCAST_SECRET=\"supersecretkey\"\nexport PORT=\"3000\"\nexport HOST=\"0.0.0.0\"\nexport DISCORD_PUBLIC_KEY=\nexport DISCORD_TOKEN=\nexport DISCORD_CLIENT_ID=\ncargo run --release\n```\n\n## Features\n\n- [x] Discord bot\n- [x] Cosmetics\n- [x] Checking if players are online\n- [x] Irc\n- [x] Prometheus metrics\n- [x] Discord linking\n- [x] Admin dashboard\n\n## Rest\n\n### GET `/cosmetics`\n\n```json\n{\n  \"cosmetics\": [\n    {\n      \"data\": \"\u0026a\",\n      \"description\": \"Prefix: invis_test1\",\n      \"id\": 0,\n      \"name\": \"invis_test1\",\n      \"required_flags\": 2,\n      \"type\": 1\n    },\n    {\n      \"data\": \"§e\",\n      \"description\": \"Prefix: supporter2\",\n      \"id\": 1,\n      \"name\": \"supporter2\",\n      \"required_flags\": 32,\n      \"type\": 1\n    },\n    {\n      \"data\": \"§b[l'élite]\",\n      \"description\": \"Prefix: invis_plexus3\",\n      \"id\": 2,\n      \"name\": \"invis_plexus3\",\n      \"required_flags\": 2,\n      \"type\": 2\n    }\n  ],\n  \"users\": { \"41a9b6aa-168a-4be8-8df8-cac17daf7384\": 1 }\n}\n```\n\n### POST `/broadcast`\n\n\u003e **info**\n\u003e this is a dashboard endpoint\n\n`to` requires a list of uuids or nothing to send to all users.\n\n```json\n{\n  \"message\": \"Hello world\",\n  \"to\": []\n}\n```\n\n---\n\n```\nOk\n```\n\n### GET `/metrics`\n\n\u003e **info**\n\u003e this is a dashboard endpoint\n\nReturns a bunch of prometheus metrics\n\n### GET `/users`\n\n\u003e **info**\n\u003e this is a dashboard endpoint\n\nReturns the list of connected and saved user\n\n### DELETE `/users?uuid=$uuid`\n\n\u003e **info**\n\u003e this is a dashboard endpoint\n\nDeletes a user from the database\n\n### POST `/users`\n\n\u003e **info**\n\u003e this is a dashboard endpoint\n\nCreate \u0026 Edit a user, payload: \u003chttps://github.com/dg-continuum/dws/blob/master/src/admin/users.rs#L13-L20\u003e\n\n### GET `/cosmetics`\n\n\u003e **info**\n\u003e this is a dashboard endpoint\n\nReturns the list of cosmetics\n\n### DELETE `/cosmetics?id=$id`\n\n\u003e **info**\n\u003e this is a dashboard endpoint\n\nDeletes a cosmetic from the database\n\n### POST `/cosmetics`\n\n\u003e **info**\n\u003e this is a dashboard endpoint\n\nCreates a cosmetic, payload: \u003chttps://github.com/dg-continuum/dws/blob/master/src/admin/cosmetics.rs#L11-L20\u003e\n\n## Websockets\n\nSee the insomnia example for more detailed info,\nNonces are a optional field\n\n### Connecting\n\n\u003c!-- TEST_MODE --\u003e\n\nfor development none of this validated. server_id is expected to be a hashed server id that is needed for \u003chttps://wiki.vg/Protocol_Encryption#Authentication\u003e\n\n```json\n{\n  \"t\": \"/connect\",\n  \"c\": {\n    \"server_id\": \"Hello world from irc ws lol\",\n    \"username\": \"trickedmc\"\n  }\n}\n```\n\n---\n\n```json\n{\n  \"t\": \"/connected\",\n  \"c\": true\n}\n```\n\n### Requesting user status\n\n\u003c!-- TEST_MODE --\u003e\n\n```json\n{\n  \"t\": \"/is_online\",\n  \"c\": { \"uuid\": \"41a9b6aa-168a-4be8-8df8-cac17daf6324\", \"nonce\": \"HI!\" }\n}\n```\n\n---\n\n```json\n{\n  \"t\": \"/is_online\",\n  \"c\": {\n    \"is_online\": true,\n    \"uuid\": \"41a9b6aa-168a-4be8-8df8-cac17daf6324\",\n    \"nonce\": \"HI!\"\n  }\n}\n```\n\n### Requesting user status bulk\n\n\u003c!-- TEST_MODE --\u003e\n\n```json\n{\n  \"t\": \"/is_online/bulk\",\n  \"c\": { \"uuids\": [\"41a9b6aa-168a-4be8-8df8-cac17daf6324\"], \"nonce\": \"HI!\" }\n}\n```\n\n---\n\n```json\n{\n  \"t\": \"/is_online/bulk\",\n  \"c\": {\n    \"users\": {\n      \"41a9b6aa-168a-4be8-8df8-cac17daf6324\": true\n    },\n    \"nonce\": \"HI!\"\n  }\n}\n```\n\n### Pings\n\n\u003c!-- TEST_MODE --\u003e\n\n```json\n{\n  \"t\": \"/ping\"\n}\n```\n\n---\n\n```json\n{\n  \"t\": \"/pong\"\n}\n```\n\n### Update cosmetic\n\n\u003c!-- TEST_MODE --\u003e\n\n```json\n{\n  \"t\": \"/cosmetics/update\",\n  \"c\": {\n    \"cosmetic_id\": 1,\n    \"nonce\": \"hi1\"\n  }\n}\n```\n\n---\n\n```json\n{\n  \"t\": \"/cosmetics/updated\",\n  \"c\": {\n    \"cosmetic_id\": 1,\n    \"nonce\": \"hi1\"\n  }\n}\n```\n\n### Cosmetic Ack event\n\nIt 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.\n\n---\n\n```json\n{\n  \"t\": \"/cosmetics/ack\"\n}\n```\n\n### Irc\n\n\u003c!-- TEST_MODE --\u003e\n\nThe irc chat can be linked to discord and you can blacklist uuids from the irc using `/irc blacklist Add \u003cuuid\u003e`, if a user is blacklisted irc messages send by this user will be silently ignored.\n\n```json\n{\n  \"t\": \"/irc/create\",\n  \"c\": {\n    \"message\": \"HI!\"\n  }\n}\n```\n\n---\n\n```json\n{\n  \"t\": \"/irc/created\",\n  \"c\": {\n    \"message\": \"HI!\",\n    \"sender\": \"41a9b6aa-168a-4be8-8df8-cac17daf7384\",\n    \"date\": 1668109163235\n  }\n}\n```\n\n### Broadcasts\n\nBroadcasts are only received not send you can view the broadcast post request to find out how those work\n\n---\n\n```json\n{\n  \"t\": \"/broadcast\",\n  \"c\": \"Hello world\"\n}\n```\n\n### Errors\n\nErrors are only recieved and look like this, errors can include a nonce for when necessary\n\n---\n\n```json\n{\n  \"t\": \"/error\",\n  \"c\": {\n    \"error\": \"Already connected\"\n  }\n}\n```\n\n## Cosmetics\n\nA cosmetics file looks something like this, The ran instance uses type 1 to identify colors and type 2 prefixes\n\n```json\n{\n  \"cosmetics\": [\n    {\n      \"data\": \"\u0026a\",\n      \"description\": \"Prefix: invis_test1\",\n      \"id\": 0,\n      \"name\": \"invis_test1\",\n      \"required_flags\": 2,\n      \"type\": 1\n    },\n    {\n      \"data\": \"§e\",\n      \"description\": \"Prefix: supporter2\",\n      \"id\": 1,\n      \"name\": \"supporter2\",\n      \"required_flags\": 32,\n      \"type\": 1\n    },\n    {\n      \"data\": \"§b[l'élite]\",\n      \"description\": \"Prefix: invis_plexus3\",\n      \"id\": 2,\n      \"name\": \"invis_plexus3\",\n      \"required_flags\": 2,\n      \"type\": 2\n    }\n  ],\n  \"users\": {\n    \"a1937b73-ecff-4d6c-aa7b-6702b957dbd6\": {\n      \"flags\": 8,\n      \"enabled_prefix\": 8\n    },\n    \"4e29caf5-9317-454b-8863-eca22877e0ec\": {\n      \"flags\": 8,\n      \"enabled_prefix\": 12\n    }\n  }\n}\n```\n\n## Dashboard\n\nDWS 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.\nThe dashboard also exposes 4 api endpoints for creating/modifying users, deleting them, and adding cosmetics and deleting those.\n\n![image](https://user-images.githubusercontent.com/72335827/202806169-e0c40c2a-ed1b-4798-94b0-963fcc742fef.png)\n\n## Contributing\n\nPull 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](https://deno.land/), The tool automatically picks up the requests from the README file.\n\n## License\n\nWe use the Mozilla Public License 2.0. MPL tries to find a balance between permissive (MIT, Apache, Zlib) and copyleft licenses (GPL, LGPL). \u003csup\u003e\u003csup\u003e[MORE INFO](https://www.mozilla.org/en-US/MPL/2.0/FAQ/)\u003c/sup\u003e\u003c/sup\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftricked-dev%2Fdws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftricked-dev%2Fdws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftricked-dev%2Fdws/lists"}