Coder Social home page Coder Social logo

revoltchat / backend Goto Github PK

View Code? Open in Web Editor NEW
1.1K 13.0 118.0 2.63 MB

Monorepo for Revolt backend services.

Home Page: https://developers.revolt.chat/api/

License: Other

Rust 95.06% Dockerfile 0.19% HTML 4.27% Shell 0.33% Just 0.05% Nix 0.10%
revolt rust api mongodb redis

backend's Introduction

Revolt Backend

This is a monorepo for the Revolt backend.

Crate Path Description
core/config crates/core/config Core: Configuration
core/database crates/core/database Core: Database Implementation
core/models crates/core/models Core: API Models
core/permissions crates/core/permissions Core: Permission Logic
core/presence crates/core/presence Core: User Presence
core/result crates/core/result Core: Result and Error types
delta crates/delta REST API server
bonfire crates/bonfire WebSocket events server

Note: january, autumn, and vortex are yet to be moved into this monorepo.

Minimum Supported Rust Version

Rust 1.70 or higher.

Development Guide

Before getting started, you'll want to install:

  • Rust toolchain (rustup recommended)
  • Docker
  • Git
  • mold (optional, faster compilation)

A default.nix is available for Nix users! Just run nix-shell and continue.

Now you can clone and build the project:

git clone https://github.com/revoltchat/backend revolt-backend
cd revolt-backend
cargo build

If you want to run the API and event servers:

# create environment file (will be deprecated in future)
cp .env.example .env

# (optionally) copy the default configuration file
cp crates/core/config/Revolt.toml Revolt.toml
# configure as necessary...

You may want to copy the following configuration:

# Revolt.toml
[database]
mongodb = "mongodb://localhost"
redis = "redis://localhost"

[hosts]
app = "http://local.revolt.chat"
api = "http://local.revolt.chat:8000"
events = "ws://local.revolt.chat:9000"
autumn = "http://local.revolt.chat:3000"
january = "http://local.revolt.chat:7000"
voso_legacy = ""
voso_legacy_ws = ""

Then continue:

# start other necessary services
docker compose up -d

# run the API server
cargo run --bin revolt-delta
# run the events server
cargo run --bin revolt-bonfire

# hint:
# mold -run <cargo build, cargo run, etc...>

You can start a web client by doing the following:

# if you do not have yarn yet and have a modern Node.js:
corepack enable

# clone the web client and run it:
git clone --recursive https://github.com/revoltchat/revite
cd revite
yarn
yarn build:deps
yarn dev --port 3001

Then go to https://local.revolt.chat:3001

Deployment Guide

Cutting new crate releases

Begin by bumping crate versions:

just patch # 0.0.X
just minor # 0.X.0
just major # X.0.0

Then commit the changes to package files.

Proceed to publish all the new crates:

just publish

Cutting new binary releases

Tag and push a new release by running:

just release

If you have bumped the crate versions, proceed to GitHub releases to create a changelog.

Testing

First, start the required services:

docker compose -f docker-compose.db.yml up -d

Now run tests for whichever database:

TEST_DB=REFERENCE cargo nextest run
TEST_DB=MONGOBD cargo nextest run

License

The Revolt backend is generally licensed under the GNU Affero General Public License v3.0.

Individual crates may supply their own licenses!

backend's People

Contributors

amycatgirl avatar arslee07 avatar fatalerrorcoded avatar goaaats avatar heikkari avatar insertish avatar jan0660 avatar mar0xy avatar rexogamer avatar rmeritz avatar ryanalexander avatar sneedcat avatar sussycatgirl avatar thebearingedge avatar thebobbobs avatar toastxc avatar web-flow avatar yannickfunk avatar zomatree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backend's Issues

Split the Manage Roles permission

The manage roles permission gives two different abilities to users, to assign and remove roles on other users and to create, edit and delete roles.
Having those two always come together is unnecessary and may cause issues in many situations.
That is why the permission would be best split into two.

Add "nsfw" flags to both channels and servers.

Currently this is handled by the client for channels by checking channel name.

The field should only be serialised if true, something like so:

#[skip_serializing_if = "it is false", default = "false"]
pub nsfw: boolean

Note: Prevent Web Push notifications being generated for nsfw channels, or otherwise add a server flag for this.

Server error when trying to access resource without auth headers

For example GET https://api.revolt.chat/users/relationships with no auth headers returns:

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<title>500 Internal Server Error</title>
</head>

<body align="center">
	<div role="main" align="center">
		<h1>500: Internal Server Error</h1>
		<p>The server encountered an internal error while processing this request.</p>
		<hr />
	</div>
	<div role="contentinfo" align="center">
		<small>Rocket</small>
	</div>
</body>

</html>

This isn't specific to the listed endpoint and is happening to more endpoints (e.g. /users/:user or /channels/:channel)

Use Redis as message broker.

Instead of using MongoDB to pass around events, instead use Redis's Pub/Sub.
If anyone has any alternatives to consider please list them below.

Channel Webhooks

Add a way to send messages into channels using an unauthenticated (does not require session token) HTTP request (secret key in path).

Bug: PATCH /users/id

Bug in Websocket, Useless packets

Updating the user status causes to:
screenshot
The above data from the websocket, UserUpdate

  • Note: I've changed the user stutus only two times!

Bot API

Specification is ready, now implementing.

Routes to implement:

  • Create Bot
  • Fetch Owned Bots
  • Fetch Bot
  • Edit Bot
  • Delete Bot
  • Fetch Public Bot
  • Invite Public Bot

Add @everyone pings.

Give users the ability to mention all users in a server.
This will also require a separate permission for sending it.

Voice channels can be set as system message channels in server settings

Summary

Inside the "System Message Channels" section of server settings, you can set voice channels as a system message channel. Voice channels do not have text chats for system messages so they should not be listed.

Steps to Reproduce

  1. Open the settings page for a server you have permissions to change settings of and that has at least 1 voice channel and text channel added to the server.
  2. Scroll to the bottom of the "Overview" page to the section "System Message Channels"
  3. Click on one of the drop-downs. Voice channels will be listed in them.

Potential Fixes

  • Only list text channels in the "System Message Channels" drop-downs. Filter out voice channels.
  • Add some form of system message support to voice channels that makes sense (Ex. text channels grouped with voice channels, voice notifications).

Screenshot

image

Unify server configuration in one place

Instead of relying on environment variables, configure Revolt nodes through the database.
We should also merge the file server configuration into the database and serve it to clients.

Generate Web Push notifications on server.

Instead of sending the Message packet to clients, we should generate the Notification object clients display instead.

Note: We also need to handle mentions in servers!

DMs open to non-friends option

Have an option in the setting for non-friends to open direct messages with you.
Some users might prefer to have clean friend lists while still talking with many users from their servers.
Possibly two levels, one for friends and people from your servers and another for anyone on the platform.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.