Compare commits
15
Commits
v0.11.2
...
fix/hosepipe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
805f2c4528 | ||
|
|
5a6155fdb6 | ||
|
|
c5844b6281 | ||
|
|
24d0d2b726 | ||
|
|
f777e2863c | ||
|
|
a80ad1cbe5 | ||
|
|
0b522ebddc | ||
|
|
6bd045eb79 | ||
|
|
0698e115e8 | ||
|
|
8e3765df4c | ||
|
|
1c98ead695 | ||
|
|
8849d03cd2 | ||
|
|
a75e4eabfc | ||
|
|
74f0c537e6 | ||
|
|
1f8ea963ad |
@@ -0,0 +1,147 @@
|
|||||||
|
name: Bug Report
|
||||||
|
description: Report a bug in Stoat — please fill out every required field to help us triage quickly.
|
||||||
|
title: "[Bug]: "
|
||||||
|
labels:
|
||||||
|
- bug
|
||||||
|
- unconfirmed
|
||||||
|
|
||||||
|
body:
|
||||||
|
# ── Thank you section ────────────────────────────────────────────────────────
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
**Thank you for taking the time to report a bug for Stoat!**
|
||||||
|
|
||||||
|
Please follow the instructions below and provide as much detail as possible to help us understand and reproduce the issue.
|
||||||
|
|
||||||
|
# ── Pre-flight checks ────────────────────────────────────────────────────────
|
||||||
|
- type: checkboxes
|
||||||
|
id: preflight
|
||||||
|
attributes:
|
||||||
|
label: Pre-flight checklist
|
||||||
|
description: Please confirm all of the following before submitting.
|
||||||
|
options:
|
||||||
|
- label: I am on the latest available version of Stoat.
|
||||||
|
required: true
|
||||||
|
- label: I searched existing issues and did not find a duplicate.
|
||||||
|
required: true
|
||||||
|
- label: This is a bug report, not a support question or feature request.
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# ── Bug description ──────────────────────────────────────────────────────────
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Bug description
|
||||||
|
description: >
|
||||||
|
What happened? What did you expect to happen instead?
|
||||||
|
Keep this brief — detailed steps go in the next field.
|
||||||
|
placeholder: "Example: When I open a DM thread, new messages from the other person do not appear unless I reload the page."
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# ── Steps to reproduce ───────────────────────────────────────────────────────
|
||||||
|
- type: textarea
|
||||||
|
id: steps
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
description: >
|
||||||
|
Provide a numbered list of every step needed to trigger the bug.
|
||||||
|
The clearer this is, the faster we can fix it.
|
||||||
|
placeholder: |
|
||||||
|
1. Log in to Stoat on the web client.
|
||||||
|
2. Open a direct message conversation.
|
||||||
|
3. Ask the other person to send a message.
|
||||||
|
4. Observe that the message does not appear without reloading.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# ── Expected behavior ────────────────────────────────────────────────────────
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: Expected behavior
|
||||||
|
description: What should have happened?
|
||||||
|
placeholder: "New messages should appear in real time without a page reload."
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# ── Client / platform ────────────────────────────────────────────────────────
|
||||||
|
- type: dropdown
|
||||||
|
id: platform
|
||||||
|
attributes:
|
||||||
|
label: Client / platform
|
||||||
|
description: Which Stoat client are you using?
|
||||||
|
options:
|
||||||
|
- Web (browser)
|
||||||
|
- Stoat for Desktop
|
||||||
|
- Android
|
||||||
|
- iOS
|
||||||
|
- Self-hosted server
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# ── Client version ───────────────────────────────────────────────────────────
|
||||||
|
- type: input
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: Client version
|
||||||
|
description: >
|
||||||
|
Find this in **Settings**. For the web client, include the build
|
||||||
|
number shown in the footer or About page.
|
||||||
|
placeholder: "e.g. Stoat for Desktop 1.3.0 or 0.2.1 (2025-10-10)"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# ── OS / browser details ─────────────────────────────────────────────────────
|
||||||
|
- type: input
|
||||||
|
id: os
|
||||||
|
attributes:
|
||||||
|
label: OS / browser details
|
||||||
|
description: Your operating system and, for web bugs, your browser and its version.
|
||||||
|
placeholder: "e.g. Windows 11, Chrome 121 or macOS 14.3, Stoat for Desktop 1.3.0 or Android 14"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# ── Reproducibility ──────────────────────────────────────────────────────────
|
||||||
|
- type: dropdown
|
||||||
|
id: reproducibility
|
||||||
|
attributes:
|
||||||
|
label: Reproducibility
|
||||||
|
description: How consistently does this bug occur?
|
||||||
|
options:
|
||||||
|
- Always
|
||||||
|
- Usually
|
||||||
|
- Rarely
|
||||||
|
- Only once
|
||||||
|
- Unknown
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
# ── Screenshots or video ─────────────────────────────────────────────────────
|
||||||
|
- type: textarea
|
||||||
|
id: screenshots
|
||||||
|
attributes:
|
||||||
|
label: Screenshots or video
|
||||||
|
description: Paste images or drag-and-drop a screen recording here. GitHub accepts common image and video formats.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
# ── Additional context ───────────────────────────────────────────────────────
|
||||||
|
- type: textarea
|
||||||
|
id: additional
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: >
|
||||||
|
Anything else that might help: workarounds you found, links to related issues,
|
||||||
|
self-hosted configuration details (Redis, MongoDB, LiveKit, SMTP), network environment, etc.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
# ── Closing note ─────────────────────────────────────────────────────────────
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
---
|
||||||
|
A maintainer will review your report. Please watch for follow-up questions — issues
|
||||||
|
that go unanswered are harder to resolve and may be closed after 30 days of inactivity.
|
||||||
@@ -20,4 +20,4 @@ jobs:
|
|||||||
RELEASE_URL="https://github.com/${REPOSITORY}/releases/tag/${TAG_NAME}"
|
RELEASE_URL="https://github.com/${REPOSITORY}/releases/tag/${TAG_NAME}"
|
||||||
curl -X POST "$WEBHOOK_URL" \
|
curl -X POST "$WEBHOOK_URL" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"content\": \"$RELEASE_URL\"}"
|
-d "{\"content\": \"$RELEASE_URL\"}"
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
".": "0.11.2"
|
".": "0.11.5"
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,26 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.11.5](https://github.com/stoatchat/stoatchat/compare/v0.11.4...v0.11.5) (2026-02-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Reverts
|
||||||
|
|
||||||
|
* disable user update events ([#593](https://github.com/stoatchat/stoatchat/issues/593)) ([1c98ead](https://github.com/stoatchat/stoatchat/commit/1c98ead69579b4700be0b51c9020bb8402336cc6))
|
||||||
|
|
||||||
|
## [0.11.4](https://github.com/stoatchat/stoatchat/compare/v0.11.3...v0.11.4) (2026-02-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add separate config option for redis events replica url ([#590](https://github.com/stoatchat/stoatchat/issues/590)) ([a75e4ea](https://github.com/stoatchat/stoatchat/commit/a75e4eabfc4b34aba7620c82ba77558a32d9e10a))
|
||||||
|
|
||||||
|
## [0.11.3](https://github.com/stoatchat/stoatchat/compare/v0.11.2...v0.11.3) (2026-02-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* cut presence traffic too while we engineer a new events architecture ([#561](https://github.com/stoatchat/stoatchat/issues/561)) ([1f8ea96](https://github.com/stoatchat/stoatchat/commit/1f8ea963ad742f693f405e6438f1c343c81e6579))
|
||||||
|
|
||||||
## [0.11.2](https://github.com/stoatchat/stoatchat/compare/v0.11.1...v0.11.2) (2026-02-13)
|
## [0.11.2](https://github.com/stoatchat/stoatchat/compare/v0.11.1...v0.11.2) (2026-02-13)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Generated
+20
-18
@@ -6798,7 +6798,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-autumn"
|
name = "revolt-autumn"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-macros",
|
"axum-macros",
|
||||||
@@ -6836,10 +6836,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-bonfire"
|
name = "revolt-bonfire"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"amqprs",
|
||||||
"async-channel 2.5.0",
|
"async-channel 2.5.0",
|
||||||
"async-std",
|
"async-std",
|
||||||
|
"async-trait",
|
||||||
"async-tungstenite",
|
"async-tungstenite",
|
||||||
"authifier",
|
"authifier",
|
||||||
"bincode",
|
"bincode",
|
||||||
@@ -6867,7 +6869,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-coalesced"
|
name = "revolt-coalesced"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.13.0",
|
"indexmap 2.13.0",
|
||||||
"lru 0.16.3",
|
"lru 0.16.3",
|
||||||
@@ -6876,7 +6878,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-config"
|
name = "revolt-config"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"cached",
|
"cached",
|
||||||
@@ -6893,7 +6895,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-crond"
|
name = "revolt-crond"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"revolt-config",
|
"revolt-config",
|
||||||
@@ -6905,7 +6907,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-database"
|
name = "revolt-database"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"amqprs",
|
"amqprs",
|
||||||
"async-lock 2.8.0",
|
"async-lock 2.8.0",
|
||||||
@@ -6955,7 +6957,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-delta"
|
name = "revolt-delta"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"amqprs",
|
"amqprs",
|
||||||
"async-channel 1.9.0",
|
"async-channel 1.9.0",
|
||||||
@@ -7005,7 +7007,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-files"
|
name = "revolt-files"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -7033,7 +7035,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-gifbox"
|
name = "revolt-gifbox"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-extra",
|
"axum-extra",
|
||||||
@@ -7056,7 +7058,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-january"
|
name = "revolt-january"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-recursion",
|
"async-recursion",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -7084,7 +7086,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-models"
|
name = "revolt-models"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 1.9.3",
|
"indexmap 1.9.3",
|
||||||
"iso8601-timestamp",
|
"iso8601-timestamp",
|
||||||
@@ -7103,14 +7105,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-parser"
|
name = "revolt-parser"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"logos",
|
"logos",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-permissions"
|
name = "revolt-permissions"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -7125,7 +7127,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-presence"
|
name = "revolt-presence"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"log",
|
"log",
|
||||||
@@ -7137,7 +7139,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-pushd"
|
name = "revolt-pushd"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"amqprs",
|
"amqprs",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -7165,7 +7167,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-ratelimits"
|
name = "revolt-ratelimits"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"authifier",
|
"authifier",
|
||||||
@@ -7182,7 +7184,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-result"
|
name = "revolt-result"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"log",
|
"log",
|
||||||
@@ -7198,7 +7200,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "revolt-voice-ingress"
|
name = "revolt-voice-ingress"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"amqprs",
|
"amqprs",
|
||||||
"async-std",
|
"async-std",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-bonfire"
|
name = "revolt-bonfire"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
@@ -36,6 +36,7 @@ async-std = { version = "1.8.0", features = [
|
|||||||
"tokio02",
|
"tokio02",
|
||||||
"attributes",
|
"attributes",
|
||||||
] }
|
] }
|
||||||
|
async-trait = "0.1.89"
|
||||||
|
|
||||||
# core
|
# core
|
||||||
authifier = { version = "1.0.16" }
|
authifier = { version = "1.0.16" }
|
||||||
@@ -48,3 +49,6 @@ revolt-presence = { path = "../core/presence", features = ["redis-is-patched"] }
|
|||||||
|
|
||||||
# redis
|
# redis
|
||||||
fred = { version = "8.0.1", features = ["subscriber-client"] }
|
fred = { version = "8.0.1", features = ["subscriber-client"] }
|
||||||
|
|
||||||
|
# Redis
|
||||||
|
amqprs = { version = "1.7.0" }
|
||||||
@@ -169,7 +169,9 @@ impl State {
|
|||||||
}) {
|
}) {
|
||||||
if let Ok(Some(voice_state)) = get_channel_voice_state(channel).await {
|
if let Ok(Some(voice_state)) = get_channel_voice_state(channel).await {
|
||||||
if let Some(server) = channel.server() {
|
if let Some(server) = channel.server() {
|
||||||
let set = voice_state_server_members.entry(server.to_string()).or_default();
|
let set = voice_state_server_members
|
||||||
|
.entry(server.to_string())
|
||||||
|
.or_default();
|
||||||
|
|
||||||
for participant in &voice_state.participants {
|
for participant in &voice_state.participants {
|
||||||
user_ids.insert(participant.id.clone());
|
user_ids.insert(participant.id.clone());
|
||||||
@@ -396,28 +398,29 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Push presence change to the user and all associated server topics
|
/// Push presence change to the user and all associated server topics
|
||||||
pub async fn broadcast_presence_change(&self, target: bool) {
|
pub async fn broadcast_presence_change(&self, _target: bool) {
|
||||||
if if let Some(status) = &self.cache.users.get(&self.cache.user_id).unwrap().status {
|
// disabled events
|
||||||
status.presence != Some(Presence::Invisible)
|
// if if let Some(status) = &self.cache.users.get(&self.cache.user_id).unwrap().status {
|
||||||
} else {
|
// status.presence != Some(Presence::Invisible)
|
||||||
true
|
// } else {
|
||||||
} {
|
// true
|
||||||
let event = EventV1::UserUpdate {
|
// } {
|
||||||
id: self.cache.user_id.clone(),
|
// let event = EventV1::UserUpdate {
|
||||||
data: v0::PartialUser {
|
// id: self.cache.user_id.clone(),
|
||||||
online: Some(target),
|
// data: v0::PartialUser {
|
||||||
..Default::default()
|
// online: Some(target),
|
||||||
},
|
// ..Default::default()
|
||||||
clear: vec![],
|
// },
|
||||||
event_id: Some(ulid::Ulid::new().to_string()),
|
// clear: vec![],
|
||||||
};
|
// event_id: Some(ulid::Ulid::new().to_string()),
|
||||||
|
// };
|
||||||
|
|
||||||
for server in self.cache.servers.keys() {
|
// for server in self.cache.servers.keys() {
|
||||||
event.clone().p(server.clone()).await;
|
// event.clone().p(server.clone()).await;
|
||||||
}
|
// }
|
||||||
|
|
||||||
event.p(self.cache.user_id.clone()).await;
|
// event.p(self.cache.user_id.clone()).await;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle an incoming event for protocol version 1
|
/// Handle an incoming event for protocol version 1
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
|
use amqprs::{
|
||||||
|
channel::{
|
||||||
|
BasicConsumeArguments, Channel, ExchangeDeclareArguments, QueueBindArguments,
|
||||||
|
QueueDeclareArguments,
|
||||||
|
},
|
||||||
|
connection::{Connection, OpenConnectionArguments},
|
||||||
|
consumer::AsyncConsumer,
|
||||||
|
BasicProperties, Deliver,
|
||||||
|
};
|
||||||
use async_std::net::TcpListener;
|
use async_std::net::TcpListener;
|
||||||
|
use async_trait::async_trait;
|
||||||
|
use redis_kiss::AsyncCommands;
|
||||||
|
use revolt_database::util::rabbit::set_rabbitmq_connection;
|
||||||
use revolt_presence::clear_region;
|
use revolt_presence::clear_region;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
@@ -31,6 +43,55 @@ async fn main() {
|
|||||||
let try_socket = TcpListener::bind(bind).await;
|
let try_socket = TcpListener::bind(bind).await;
|
||||||
let listener = try_socket.expect("Failed to bind");
|
let listener = try_socket.expect("Failed to bind");
|
||||||
|
|
||||||
|
let config = revolt_config::config().await;
|
||||||
|
|
||||||
|
let rmq_conn = Connection::open(&OpenConnectionArguments::new(
|
||||||
|
&config.rabbit.host,
|
||||||
|
config.rabbit.port,
|
||||||
|
&config.rabbit.username,
|
||||||
|
&config.rabbit.password,
|
||||||
|
))
|
||||||
|
.await
|
||||||
|
.expect("Failed to connect to RabbitMQ");
|
||||||
|
|
||||||
|
set_rabbitmq_connection(rmq_conn.clone());
|
||||||
|
|
||||||
|
if std::env::var("ENABLE_RABBITMQ_INGRESS").as_deref().is_ok_and(|v| v == "1") {
|
||||||
|
let channel = rmq_conn
|
||||||
|
.open_channel(None)
|
||||||
|
.await
|
||||||
|
.expect("Failed to open RabbitMQ channel.");
|
||||||
|
|
||||||
|
channel
|
||||||
|
.exchange_declare(
|
||||||
|
ExchangeDeclareArguments::new("events", "fanout")
|
||||||
|
.durable(true)
|
||||||
|
.finish(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.expect("Failed to declare exchange");
|
||||||
|
|
||||||
|
channel
|
||||||
|
.queue_declare(QueueDeclareArguments::new("events").durable(true).finish())
|
||||||
|
.await
|
||||||
|
.expect("Failed to declare queue");
|
||||||
|
|
||||||
|
channel
|
||||||
|
.queue_bind(QueueBindArguments::new("events", "events", "events"))
|
||||||
|
.await
|
||||||
|
.expect("Failed to bind queue");
|
||||||
|
|
||||||
|
channel
|
||||||
|
.basic_consume(
|
||||||
|
RabbitToRedisConsumer,
|
||||||
|
BasicConsumeArguments::new("events", "")
|
||||||
|
.manual_ack(false)
|
||||||
|
.finish(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.expect("Failed to consume channel");
|
||||||
|
}
|
||||||
|
|
||||||
// Start accepting new connections and spawn a client for each connection.
|
// Start accepting new connections and spawn a client for each connection.
|
||||||
while let Ok((stream, addr)) = listener.accept().await {
|
while let Ok((stream, addr)) = listener.accept().await {
|
||||||
async_std::task::spawn(async move {
|
async_std::task::spawn(async move {
|
||||||
@@ -40,3 +101,32 @@ async fn main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct RabbitToRedisConsumer;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl AsyncConsumer for RabbitToRedisConsumer {
|
||||||
|
async fn consume(
|
||||||
|
&mut self,
|
||||||
|
_channel: &Channel,
|
||||||
|
_deliver: Deliver,
|
||||||
|
basic_properties: BasicProperties,
|
||||||
|
content: Vec<u8>,
|
||||||
|
) {
|
||||||
|
let mut redis_conn = redis_kiss::get_connection()
|
||||||
|
.await
|
||||||
|
.expect("Failed to connect to Redis.");
|
||||||
|
|
||||||
|
let pubsub_channel = basic_properties
|
||||||
|
.headers()
|
||||||
|
.expect("No headers")
|
||||||
|
.get(&"c".try_into().unwrap())
|
||||||
|
.expect("No channel header")
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
redis_conn
|
||||||
|
.publish(pubsub_channel, content)
|
||||||
|
.await
|
||||||
|
.expect("failed to publish")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -218,7 +218,13 @@ async fn listener(
|
|||||||
kill_signal_r: async_channel::Receiver<()>,
|
kill_signal_r: async_channel::Receiver<()>,
|
||||||
write: &Mutex<WsWriter>,
|
write: &Mutex<WsWriter>,
|
||||||
) {
|
) {
|
||||||
let redis_config = RedisConfig::from_url(&REDIS_URI).unwrap();
|
let stoat_config = revolt_config::config().await;
|
||||||
|
let url = stoat_config
|
||||||
|
.database
|
||||||
|
.redis_pubsub
|
||||||
|
.unwrap_or(REDIS_URI.to_string());
|
||||||
|
|
||||||
|
let redis_config = RedisConfig::from_url(&url).unwrap();
|
||||||
let subscriber = match report_internal_error!(
|
let subscriber = match report_internal_error!(
|
||||||
fred::types::Builder::from_config(redis_config).build_subscriber_client()
|
fred::types::Builder::from_config(redis_config).build_subscriber_client()
|
||||||
) {
|
) {
|
||||||
@@ -457,8 +463,31 @@ async fn worker(
|
|||||||
};
|
};
|
||||||
|
|
||||||
match payload {
|
match payload {
|
||||||
ClientMessage::BeginTyping { .. } => {}
|
// disabled events
|
||||||
ClientMessage::EndTyping { .. } => {}
|
ClientMessage::BeginTyping { channel } => {
|
||||||
|
if !subscribed.read().await.contains(&channel) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventV1::ChannelStartTyping {
|
||||||
|
id: channel.clone(),
|
||||||
|
user: user_id.clone(),
|
||||||
|
}
|
||||||
|
.p(channel.clone())
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
ClientMessage::EndTyping { channel } => {
|
||||||
|
if !subscribed.read().await.contains(&channel) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventV1::ChannelStopTyping {
|
||||||
|
id: channel.clone(),
|
||||||
|
user: user_id.clone(),
|
||||||
|
}
|
||||||
|
.p(channel.clone())
|
||||||
|
.await;
|
||||||
|
}
|
||||||
ClientMessage::Subscribe { server_id } => {
|
ClientMessage::Subscribe { server_id } => {
|
||||||
let mut servers = active_servers.lock().await;
|
let mut servers = active_servers.lock().await;
|
||||||
let has_item = servers.contains_key(&server_id);
|
let has_item = servers.contains_key(&server_id);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-coalesced"
|
name = "revolt-coalesced"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Paul Makles <me@insrt.uk>", "Zomatree <me@zomatree.live>"]
|
authors = ["Paul Makles <me@insrt.uk>", "Zomatree <me@zomatree.live>"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-config"
|
name = "revolt-config"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Paul Makles <me@insrt.uk>"]
|
authors = ["Paul Makles <me@insrt.uk>"]
|
||||||
@@ -38,4 +38,4 @@ sentry = { version = "0.31.5", optional = true }
|
|||||||
sentry-anyhow = { version = "0.38.1", optional = true }
|
sentry-anyhow = { version = "0.38.1", optional = true }
|
||||||
|
|
||||||
# Core
|
# Core
|
||||||
revolt-result = { version = "0.11.2", path = "../result", optional = true }
|
revolt-result = { version = "0.11.5", path = "../result", optional = true }
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ voice_quality = 16000
|
|||||||
# Whether the user can use video streams in voice calls
|
# Whether the user can use video streams in voice calls
|
||||||
video = true
|
video = true
|
||||||
|
|
||||||
# Mamimum resolution (width, height) of video streams in voice calls
|
# Maximum resolution (width, height) of video streams in voice calls
|
||||||
video_resolution = [1080, 720]
|
video_resolution = [1080, 720]
|
||||||
|
|
||||||
# Minimum and maximum aspect ratio of video streams in voice calls
|
# Minimum and maximum aspect ratio of video streams in voice calls
|
||||||
@@ -283,8 +283,8 @@ voice_quality = 16000
|
|||||||
# Whether the user can use video streams in voice calls
|
# Whether the user can use video streams in voice calls
|
||||||
video = true
|
video = true
|
||||||
|
|
||||||
# Mamimum resolution (width, height) of video streams in voice calls
|
# Maximum resolution (width, height) of video streams in voice calls
|
||||||
video_resolution = [1080, 720]
|
video_resolution = [1280, 720]
|
||||||
|
|
||||||
# Minimum and maximum aspect ratio of video streams in voice calls
|
# Minimum and maximum aspect ratio of video streams in voice calls
|
||||||
video_aspect_ratio = [0.3, 2.5]
|
video_aspect_ratio = [0.3, 2.5]
|
||||||
@@ -312,4 +312,4 @@ files = ""
|
|||||||
proxy = ""
|
proxy = ""
|
||||||
pushd = ""
|
pushd = ""
|
||||||
crond = ""
|
crond = ""
|
||||||
gifbox = ""
|
gifbox = ""
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ static CONFIG_BUILDER: Lazy<RwLock<Config>> = Lazy::new(|| {
|
|||||||
pub struct Database {
|
pub struct Database {
|
||||||
pub mongodb: String,
|
pub mongodb: String,
|
||||||
pub redis: String,
|
pub redis: String,
|
||||||
|
pub redis_pubsub: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
@@ -448,7 +449,7 @@ pub async fn config() -> Settings {
|
|||||||
let mut config = read().await.try_deserialize::<Settings>().unwrap();
|
let mut config = read().await.try_deserialize::<Settings>().unwrap();
|
||||||
|
|
||||||
// inject REDIS_URI for redis-kiss library
|
// inject REDIS_URI for redis-kiss library
|
||||||
if std::env::var("REDIS_URL").is_err() {
|
if std::env::var("REDIS_URI").is_err() {
|
||||||
std::env::set_var("REDIS_URI", config.database.redis.clone());
|
std::env::set_var("REDIS_URI", config.database.redis.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-database"
|
name = "revolt-database"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
authors = ["Paul Makles <me@insrt.uk>"]
|
authors = ["Paul Makles <me@insrt.uk>"]
|
||||||
@@ -32,19 +32,19 @@ default = ["mongodb", "async-std-runtime", "tasks"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Core
|
# Core
|
||||||
revolt-config = { version = "0.11.2", path = "../config", features = [
|
revolt-config = { version = "0.11.5", path = "../config", features = [
|
||||||
"report-macros",
|
"report-macros",
|
||||||
] }
|
] }
|
||||||
revolt-result = { version = "0.11.2", path = "../result" }
|
revolt-result = { version = "0.11.5", path = "../result" }
|
||||||
revolt-models = { version = "0.11.2", path = "../models", features = [
|
revolt-models = { version = "0.11.5", path = "../models", features = [
|
||||||
"validator",
|
"validator",
|
||||||
] }
|
] }
|
||||||
revolt-presence = { version = "0.11.2", path = "../presence" }
|
revolt-presence = { version = "0.11.5", path = "../presence" }
|
||||||
revolt-permissions = { version = "0.11.2", path = "../permissions", features = [
|
revolt-permissions = { version = "0.11.5", path = "../permissions", features = [
|
||||||
"serde",
|
"serde",
|
||||||
"bson",
|
"bson",
|
||||||
] }
|
] }
|
||||||
revolt-parser = { version = "0.11.2", path = "../parser" }
|
revolt-parser = { version = "0.11.5", path = "../parser" }
|
||||||
|
|
||||||
# Utility
|
# Utility
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ use revolt_presence::filter_online;
|
|||||||
|
|
||||||
use serde_json::to_string;
|
use serde_json::to_string;
|
||||||
|
|
||||||
|
// TODO: move away from storing Connection and Channel to using thread local singletons - #659
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct AMQP {
|
pub struct AMQP {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
|
use amqprs::{
|
||||||
|
channel::{BasicPublishArguments},
|
||||||
|
BasicProperties, FieldTable,
|
||||||
|
};
|
||||||
use authifier::AuthifierEvent;
|
use authifier::AuthifierEvent;
|
||||||
use revolt_result::Error;
|
use revolt_result::Error;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use revolt_models::v0::{
|
use revolt_models::v0::{
|
||||||
AppendMessage, Channel, ChannelUnread, ChannelVoiceState, Emoji, FieldsChannel, FieldsMember, FieldsMessage, FieldsRole, FieldsServer, FieldsUser, FieldsWebhook, Member, MemberCompositeKey, Message, PartialChannel, PartialMember, PartialMessage, PartialRole, PartialServer, PartialUser, PartialUserVoiceState, PartialWebhook, PolicyChange, RemovalIntention, Report, Server, User, UserSettings, UserVoiceState, Webhook
|
AppendMessage, Channel, ChannelUnread, ChannelVoiceState, Emoji, FieldsChannel, FieldsMember,
|
||||||
|
FieldsMessage, FieldsRole, FieldsServer, FieldsUser, FieldsWebhook, Member, MemberCompositeKey,
|
||||||
|
Message, PartialChannel, PartialMember, PartialMessage, PartialRole, PartialServer,
|
||||||
|
PartialUser, PartialUserVoiceState, PartialWebhook, PolicyChange, RemovalIntention, Report,
|
||||||
|
Server, User, UserSettings, UserVoiceState, Webhook,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::Database;
|
use crate::{util::rabbit::get_channel, Database};
|
||||||
|
|
||||||
/// Ping Packet
|
/// Ping Packet
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
@@ -304,14 +312,23 @@ pub enum EventV1 {
|
|||||||
impl EventV1 {
|
impl EventV1 {
|
||||||
/// Publish helper wrapper
|
/// Publish helper wrapper
|
||||||
pub async fn p(self, channel: String) {
|
pub async fn p(self, channel: String) {
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
redis_kiss::p(channel, self).await;
|
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
info!("Publishing event to {channel}: {self:?}");
|
info!("Publishing event to {channel}: {self:?}");
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
let rmq = get_channel().await;
|
||||||
redis_kiss::publish(channel, self).await.unwrap();
|
|
||||||
|
let mut headers = FieldTable::new();
|
||||||
|
headers.insert("c".try_into().unwrap(), channel.clone().into());
|
||||||
|
let mut properties = BasicProperties::default();
|
||||||
|
properties.with_headers(headers);
|
||||||
|
|
||||||
|
rmq.basic_publish(
|
||||||
|
properties,
|
||||||
|
serde_json::to_string(&self).unwrap().into_bytes(),
|
||||||
|
BasicPublishArguments::new("events", "events"),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Publish user event
|
/// Publish user event
|
||||||
|
|||||||
@@ -653,14 +653,14 @@ impl User {
|
|||||||
self.apply_options(partial.clone());
|
self.apply_options(partial.clone());
|
||||||
db.update_user(&self.id, &partial, remove.clone()).await?;
|
db.update_user(&self.id, &partial, remove.clone()).await?;
|
||||||
|
|
||||||
// EventV1::UserUpdate {
|
EventV1::UserUpdate {
|
||||||
// id: self.id.clone(),
|
id: self.id.clone(),
|
||||||
// data: partial.into(),
|
data: partial.into(),
|
||||||
// clear: remove.into_iter().map(|v| v.into()).collect(),
|
clear: remove.into_iter().map(|v| v.into()).collect(),
|
||||||
// event_id: Some(Ulid::new().to_string()),
|
event_id: Some(Ulid::new().to_string()),
|
||||||
// }
|
}
|
||||||
// .p_user(self.id.clone(), db)
|
.p_user(self.id.clone(), db)
|
||||||
// .await;
|
.await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ pub mod idempotency;
|
|||||||
pub mod permissions;
|
pub mod permissions;
|
||||||
pub mod reference;
|
pub mod reference;
|
||||||
pub mod test_fixtures;
|
pub mod test_fixtures;
|
||||||
|
pub mod rabbit;
|
||||||
|
|
||||||
pub use funcs::*;
|
pub use funcs::*;
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
use amqprs::{channel::Channel, connection::Connection};
|
||||||
|
use once_cell::sync::OnceCell;
|
||||||
|
use std::{
|
||||||
|
collections::HashMap, future::ready, sync::{LazyLock, RwLock}, thread::{ThreadId, current}
|
||||||
|
};
|
||||||
|
|
||||||
|
static RABBIT_CONNECTION: OnceCell<Connection> = OnceCell::new();
|
||||||
|
static RABBIT_CHANNELS: LazyLock<RwLock<HashMap<ThreadId, Channel>>> =
|
||||||
|
LazyLock::new(|| RwLock::new(HashMap::new()));
|
||||||
|
|
||||||
|
pub async fn get_channel_with_init<F: AsyncFnOnce(Channel) -> Channel>(init: F) -> Channel {
|
||||||
|
let conn = RABBIT_CONNECTION
|
||||||
|
.get()
|
||||||
|
.expect("Rabbit connection is not initialised.");
|
||||||
|
|
||||||
|
let thread_id = current().id();
|
||||||
|
|
||||||
|
let channel = RABBIT_CHANNELS
|
||||||
|
.read()
|
||||||
|
.expect("Channels poisioned")
|
||||||
|
.get(&thread_id)
|
||||||
|
.cloned();
|
||||||
|
|
||||||
|
if let Some(channel) = channel {
|
||||||
|
channel
|
||||||
|
} else {
|
||||||
|
let mut channel =
|
||||||
|
conn.open_channel(None)
|
||||||
|
.await
|
||||||
|
.expect("Failed to open rabbitmq channel");
|
||||||
|
|
||||||
|
channel = init(channel).await;
|
||||||
|
|
||||||
|
RABBIT_CHANNELS
|
||||||
|
.write()
|
||||||
|
.expect("Channels poisioned")
|
||||||
|
.insert(thread_id, channel.clone());
|
||||||
|
channel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_channel() -> Channel {
|
||||||
|
get_channel_with_init(ready).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_rabbitmq_connection(connection: Connection) -> bool {
|
||||||
|
RABBIT_CONNECTION.set(connection).is_ok()
|
||||||
|
}
|
||||||
@@ -16,7 +16,9 @@ mod voice_client;
|
|||||||
pub use voice_client::VoiceClient;
|
pub use voice_client::VoiceClient;
|
||||||
|
|
||||||
async fn get_connection() -> Result<Conn> {
|
async fn get_connection() -> Result<Conn> {
|
||||||
_get_connection().await.map_err(|_| create_error!(InternalError))
|
_get_connection()
|
||||||
|
.await
|
||||||
|
.map_err(|_| create_error!(InternalError))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn raise_if_in_voice(user: &User, channel_id: &str) -> Result<()> {
|
pub async fn raise_if_in_voice(user: &User, channel_id: &str) -> Result<()> {
|
||||||
@@ -59,6 +61,14 @@ pub async fn get_channel_node(channel: &str) -> Result<Option<String>> {
|
|||||||
.to_internal_error()
|
.to_internal_error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn delete_channel_node(channel: &str) -> Result<()> {
|
||||||
|
get_connection()
|
||||||
|
.await?
|
||||||
|
.del(format!("node:{channel}"))
|
||||||
|
.await
|
||||||
|
.to_internal_error()
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_user_voice_channels(user_id: &str) -> Result<Vec<String>> {
|
pub async fn get_user_voice_channels(user_id: &str) -> Result<Vec<String>> {
|
||||||
get_connection()
|
get_connection()
|
||||||
.await?
|
.await?
|
||||||
@@ -226,6 +236,7 @@ pub async fn delete_channel_voice_state(
|
|||||||
|
|
||||||
let mut pipeline = Pipeline::new();
|
let mut pipeline = Pipeline::new();
|
||||||
pipeline.del(format!("vc_members:{channel_id}"));
|
pipeline.del(format!("vc_members:{channel_id}"));
|
||||||
|
pipeline.del(format!("node:{channel_id}"));
|
||||||
|
|
||||||
for user_id in user_ids {
|
for user_id in user_ids {
|
||||||
let unique_key = format!("{user_id}:{parent_id}");
|
let unique_key = format!("{user_id}:{parent_id}");
|
||||||
@@ -567,15 +578,24 @@ pub async fn get_call_notification_recipients(
|
|||||||
.to_internal_error()
|
.to_internal_error()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn remove_user_from_voice_channels(db: &Database, voice_client: &VoiceClient, user_id: &str) -> Result<()> {
|
pub async fn remove_user_from_voice_channels(
|
||||||
|
db: &Database,
|
||||||
|
voice_client: &VoiceClient,
|
||||||
|
user_id: &str,
|
||||||
|
) -> Result<()> {
|
||||||
for channel_id in get_user_voice_channels(user_id).await? {
|
for channel_id in get_user_voice_channels(user_id).await? {
|
||||||
remove_user_from_voice_channel(db, voice_client, &channel_id, user_id).await?;
|
remove_user_from_voice_channel(db, voice_client, &channel_id, user_id).await?;
|
||||||
};
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn remove_user_from_voice_channel(db: &Database, voice_client: &VoiceClient, channel_id: &str, user_id: &str) -> Result<()> {
|
pub async fn remove_user_from_voice_channel(
|
||||||
|
db: &Database,
|
||||||
|
voice_client: &VoiceClient,
|
||||||
|
channel_id: &str,
|
||||||
|
user_id: &str,
|
||||||
|
) -> Result<()> {
|
||||||
if let Some(node) = get_channel_node(channel_id).await? {
|
if let Some(node) = get_channel_node(channel_id).await? {
|
||||||
let _ = voice_client.remove_user(&node, user_id, channel_id).await;
|
let _ = voice_client.remove_user(&node, user_id, channel_id).await;
|
||||||
}
|
}
|
||||||
@@ -587,7 +607,11 @@ pub async fn remove_user_from_voice_channel(db: &Database, voice_client: &VoiceC
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delete_voice_channel(voice_client: &VoiceClient, channel_id: &str, server_id: Option<&str>) -> Result<()> {
|
pub async fn delete_voice_channel(
|
||||||
|
voice_client: &VoiceClient,
|
||||||
|
channel_id: &str,
|
||||||
|
server_id: Option<&str>,
|
||||||
|
) -> Result<()> {
|
||||||
if let Some(users) = get_voice_channel_members(channel_id).await? {
|
if let Some(users) = get_voice_channel_members(channel_id).await? {
|
||||||
let node = get_channel_node(channel_id).await?.unwrap();
|
let node = get_channel_node(channel_id).await?.unwrap();
|
||||||
|
|
||||||
@@ -597,4 +621,4 @@ pub async fn delete_voice_channel(voice_client: &VoiceClient, channel_id: &str,
|
|||||||
};
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-files"
|
name = "revolt-files"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
authors = ["Paul Makles <me@insrt.uk>"]
|
authors = ["Paul Makles <me@insrt.uk>"]
|
||||||
@@ -27,10 +27,10 @@ typenum = "1.17.0"
|
|||||||
aws-config = "1.5.5"
|
aws-config = "1.5.5"
|
||||||
aws-sdk-s3 = { version = "1.46.0", features = ["behavior-version-latest"] }
|
aws-sdk-s3 = { version = "1.46.0", features = ["behavior-version-latest"] }
|
||||||
|
|
||||||
revolt-config = { version = "0.11.2", path = "../config", features = [
|
revolt-config = { version = "0.11.5", path = "../config", features = [
|
||||||
"report-macros",
|
"report-macros",
|
||||||
] }
|
] }
|
||||||
revolt-result = { version = "0.11.2", path = "../result" }
|
revolt-result = { version = "0.11.5", path = "../result" }
|
||||||
|
|
||||||
# image processing
|
# image processing
|
||||||
jxl-oxide = { workspace = true }
|
jxl-oxide = { workspace = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-models"
|
name = "revolt-models"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Paul Makles <me@insrt.uk>"]
|
authors = ["Paul Makles <me@insrt.uk>"]
|
||||||
@@ -21,8 +21,8 @@ default = ["serde", "partials", "rocket"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Core
|
# Core
|
||||||
revolt-config = { version = "0.11.2", path = "../config" }
|
revolt-config = { version = "0.11.5", path = "../config" }
|
||||||
revolt-permissions = { version = "0.11.2", path = "../permissions" }
|
revolt-permissions = { version = "0.11.5", path = "../permissions" }
|
||||||
|
|
||||||
# Utility
|
# Utility
|
||||||
regex = "1.11"
|
regex = "1.11"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-parser"
|
name = "revolt-parser"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]
|
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-permissions"
|
name = "revolt-permissions"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Paul Makles <me@insrt.uk>"]
|
authors = ["Paul Makles <me@insrt.uk>"]
|
||||||
@@ -22,7 +22,7 @@ async-std = { version = "1.8.0", features = ["attributes"] }
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Core
|
# Core
|
||||||
revolt-result = { version = "0.11.2", path = "../result" }
|
revolt-result = { version = "0.11.5", path = "../result" }
|
||||||
|
|
||||||
# Utility
|
# Utility
|
||||||
auto_ops = "0.3.0"
|
auto_ops = "0.3.0"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-presence"
|
name = "revolt-presence"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
authors = ["Paul Makles <me@insrt.uk>"]
|
authors = ["Paul Makles <me@insrt.uk>"]
|
||||||
@@ -17,7 +17,7 @@ redis-is-patched = []
|
|||||||
async-std = { version = "1.8.0", features = ["attributes"] }
|
async-std = { version = "1.8.0", features = ["attributes"] }
|
||||||
|
|
||||||
# Config for loading Redis URI
|
# Config for loading Redis URI
|
||||||
revolt-config = { version = "0.11.2", path = "../config" }
|
revolt-config = { version = "0.11.5", path = "../config" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Utility
|
# Utility
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-ratelimits"
|
name = "revolt-ratelimits"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]
|
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]
|
||||||
@@ -18,9 +18,9 @@ axum = ["dep:axum", "revolt-database/axum-impl"]
|
|||||||
default = ["rocket", "axum"]
|
default = ["rocket", "axum"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
revolt-database = { version = "0.11.2", path = "../database" }
|
revolt-database = { version = "0.11.5", path = "../database" }
|
||||||
revolt-result = { version = "0.11.2", path = "../result" }
|
revolt-result = { version = "0.11.5", path = "../result" }
|
||||||
revolt-config = { version = "0.11.2", path = "../config" }
|
revolt-config = { version = "0.11.5", path = "../config" }
|
||||||
|
|
||||||
rocket = { version = "0.5.1", optional = true }
|
rocket = { version = "0.5.1", optional = true }
|
||||||
revolt_rocket_okapi = { version = "0.10.0", optional = true }
|
revolt_rocket_okapi = { version = "0.10.0", optional = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-result"
|
name = "revolt-result"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = ["Paul Makles <me@insrt.uk>"]
|
authors = ["Paul Makles <me@insrt.uk>"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-crond"
|
name = "revolt-crond"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
authors = ["Paul Makles <me@insrt.uk>"]
|
authors = ["Paul Makles <me@insrt.uk>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
@@ -17,7 +17,7 @@ log = "0.4"
|
|||||||
tokio = { version = "1" }
|
tokio = { version = "1" }
|
||||||
|
|
||||||
# Core
|
# Core
|
||||||
revolt-database = { version = "0.11.2", path = "../../core/database" }
|
revolt-database = { version = "0.11.5", path = "../../core/database" }
|
||||||
revolt-result = { version = "0.11.2", path = "../../core/result" }
|
revolt-result = { version = "0.11.5", path = "../../core/result" }
|
||||||
revolt-config = { version = "0.11.2", path = "../../core/config" }
|
revolt-config = { version = "0.11.5", path = "../../core/config" }
|
||||||
revolt-files = { version = "0.11.2", path = "../../core/files" }
|
revolt-files = { version = "0.11.5", path = "../../core/files" }
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-pushd"
|
name = "revolt-pushd"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
revolt-result = { version = "0.11.2", path = "../../core/result" }
|
revolt-result = { version = "0.11.5", path = "../../core/result" }
|
||||||
revolt-config = { version = "0.11.2", path = "../../core/config", features = [
|
revolt-config = { version = "0.11.5", path = "../../core/config", features = [
|
||||||
"report-macros",
|
"report-macros",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
] }
|
] }
|
||||||
revolt-database = { version = "0.11.2", path = "../../core/database" }
|
revolt-database = { version = "0.11.5", path = "../../core/database" }
|
||||||
revolt-models = { version = "0.11.2", path = "../../core/models", features = [
|
revolt-models = { version = "0.11.5", path = "../../core/models", features = [
|
||||||
"validator",
|
"validator",
|
||||||
] }
|
] }
|
||||||
revolt-presence = { version = "0.11.2", path = "../../core/presence", features = [
|
revolt-presence = { version = "0.11.5", path = "../../core/presence", features = [
|
||||||
"redis-is-patched",
|
"redis-is-patched",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ impl DmCallConsumer {
|
|||||||
config.pushd.vapid.queue.as_str(),
|
config.pushd.vapid.queue.as_str(),
|
||||||
)
|
)
|
||||||
.finish();
|
.finish();
|
||||||
sendable.extras.insert("p265dh".to_string(), sub.p256dh);
|
sendable.extras.insert("p256dh".to_string(), sub.p256dh);
|
||||||
sendable
|
sendable
|
||||||
.extras
|
.extras
|
||||||
.insert("endpoint".to_string(), sub.endpoint.clone());
|
.insert("endpoint".to_string(), sub.endpoint.clone());
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ impl FRAcceptedConsumer {
|
|||||||
config.pushd.vapid.queue.as_str(),
|
config.pushd.vapid.queue.as_str(),
|
||||||
)
|
)
|
||||||
.finish();
|
.finish();
|
||||||
sendable.extras.insert("p265dh".to_string(), sub.p256dh);
|
sendable.extras.insert("p256dh".to_string(), sub.p256dh);
|
||||||
sendable
|
sendable
|
||||||
.extras
|
.extras
|
||||||
.insert("endpoint".to_string(), sub.endpoint.clone());
|
.insert("endpoint".to_string(), sub.endpoint.clone());
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ impl FRReceivedConsumer {
|
|||||||
config.pushd.vapid.queue.as_str(),
|
config.pushd.vapid.queue.as_str(),
|
||||||
)
|
)
|
||||||
.finish();
|
.finish();
|
||||||
sendable.extras.insert("p265dh".to_string(), sub.p256dh);
|
sendable.extras.insert("p256dh".to_string(), sub.p256dh);
|
||||||
sendable
|
sendable
|
||||||
.extras
|
.extras
|
||||||
.insert("endpoint".to_string(), sub.endpoint.clone());
|
.insert("endpoint".to_string(), sub.endpoint.clone());
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ impl GenericConsumer {
|
|||||||
config.pushd.vapid.queue.as_str(),
|
config.pushd.vapid.queue.as_str(),
|
||||||
)
|
)
|
||||||
.finish();
|
.finish();
|
||||||
sendable.extras.insert("p265dh".to_string(), sub.p256dh);
|
sendable.extras.insert("p256dh".to_string(), sub.p256dh);
|
||||||
sendable
|
sendable
|
||||||
.extras
|
.extras
|
||||||
.insert("endpoint".to_string(), sub.endpoint.clone());
|
.insert("endpoint".to_string(), sub.endpoint.clone());
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ impl MassMessageConsumer {
|
|||||||
config.pushd.vapid.queue.as_str(),
|
config.pushd.vapid.queue.as_str(),
|
||||||
)
|
)
|
||||||
.finish();
|
.finish();
|
||||||
sendable.extras.insert("p265dh".to_string(), sub.p256dh);
|
sendable.extras.insert("p256dh".to_string(), sub.p256dh);
|
||||||
sendable
|
sendable
|
||||||
.extras
|
.extras
|
||||||
.insert("endpoint".to_string(), sub.endpoint.clone());
|
.insert("endpoint".to_string(), sub.endpoint.clone());
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ impl MessageConsumer {
|
|||||||
config.pushd.vapid.queue.as_str(),
|
config.pushd.vapid.queue.as_str(),
|
||||||
)
|
)
|
||||||
.finish();
|
.finish();
|
||||||
sendable.extras.insert("p265dh".to_string(), sub.p256dh);
|
sendable.extras.insert("p256dh".to_string(), sub.p256dh);
|
||||||
sendable
|
sendable
|
||||||
.extras
|
.extras
|
||||||
.insert("endpoint".to_string(), sub.endpoint.clone());
|
.insert("endpoint".to_string(), sub.endpoint.clone());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-voice-ingress"
|
name = "revolt-voice-ingress"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ use revolt_database::{
|
|||||||
iso8601_timestamp::{Duration, Timestamp},
|
iso8601_timestamp::{Duration, Timestamp},
|
||||||
util::reference::Reference,
|
util::reference::Reference,
|
||||||
voice::{
|
voice::{
|
||||||
create_voice_state, delete_voice_state,
|
create_voice_state, delete_channel_node, delete_voice_state, get_user_moved_from_voice,
|
||||||
get_user_moved_from_voice, get_user_moved_to_voice,
|
get_user_moved_to_voice, get_voice_channel_members, update_voice_state_tracks, VoiceClient,
|
||||||
update_voice_state_tracks, VoiceClient,
|
|
||||||
},
|
},
|
||||||
Database, AMQP,
|
Database, AMQP,
|
||||||
};
|
};
|
||||||
@@ -160,6 +159,8 @@ pub async fn ingress(
|
|||||||
// let members = get_voice_channel_members(channel_id).await?;
|
// let members = get_voice_channel_members(channel_id).await?;
|
||||||
|
|
||||||
// if members.is_none_or(|m| m.is_empty()) {
|
// if members.is_none_or(|m| m.is_empty()) {
|
||||||
|
// delete_channel_node(channel_id).await?;
|
||||||
|
//
|
||||||
// // The channel is empty so send out an "end" message for ringing
|
// // The channel is empty so send out an "end" message for ringing
|
||||||
// if let Err(e) = amqp
|
// if let Err(e) = amqp
|
||||||
// .dm_call_updated(user_id, channel_id, None, true, None)
|
// .dm_call_updated(user_id, channel_id, None, true, None)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-delta"
|
name = "revolt-delta"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
authors = ["Paul Makles <paulmakles@gmail.com>"]
|
authors = ["Paul Makles <paulmakles@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|||||||
+14
-36
@@ -9,8 +9,7 @@ pub mod routes;
|
|||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
||||||
use revolt_config::config;
|
use revolt_config::config;
|
||||||
use revolt_database::events::client::EventV1;
|
use revolt_database::{AMQP, util::rabbit::{get_channel, get_channel_with_init, set_rabbitmq_connection}};
|
||||||
use revolt_database::AMQP;
|
|
||||||
use revolt_ratelimits::rocket as ratelimiter;
|
use revolt_ratelimits::rocket as ratelimiter;
|
||||||
use rocket::{Build, Rocket};
|
use rocket::{Build, Rocket};
|
||||||
use rocket_cors::{AllowedOrigins, CorsOptions};
|
use rocket_cors::{AllowedOrigins, CorsOptions};
|
||||||
@@ -19,11 +18,9 @@ use std::net::Ipv4Addr;
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use amqprs::{
|
use amqprs::{
|
||||||
channel::ExchangeDeclareArguments,
|
channel::{Channel, ExchangeDeclareArguments},
|
||||||
connection::{Connection, OpenConnectionArguments},
|
connection::{Connection, OpenConnectionArguments},
|
||||||
};
|
};
|
||||||
use async_std::channel::unbounded;
|
|
||||||
use authifier::AuthifierEvent;
|
|
||||||
use rocket::data::ToByteUnit;
|
use rocket::data::ToByteUnit;
|
||||||
use revolt_database::voice::VoiceClient;
|
use revolt_database::voice::VoiceClient;
|
||||||
|
|
||||||
@@ -39,28 +36,9 @@ pub async fn web() -> Rocket<Build> {
|
|||||||
log::info!("database_here {db:?}");
|
log::info!("database_here {db:?}");
|
||||||
db.migrate_database().await.unwrap();
|
db.migrate_database().await.unwrap();
|
||||||
|
|
||||||
// Setup Authifier event channel
|
|
||||||
let (_, receiver) = unbounded();
|
|
||||||
|
|
||||||
// Setup Authifier
|
// Setup Authifier
|
||||||
let authifier = db.clone().to_authifier().await;
|
let authifier = db.clone().to_authifier().await;
|
||||||
|
|
||||||
// Launch a listener for Authifier events
|
|
||||||
async_std::task::spawn(async move {
|
|
||||||
while let Ok(event) = receiver.recv().await {
|
|
||||||
match &event {
|
|
||||||
AuthifierEvent::CreateSession { .. } | AuthifierEvent::CreateAccount { .. } => {
|
|
||||||
EventV1::Auth(event).global().await
|
|
||||||
}
|
|
||||||
AuthifierEvent::DeleteSession { user_id, .. }
|
|
||||||
| AuthifierEvent::DeleteAllSessions { user_id, .. } => {
|
|
||||||
let id = user_id.to_string();
|
|
||||||
EventV1::Auth(event).private(id).await
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Configure CORS
|
// Configure CORS
|
||||||
let cors = CorsOptions {
|
let cors = CorsOptions {
|
||||||
allowed_origins: AllowedOrigins::All,
|
allowed_origins: AllowedOrigins::All,
|
||||||
@@ -121,19 +99,19 @@ pub async fn web() -> Rocket<Build> {
|
|||||||
.await
|
.await
|
||||||
.expect("Failed to connect to RabbitMQ");
|
.expect("Failed to connect to RabbitMQ");
|
||||||
|
|
||||||
let channel = connection
|
set_rabbitmq_connection(connection.clone());
|
||||||
.open_channel(None)
|
let channel = get_channel_with_init(|channel: Channel| async {
|
||||||
.await
|
channel
|
||||||
.expect("Failed to open RabbitMQ channel");
|
.exchange_declare(
|
||||||
|
ExchangeDeclareArguments::new(&config.pushd.exchange, "direct")
|
||||||
|
.durable(true)
|
||||||
|
.finish(),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.expect("Failed to declare exchange");
|
||||||
|
|
||||||
channel
|
channel
|
||||||
.exchange_declare(
|
}).await;
|
||||||
ExchangeDeclareArguments::new(&config.pushd.exchange, "direct")
|
|
||||||
.durable(true)
|
|
||||||
.finish(),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.expect("Failed to declare exchange");
|
|
||||||
|
|
||||||
let amqp = AMQP::new(connection, channel);
|
let amqp = AMQP::new(connection, channel);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use revolt_database::{
|
|||||||
util::{permissions::perms, reference::Reference},
|
util::{permissions::perms, reference::Reference},
|
||||||
voice::{
|
voice::{
|
||||||
delete_voice_state, get_channel_node, get_user_voice_channels, get_voice_channel_members,
|
delete_voice_state, get_channel_node, get_user_voice_channels, get_voice_channel_members,
|
||||||
raise_if_in_voice, set_call_notification_recipients, VoiceClient,
|
raise_if_in_voice, set_call_notification_recipients, set_channel_node, VoiceClient,
|
||||||
},
|
},
|
||||||
Database, User,
|
Database, User,
|
||||||
};
|
};
|
||||||
@@ -60,6 +60,7 @@ pub async fn call(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let existing_node = get_channel_node(channel.id()).await?;
|
let existing_node = get_channel_node(channel.id()).await?;
|
||||||
|
let has_existing_node = existing_node.is_some(); // we move existing_node in the next statement so this is the quickest way to know if we need to set it.
|
||||||
|
|
||||||
let node = existing_node
|
let node = existing_node
|
||||||
.or(node)
|
.or(node)
|
||||||
@@ -86,9 +87,11 @@ pub async fn call(
|
|||||||
|
|
||||||
let channel = Reference::from_unchecked(&channel_id)
|
let channel = Reference::from_unchecked(&channel_id)
|
||||||
.as_channel(db)
|
.as_channel(db)
|
||||||
.await?;
|
.await;
|
||||||
|
|
||||||
delete_voice_state(&channel_id, channel.server(), &user.id).await?;
|
if channel.is_ok() {
|
||||||
|
delete_voice_state(&channel_id, channel.unwrap().server(), &user.id).await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
raise_if_in_voice(&user, channel.id()).await?;
|
raise_if_in_voice(&user, channel.id()).await?;
|
||||||
@@ -100,6 +103,10 @@ pub async fn call(
|
|||||||
|
|
||||||
let room = voice_client.create_room(&node, &channel).await?;
|
let room = voice_client.create_room(&node, &channel).await?;
|
||||||
|
|
||||||
|
if !has_existing_node {
|
||||||
|
set_channel_node(channel.id(), &node).await?;
|
||||||
|
}
|
||||||
|
|
||||||
log::debug!("Created room {}", room.name);
|
log::debug!("Created room {}", room.name);
|
||||||
|
|
||||||
if let Some(recipients) = recipients {
|
if let Some(recipients) = recipients {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
use revolt_config::config;
|
use revolt_config::config;
|
||||||
use revolt_result::Result;
|
use revolt_result::Result;
|
||||||
use rocket::serde::json::Json;
|
use rocket::serde::json::Json;
|
||||||
@@ -54,6 +55,80 @@ pub struct RevoltFeatures {
|
|||||||
pub january: Feature,
|
pub january: Feature,
|
||||||
/// Voice server configuration
|
/// Voice server configuration
|
||||||
pub livekit: VoiceFeature,
|
pub livekit: VoiceFeature,
|
||||||
|
/// Limits
|
||||||
|
pub limits: LimitsConfig,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// # Limits For Users
|
||||||
|
#[derive(Serialize, JsonSchema, Debug)]
|
||||||
|
pub struct LimitsConfig {
|
||||||
|
/// Global Limits
|
||||||
|
pub global: GlobalLimits,
|
||||||
|
/// New User Limits
|
||||||
|
pub new_user: UserLimits,
|
||||||
|
/// Default User Limits
|
||||||
|
pub default: UserLimits,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// # Global limits
|
||||||
|
#[derive(Serialize, JsonSchema, Debug)]
|
||||||
|
pub struct GlobalLimits {
|
||||||
|
/// max group size
|
||||||
|
group_size: i64,
|
||||||
|
/// max message embeds
|
||||||
|
message_embeds: i64,
|
||||||
|
/// max replies
|
||||||
|
message_replies: i64,
|
||||||
|
/// max reactions per message
|
||||||
|
message_reactions: i64,
|
||||||
|
/// max server emoji
|
||||||
|
server_emoji: i64,
|
||||||
|
/// max server roles
|
||||||
|
server_roles: i64,
|
||||||
|
/// max server channels
|
||||||
|
server_channels: i64,
|
||||||
|
body_limit_size: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// # User Limits
|
||||||
|
#[derive(Serialize, JsonSchema, Debug)]
|
||||||
|
pub struct UserLimits {
|
||||||
|
/// Max Outgoing Friend Requests
|
||||||
|
pub outgoing_friend_requests: i64,
|
||||||
|
/// Max Owned Bots
|
||||||
|
pub bots: i64,
|
||||||
|
/// Max message content length
|
||||||
|
pub message_length: i64,
|
||||||
|
/// max message attachments
|
||||||
|
pub message_attachments: i64,
|
||||||
|
/// max servers
|
||||||
|
pub servers: i64,
|
||||||
|
/// max audio quality
|
||||||
|
pub voice_quality: i64,
|
||||||
|
/// video streaming enabled
|
||||||
|
pub video: bool,
|
||||||
|
/// max video resolution (vertical, horizontal)
|
||||||
|
pub video_resolution: [i64; 2],
|
||||||
|
/// min/max aspect ratios
|
||||||
|
pub video_aspect_ratio: [f64; 2],
|
||||||
|
pub file_upload_size_limits: HashMap<String, usize>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UserLimits {
|
||||||
|
fn from_feature_limits(fl: revolt_config::FeaturesLimits) -> UserLimits {
|
||||||
|
UserLimits {
|
||||||
|
outgoing_friend_requests: fl.outgoing_friend_requests as i64,
|
||||||
|
bots: fl.bots as i64,
|
||||||
|
message_length: fl.message_length as i64,
|
||||||
|
message_attachments: fl.message_attachments as i64,
|
||||||
|
servers: fl.servers as i64,
|
||||||
|
voice_quality: fl.voice_quality as i64,
|
||||||
|
video: fl.video,
|
||||||
|
video_resolution: [fl.video_resolution[0] as i64, fl.video_resolution[1] as i64],
|
||||||
|
video_aspect_ratio: [fl.video_aspect_ratio[0] as f64, fl.video_aspect_ratio[1] as f64],
|
||||||
|
file_upload_size_limits: fl.file_upload_size_limit,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Build Information
|
/// # Build Information
|
||||||
@@ -134,6 +209,20 @@ pub async fn root() -> Result<Json<RevoltConfig>> {
|
|||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
},
|
},
|
||||||
|
limits: LimitsConfig {
|
||||||
|
global: GlobalLimits {
|
||||||
|
group_size: config.features.limits.global.group_size as i64,
|
||||||
|
message_embeds: config.features.limits.global.message_embeds as i64,
|
||||||
|
message_replies: config.features.limits.global.message_replies as i64,
|
||||||
|
message_reactions: config.features.limits.global.message_reactions as i64,
|
||||||
|
server_emoji: config.features.limits.global.server_emoji as i64,
|
||||||
|
server_roles: config.features.limits.global.server_roles as i64,
|
||||||
|
server_channels: config.features.limits.global.server_channels as i64,
|
||||||
|
body_limit_size: config.features.limits.global.body_limit_size as i64,
|
||||||
|
},
|
||||||
|
new_user: UserLimits::from_feature_limits(config.features.limits.new_user),
|
||||||
|
default: UserLimits::from_feature_limits(config.features.limits.default),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
ws: config.hosts.events,
|
ws: config.hosts.events,
|
||||||
app: config.hosts.app,
|
app: config.hosts.app,
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ use futures::StreamExt;
|
|||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use redis_kiss::redis::aio::PubSub;
|
use redis_kiss::redis::aio::PubSub;
|
||||||
use revolt_database::{
|
use revolt_database::{
|
||||||
events::client::EventV1, Channel, Database, Member, Message, PartialRole, Server, User, AMQP,
|
events::client::EventV1,
|
||||||
|
util::rabbit::{get_channel, set_rabbitmq_connection},
|
||||||
|
Channel, Database, Member, Message, PartialRole, Server, User, AMQP,
|
||||||
};
|
};
|
||||||
use revolt_database::{util::idempotency::IdempotencyKey, Role};
|
use revolt_database::{util::idempotency::IdempotencyKey, Role};
|
||||||
use revolt_models::v0;
|
use revolt_models::v0;
|
||||||
@@ -59,10 +61,16 @@ impl TestHarness {
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let channel = connection.open_channel(None).await.unwrap();
|
|
||||||
|
set_rabbitmq_connection(connection.clone());
|
||||||
|
let channel = get_channel().await;
|
||||||
|
|
||||||
let amqp = AMQP::new(connection, channel);
|
let amqp = AMQP::new(connection, channel);
|
||||||
|
|
||||||
|
async_std::task::spawn(async {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
TestHarness {
|
TestHarness {
|
||||||
client,
|
client,
|
||||||
authifier,
|
authifier,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-autumn"
|
name = "revolt-autumn"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
publish = false
|
publish = false
|
||||||
@@ -44,16 +44,16 @@ tracing = "0.1"
|
|||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
|
|
||||||
# Core crates
|
# Core crates
|
||||||
revolt-files = { version = "0.11.2", path = "../../core/files" }
|
revolt-files = { version = "0.11.5", path = "../../core/files" }
|
||||||
revolt-config = { version = "0.11.2", path = "../../core/config" }
|
revolt-config = { version = "0.11.5", path = "../../core/config" }
|
||||||
revolt-database = { version = "0.11.2", path = "../../core/database", features = [
|
revolt-database = { version = "0.11.5", path = "../../core/database", features = [
|
||||||
"axum-impl",
|
"axum-impl",
|
||||||
] }
|
] }
|
||||||
revolt-result = { version = "0.11.2", path = "../../core/result", features = [
|
revolt-result = { version = "0.11.5", path = "../../core/result", features = [
|
||||||
"utoipa",
|
"utoipa",
|
||||||
"axum",
|
"axum",
|
||||||
] }
|
] }
|
||||||
revolt-ratelimits = { version = "0.11.2", path = "../../core/ratelimits", features = ["axum"] }
|
revolt-ratelimits = { version = "0.11.5", path = "../../core/ratelimits", features = ["axum"] }
|
||||||
|
|
||||||
# Axum / web server
|
# Axum / web server
|
||||||
tempfile = "3.12.0"
|
tempfile = "3.12.0"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-gifbox"
|
name = "revolt-gifbox"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
publish = false
|
publish = false
|
||||||
@@ -17,19 +17,19 @@ tokio = { version = "1.0", features = ["full"] }
|
|||||||
reqwest = { version = "0.12", features = ["json"] }
|
reqwest = { version = "0.12", features = ["json"] }
|
||||||
|
|
||||||
# Core crates
|
# Core crates
|
||||||
revolt-config = { version = "0.11.2", path = "../../core/config" }
|
revolt-config = { version = "0.11.5", path = "../../core/config" }
|
||||||
revolt-models = { version = "0.11.2", path = "../../core/models" }
|
revolt-models = { version = "0.11.5", path = "../../core/models" }
|
||||||
revolt-result = { version = "0.11.2", path = "../../core/result", features = [
|
revolt-result = { version = "0.11.5", path = "../../core/result", features = [
|
||||||
"utoipa",
|
"utoipa",
|
||||||
"axum",
|
"axum",
|
||||||
] }
|
] }
|
||||||
revolt-coalesced = { version = "0.11.2", path = "../../core/coalesced", features = [
|
revolt-coalesced = { version = "0.11.5", path = "../../core/coalesced", features = [
|
||||||
"queue",
|
"queue",
|
||||||
] }
|
] }
|
||||||
revolt-database = { version = "0.11.2", path = "../../core/database", features = [
|
revolt-database = { version = "0.11.5", path = "../../core/database", features = [
|
||||||
"axum-impl",
|
"axum-impl",
|
||||||
] }
|
] }
|
||||||
revolt-ratelimits = { version = "0.11.2", path = "../../core/ratelimits", features = [
|
revolt-ratelimits = { version = "0.11.5", path = "../../core/ratelimits", features = [
|
||||||
"axum",
|
"axum",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "revolt-january"
|
name = "revolt-january"
|
||||||
version = "0.11.2"
|
version = "0.11.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
publish = false
|
publish = false
|
||||||
@@ -33,13 +33,13 @@ tracing = "0.1"
|
|||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
|
|
||||||
# Core crates
|
# Core crates
|
||||||
revolt-config = { version = "0.11.2", path = "../../core/config" }
|
revolt-config = { version = "0.11.5", path = "../../core/config" }
|
||||||
revolt-models = { version = "0.11.2", path = "../../core/models" }
|
revolt-models = { version = "0.11.5", path = "../../core/models" }
|
||||||
revolt-result = { version = "0.11.2", path = "../../core/result", features = [
|
revolt-result = { version = "0.11.5", path = "../../core/result", features = [
|
||||||
"utoipa",
|
"utoipa",
|
||||||
"axum",
|
"axum",
|
||||||
] }
|
] }
|
||||||
revolt-files = { version = "0.11.2", path = "../../core/files" }
|
revolt-files = { version = "0.11.5", path = "../../core/files" }
|
||||||
|
|
||||||
# Axum / web server
|
# Axum / web server
|
||||||
axum = { version = "0.7.5" }
|
axum = { version = "0.7.5" }
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
0.11.2
|
0.11.5
|
||||||
|
|||||||
Reference in New Issue
Block a user