Compare commits

..
2 Commits
Author SHA1 Message Date
IAmTomahawkx 173a3effda fix: minio wants the default region 2026-05-08 16:47:20 -07:00
Infiland 34f05f4b2f fix: avoid stack overflow in database tests
Signed-off-by: Infiland <ljubica.citydesign@gmail.com>
2026-05-08 16:00:27 -07:00
30 changed files with 97 additions and 299 deletions

No files matched your search

+1 -1
View File
@@ -1,3 +1,3 @@
{ {
".": "0.13.5" ".": "0.12.1"
} }
-63
View File
@@ -1,68 +1,5 @@
# Changelog # Changelog
## [0.13.5](https://github.com/stoatchat/stoatchat/compare/v0.13.4...v0.13.5) (2026-05-17)
### Bug Fixes
* dont panic on hash missing when deleting files ([#755](https://github.com/stoatchat/stoatchat/issues/755)) ([c902077](https://github.com/stoatchat/stoatchat/commit/c902077cf51076fee11712eb732dc8a8f786fc4b))
## [0.13.4](https://github.com/stoatchat/stoatchat/compare/v0.13.3...v0.13.4) (2026-05-16)
### Bug Fixes
* add TLS feature to livekit-api crate ([#753](https://github.com/stoatchat/stoatchat/issues/753)) ([6cfee1f](https://github.com/stoatchat/stoatchat/commit/6cfee1f601c1e084df7c8f1e7a5e8a560d1dd514))
## [0.13.3](https://github.com/stoatchat/stoatchat/compare/v0.13.2...v0.13.3) (2026-05-15)
### Bug Fixes
* don't automatically set up rabbitmq in delta ([#749](https://github.com/stoatchat/stoatchat/issues/749)) ([7647cfc](https://github.com/stoatchat/stoatchat/commit/7647cfc8d93aba99f5faef13eb3d970097540d76))
* don't declare queues which seem to cause the backend to crash in prod ([7647cfc](https://github.com/stoatchat/stoatchat/commit/7647cfc8d93aba99f5faef13eb3d970097540d76))
## [0.13.2](https://github.com/stoatchat/stoatchat/compare/v0.13.1...v0.13.2) (2026-05-11)
### Bug Fixes
* update default exchange to `revolt.default` ([#746](https://github.com/stoatchat/stoatchat/issues/746)) ([fcb8091](https://github.com/stoatchat/stoatchat/commit/fcb8091cd7a00d7f26c798daa33aae4b923b2a8b))
## [0.13.1](https://github.com/stoatchat/stoatchat/compare/v0.13.0...v0.13.1) (2026-05-10)
### Bug Fixes
* amqprs startup bug ([#744](https://github.com/stoatchat/stoatchat/issues/744)) ([1100eaf](https://github.com/stoatchat/stoatchat/commit/1100eaf46f849f2509ae01ac497556ca33bde778))
## [0.13.0](https://github.com/stoatchat/stoatchat/compare/v0.12.1...v0.13.0) (2026-05-08)
### Features
* add embed support for YouTube Shorts ([#734](https://github.com/stoatchat/stoatchat/issues/734)) ([d46c7f7](https://github.com/stoatchat/stoatchat/commit/d46c7f7f3c04524c0639c3e0a122626f8e0b3bf7))
* add emoji rename endpoint ([#714](https://github.com/stoatchat/stoatchat/issues/714)) ([23ad135](https://github.com/stoatchat/stoatchat/commit/23ad1359834bb7d07a460b8678d6a6ebffc73eb0))
* add legal links to root payload ([#733](https://github.com/stoatchat/stoatchat/issues/733)) ([21d8201](https://github.com/stoatchat/stoatchat/commit/21d82018cf84ab0fdd10613d254b9562aea8eea3))
* add role icon support ([#724](https://github.com/stoatchat/stoatchat/issues/724)) ([841985d](https://github.com/stoatchat/stoatchat/commit/841985d3b994df1c6eefab2fc7ecbd77ab22c493))
* Add webhook endpoints for editing and deleting messages ([#682](https://github.com/stoatchat/stoatchat/issues/682)) ([6f3441c](https://github.com/stoatchat/stoatchat/commit/6f3441cf4acac2a8e6e1bf07a279a153b80f7956))
* automatically sanitise usernames on create/update ([#689](https://github.com/stoatchat/stoatchat/issues/689)) ([e937697](https://github.com/stoatchat/stoatchat/commit/e93769786c7669485a659ee471630740d3cea702))
* blacklist private ip ranges and add january domain blocklist ([#731](https://github.com/stoatchat/stoatchat/issues/731)) ([6b41db9](https://github.com/stoatchat/stoatchat/commit/6b41db984bb491b2e58324309cc70d8c14e0b814))
* Rewrite acks ([#741](https://github.com/stoatchat/stoatchat/issues/741)) ([ab5bd47](https://github.com/stoatchat/stoatchat/commit/ab5bd47a39ee889de0b5ae6e7b560620853daead))
### Bug Fixes
* add new_user_hours to configuration limits ([#729](https://github.com/stoatchat/stoatchat/issues/729)) ([279f5d5](https://github.com/stoatchat/stoatchat/commit/279f5d5fd7af2df55902c706859ec07f569cdb1e))
* add reconnection policy to Redis subscriber to prevent ghost state ([#708](https://github.com/stoatchat/stoatchat/issues/708)) ([057f2bb](https://github.com/stoatchat/stoatchat/commit/057f2bb8b359f8b942741a30ff54eeb8fbe3e0b1))
* docker compose file had personal url in it ([#742](https://github.com/stoatchat/stoatchat/issues/742)) ([0719985](https://github.com/stoatchat/stoatchat/commit/0719985ac5636590f91e6f9ec4b68f3eded70c13))
* don't strip ICC from exif ([#735](https://github.com/stoatchat/stoatchat/issues/735)) ([d76a711](https://github.com/stoatchat/stoatchat/commit/d76a71141f3e508f6308ba52fa28eaeb56fb3438))
* dont send notification in fcm ([#721](https://github.com/stoatchat/stoatchat/issues/721)) ([89171e9](https://github.com/stoatchat/stoatchat/commit/89171e9bd0f15711157e78c6eec0fe7b480de93a))
* encode filenames in redirects ([#737](https://github.com/stoatchat/stoatchat/issues/737)) ([9fd7128](https://github.com/stoatchat/stoatchat/commit/9fd7128f800badbd184baf943d4f799e601201e4))
* january ip redirects & domain resolver ([#738](https://github.com/stoatchat/stoatchat/issues/738)) ([356491e](https://github.com/stoatchat/stoatchat/commit/356491e934b274f9e895df883dd63ef0b3123510))
* update message length validation to remove upper limit ([#723](https://github.com/stoatchat/stoatchat/issues/723)) ([ed4fd5e](https://github.com/stoatchat/stoatchat/commit/ed4fd5ebfe6d0ea534a0898da4afdc1f4e2cd6c5))
* use correct response for NoEffect errors ([#732](https://github.com/stoatchat/stoatchat/issues/732)) ([5378cd2](https://github.com/stoatchat/stoatchat/commit/5378cd22b4c7d85f44c31a6af0dda00941b80d5c))
## [0.12.1](https://github.com/stoatchat/stoatchat/compare/v0.12.0...v0.12.1) (2026-04-10) ## [0.12.1](https://github.com/stoatchat/stoatchat/compare/v0.12.0...v0.12.1) (2026-04-10)
Generated
+19 -63
View File
@@ -570,7 +570,7 @@ dependencies = [
"futures-util", "futures-util",
"log", "log",
"pin-project-lite 0.2.17", "pin-project-lite 0.2.17",
"tungstenite 0.17.3", "tungstenite",
] ]
[[package]] [[package]]
@@ -5048,14 +5048,11 @@ dependencies = [
"prost", "prost",
"rand 0.9.2", "rand 0.9.2",
"reqwest 0.12.28", "reqwest 0.12.28",
"rustls-native-certs 0.6.3",
"scopeguard", "scopeguard",
"serde", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
"thiserror 2.0.18", "thiserror 2.0.18",
"tokio-rustls 0.24.1",
"tokio-tungstenite",
"url", "url",
] ]
@@ -7422,22 +7419,16 @@ dependencies = [
"http-body 1.0.1", "http-body 1.0.1",
"http-body-util", "http-body-util",
"hyper 1.9.0", "hyper 1.9.0",
"hyper-rustls 0.27.7",
"hyper-util", "hyper-util",
"js-sys", "js-sys",
"log", "log",
"percent-encoding", "percent-encoding",
"pin-project-lite 0.2.17", "pin-project-lite 0.2.17",
"quinn",
"rustls 0.23.37",
"rustls-native-certs 0.8.3",
"rustls-pki-types",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"sync_wrapper 1.0.2", "sync_wrapper 1.0.2",
"tokio 1.51.0", "tokio 1.51.0",
"tokio-rustls 0.26.4",
"tower", "tower",
"tower-http 0.6.8", "tower-http 0.6.8",
"tower-service", "tower-service",
@@ -7513,7 +7504,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-autumn" name = "revolt-autumn"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"axum", "axum",
"axum-macros", "axum-macros",
@@ -7554,7 +7545,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-bonfire" name = "revolt-bonfire"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"async-channel 2.5.0", "async-channel 2.5.0",
"async-std", "async-std",
@@ -7585,7 +7576,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-coalesced" name = "revolt-coalesced"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"indexmap 2.13.1", "indexmap 2.13.1",
"lru", "lru",
@@ -7594,7 +7585,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-config" name = "revolt-config"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"async-std", "async-std",
"cached", "cached",
@@ -7611,7 +7602,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-crond" name = "revolt-crond"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"futures-lite", "futures-lite",
"iso8601-timestamp", "iso8601-timestamp",
@@ -7631,7 +7622,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-database" name = "revolt-database"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"amqprs", "amqprs",
"async-lock 2.8.0", "async-lock 2.8.0",
@@ -7682,7 +7673,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-delta" name = "revolt-delta"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"amqprs", "amqprs",
"async-channel 2.5.0", "async-channel 2.5.0",
@@ -7731,7 +7722,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-files" name = "revolt-files"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"aes-gcm", "aes-gcm",
"anyhow", "anyhow",
@@ -7759,7 +7750,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-gifbox" name = "revolt-gifbox"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"axum", "axum",
"axum-extra", "axum-extra",
@@ -7782,7 +7773,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-january" name = "revolt-january"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"async-recursion", "async-recursion",
"axum", "axum",
@@ -7812,7 +7803,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-models" name = "revolt-models"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"indexmap 2.13.1", "indexmap 2.13.1",
"iso8601-timestamp", "iso8601-timestamp",
@@ -7831,14 +7822,14 @@ dependencies = [
[[package]] [[package]]
name = "revolt-parser" name = "revolt-parser"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"logos", "logos",
] ]
[[package]] [[package]]
name = "revolt-permissions" name = "revolt-permissions"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"async-std", "async-std",
"async-trait", "async-trait",
@@ -7853,7 +7844,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-presence" name = "revolt-presence"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"async-std", "async-std",
"log", "log",
@@ -7865,7 +7856,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-pushd" name = "revolt-pushd"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"amqprs", "amqprs",
"anyhow", "anyhow",
@@ -7896,7 +7887,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-ratelimits" name = "revolt-ratelimits"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"authifier", "authifier",
@@ -7913,7 +7904,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-result" name = "revolt-result"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"axum", "axum",
"log", "log",
@@ -7929,7 +7920,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt-voice-ingress" name = "revolt-voice-ingress"
version = "0.13.5" version = "0.12.1"
dependencies = [ dependencies = [
"amqprs", "amqprs",
"async-std", "async-std",
@@ -9900,21 +9891,6 @@ dependencies = [
"tokio 1.51.0", "tokio 1.51.0",
] ]
[[package]]
name = "tokio-tungstenite"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
dependencies = [
"futures-util",
"log",
"rustls 0.21.12",
"rustls-native-certs 0.6.3",
"tokio 1.51.0",
"tokio-rustls 0.24.1",
"tungstenite 0.20.1",
]
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.7.18" version = "0.7.18"
@@ -10170,26 +10146,6 @@ dependencies = [
"utf-8", "utf-8",
] ]
[[package]]
name = "tungstenite"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9"
dependencies = [
"byteorder",
"bytes 1.11.1",
"data-encoding",
"http 0.2.12",
"httparse",
"log",
"rand 0.8.5",
"rustls 0.21.12",
"sha1",
"thiserror 1.0.69",
"url",
"utf-8",
]
[[package]] [[package]]
name = "typed-builder" name = "typed-builder"
version = "0.22.0" version = "0.22.0"
+10 -10
View File
@@ -192,13 +192,13 @@ futures-lite = "2.6.1"
vergen = "7.5.0" vergen = "7.5.0"
# Local packages # Local packages
revolt-coalesced = { version = "0.13.5", path = "crates/core/coalesced" } revolt-coalesced = { version = "0.12.0", path = "crates/core/coalesced" }
revolt-config = { version = "0.13.5", path = "crates/core/config" } revolt-config = { version = "0.12.0", path = "crates/core/config" }
revolt-database = { version = "0.13.5", path = "crates/core/database" } revolt-database = { version = "0.12.0", path = "crates/core/database" }
revolt-files = { version = "0.13.5", path = "crates/core/files" } revolt-files = { version = "0.12.0", path = "crates/core/files" }
revolt-models = { version = "0.13.5", path = "crates/core/models" } revolt-models = { version = "0.12.0", path = "crates/core/models" }
revolt-parser = { version = "0.13.5", path = "crates/core/parser" } revolt-parser = { version = "0.12.0", path = "crates/core/parser" }
revolt-permissions = { version = "0.13.5", path = "crates/core/permissions" } revolt-permissions = { version = "0.12.0", path = "crates/core/permissions" }
revolt-presence = { version = "0.13.5", path = "crates/core/presence" } revolt-presence = { version = "0.12.0", path = "crates/core/presence" }
revolt-ratelimits = { version = "0.13.5", path = "crates/core/ratelimits" } revolt-ratelimits = { version = "0.12.0", path = "crates/core/ratelimits" }
revolt-result = { version = "0.13.5", path = "crates/core/result" } revolt-result = { version = "0.12.0", path = "crates/core/result" }
+1 -1
View File
@@ -61,7 +61,7 @@ secret = "ZjCofRlfm6GGtjlifmNpCDkcQbEIIVC0"
# S3 protocol endpoint # S3 protocol endpoint
endpoint = "http://127.0.0.1:14009" endpoint = "http://127.0.0.1:14009"
# S3 region name # S3 region name
region = "minio" region = "us-east-1"
# S3 protocol key ID # S3 protocol key ID
access_key_id = "minioautumn" access_key_id = "minioautumn"
# S3 protocol access key # S3 protocol access key
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-bonfire" name = "revolt-bonfire"
version = "0.13.5" version = "0.12.1"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
edition = "2021" edition = "2021"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-coalesced" name = "revolt-coalesced"
version = "0.13.5" version = "0.12.1"
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 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-config" name = "revolt-config"
version = "0.13.5" version = "0.12.1"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
+1 -1
View File
@@ -30,7 +30,7 @@ host = "rabbit"
port = 5672 port = 5672
username = "rabbituser" username = "rabbituser"
password = "rabbitpass" password = "rabbitpass"
default_exchange = "revolt.default" default_exchange = "revolt"
[rabbit.queues] [rabbit.queues]
acks = "internal.ack" acks = "internal.ack"
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-database" name = "revolt-database"
version = "0.13.5" version = "0.12.1"
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>"]
@@ -98,6 +98,6 @@ authifier = { workspace = true }
amqprs = { workspace = true } amqprs = { workspace = true }
# Voice # Voice
livekit-api = { workspace = true, features = ["rustls-tls-native-roots"], optional = true } livekit-api = { workspace = true, optional = true }
livekit-protocol = { workspace = true, optional = true } livekit-protocol = { workspace = true, optional = true }
livekit-runtime = { workspace = true, features = ["tokio"], optional = true } livekit-runtime = { workspace = true, features = ["tokio"], optional = true }
+11 -16
View File
@@ -29,7 +29,7 @@ impl AMQP {
} }
} }
pub async fn new_auto() -> revolt_result::Result<AMQP> { pub async fn new_auto() -> AMQP {
let config = revolt_config::config().await; let config = revolt_config::config().await;
let connection = Connection::open(&OpenConnectionArguments::new( let connection = Connection::open(&OpenConnectionArguments::new(
@@ -46,26 +46,21 @@ impl AMQP {
.await .await
.expect("Failed to open RabbitMQ channel"); .expect("Failed to open RabbitMQ channel");
let mut resp = AMQP::new(connection, channel); channel
//resp.configure_channels().await?; .exchange_declare(
Ok(resp) ExchangeDeclareArguments::new(&config.pushd.exchange, "direct")
} .durable(true)
.finish(),
pub async fn repoen_channel(&mut self) { )
self.channel = self
.connection
.open_channel(None)
.await .await
.expect("Failed to open RabbitMQ channel"); .expect("Failed to declare exchange");
AMQP::new(connection, channel)
} }
pub async fn configure_channels(&mut self) -> revolt_result::Result<()> { pub async fn configure_channels(&self) -> revolt_result::Result<()> {
let config = revolt_config::config().await; let config = revolt_config::config().await;
if !self.channel.is_open() {
self.repoen_channel().await;
}
self.channel self.channel
.exchange_declare( .exchange_declare(
ExchangeDeclareArguments::new( ExchangeDeclareArguments::new(
+1 -1
View File
@@ -95,7 +95,7 @@ macro_rules! database_test {
db.drop_database().await; db.drop_database().await;
#[allow(clippy::redundant_closure_call)] #[allow(clippy::redundant_closure_call)]
(|$db: $crate::Database| $test)(db.clone()).await; std::boxed::Box::pin((|$db: $crate::Database| $test)(db.clone())).await;
db.drop_database().await db.drop_database().await
}; };
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-files" name = "revolt-files"
version = "0.13.5" version = "0.12.1"
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>"]
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-models" name = "revolt-models"
version = "0.13.5" version = "0.12.1"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-parser" name = "revolt-parser"
version = "0.13.5" version = "0.12.1"
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 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-permissions" name = "revolt-permissions"
version = "0.13.5" version = "0.12.1"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-presence" name = "revolt-presence"
version = "0.13.5" version = "0.12.1"
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>"]
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-ratelimits" name = "revolt-ratelimits"
version = "0.13.5" version = "0.12.1"
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>"]
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-result" name = "revolt-result"
version = "0.13.5" version = "0.12.1"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"] authors = ["Paul Makles <me@insrt.uk>"]
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-crond" name = "revolt-crond"
version = "0.13.5" version = "0.12.1"
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"
+13 -15
View File
@@ -11,24 +11,22 @@ pub async fn task(db: Database) -> Result<()> {
let files = db.fetch_deleted_attachments().await?; let files = db.fetch_deleted_attachments().await?;
for file in files { for file in files {
if let Some(hash) = &file.hash { let count = db
let count = db .count_file_hash_references(file.hash.as_ref().expect("no `hash` present"))
.count_file_hash_references(hash) .await?;
// No other files reference this file on disk anymore
if count <= 1 {
let file_hash = db
.fetch_attachment_hash(file.hash.as_ref().expect("no `hash` present"))
.await?; .await?;
// No other files reference this file on disk anymore // Delete from S3
if count <= 1 { delete_from_s3(&file_hash.bucket_id, &file_hash.path).await?;
let file_hash = db
.fetch_attachment_hash(hash)
.await?;
// Delete from S3 // Delete the hash
delete_from_s3(&file_hash.bucket_id, &file_hash.path).await?; db.delete_attachment_hash(&file_hash.id).await?;
info!("Deleted file hash {}", file_hash.id);
// Delete the hash
db.delete_attachment_hash(&file_hash.id).await?;
info!("Deleted file hash {}", file_hash.id);
}
} }
// Delete the file // Delete the file
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-pushd" name = "revolt-pushd"
version = "0.13.5" version = "0.12.1"
edition = "2021" edition = "2021"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-voice-ingress" name = "revolt-voice-ingress"
version = "0.13.5" version = "0.12.1"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
edition = "2021" edition = "2021"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-delta" name = "revolt-delta"
version = "0.13.5" version = "0.12.1"
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"
+4 -4
View File
@@ -119,10 +119,10 @@ pub async fn web() -> Rocket<Build> {
.await .await
.expect("Failed to declare exchange"); .expect("Failed to declare exchange");
let mut amqp = AMQP::new(connection, channel); let amqp = AMQP::new(connection, channel);
// amqp.configure_channels() amqp.configure_channels()
// .await .await
// .expect("Failed to configure channels"); .expect("Failed to configure channels");
// Launch background task workers // Launch background task workers
revolt_database::tasks::start_workers(db.clone(), amqp.clone()); revolt_database::tasks::start_workers(db.clone(), amqp.clone());
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-autumn" name = "revolt-autumn"
version = "0.13.5" version = "0.12.1"
edition = "2021" edition = "2021"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-gifbox" name = "revolt-gifbox"
version = "0.13.5" version = "0.12.1"
edition = "2021" edition = "2021"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
publish = false publish = false
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "revolt-january" name = "revolt-january"
version = "0.13.5" version = "0.12.1"
edition = "2021" edition = "2021"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
publish = false publish = false
+16 -104
View File
@@ -4,7 +4,6 @@ use mime::Mime;
use pdk_ip_filter_lib::IpFilter; use pdk_ip_filter_lib::IpFilter;
use regex::Regex; use regex::Regex;
use reqwest::{ use reqwest::{
dns::{Addrs, Name, Resolve},
header::{self, CONTENT_TYPE}, header::{self, CONTENT_TYPE},
redirect, Client, Response, redirect, Client, Response,
}; };
@@ -12,7 +11,6 @@ use revolt_config::{config, report_internal_error};
use revolt_files::{create_thumbnail, decode_image, image_size_vec, is_valid_image, video_size}; use revolt_files::{create_thumbnail, decode_image, image_size_vec, is_valid_image, video_size};
use revolt_models::v0::{Embed, Image, ImageSize, Video}; use revolt_models::v0::{Embed, Image, ImageSize, Video};
use revolt_result::{create_error, Error, Result, ToRevoltError}; use revolt_result::{create_error, Error, Result, ToRevoltError};
use std::net::{IpAddr, SocketAddr};
use std::{ use std::{
io::{Cursor, Write}, io::{Cursor, Write},
str::FromStr, str::FromStr,
@@ -23,7 +21,6 @@ use url::{Host, Url};
lazy_static! { lazy_static! {
/// Request client /// Request client
static ref CLIENT: Client = reqwest::Client::builder() static ref CLIENT: Client = reqwest::Client::builder()
.dns_resolver(CachedDnsResolver {})
.timeout(Duration::from_secs(10)) // TODO config .timeout(Duration::from_secs(10)) // TODO config
.connect_timeout(Duration::from_secs(5)) // TODO config .connect_timeout(Duration::from_secs(5)) // TODO config
.redirect(redirect::Policy::none()) .redirect(redirect::Policy::none())
@@ -61,73 +58,18 @@ lazy_static! {
.time_to_live(Duration::from_secs(60)) // For up to 1 minute .time_to_live(Duration::from_secs(60)) // For up to 1 minute
.build(); .build();
static ref DNS_CACHE: moka::future::Cache<String, Vec<SocketAddr>> = moka::future::Cache::builder()
.max_capacity(10_000)
.time_to_idle(Duration::from_secs(30))
.build();
static ref IP_BLOCKLIST: IpFilter = IpFilter::block(&[ static ref IP_BLOCKLIST: IpFilter = IpFilter::block(&[
"0.0.0.0/8",
"10.0.0.0/8", "10.0.0.0/8",
"192.168.0.0/16", "192.168.0.0/16",
"127.0.0.0/8", "127.0.0.0/8",
"172.16.0.0/12", "172.16.0.0/12",
"169.254.0.0/16", "169.254.0.0/16",
"::1", "::1",
"fc00::/7", "fc00::/7"
] ]
).unwrap(); ).unwrap();
} }
#[derive(Clone)]
pub struct IPRequest {
url: Url,
ip: IpAddr,
pub blocked: bool,
}
impl From<IPRequest> for Url {
fn from(value: IPRequest) -> Self {
let mut url = value.url.clone();
url.set_host(Some(&value.ip.to_string()))
.map(|_| url)
.unwrap_or(value.url)
}
}
struct CachedDnsResolver {}
impl reqwest::dns::Resolve for CachedDnsResolver {
fn resolve(&self, name: Name) -> reqwest::dns::Resolving {
Box::pin(async move {
{
if let Some(addrs) = DNS_CACHE.get(&name.as_str().to_string()).await {
let resp: Addrs = Box::new(addrs.clone().into_iter());
return Ok(resp);
}
}
let mut lookup = name.as_str().to_string();
if !lookup.contains(":") {
lookup += ":0";
}
let fallback: Vec<SocketAddr> = tokio::net::lookup_host(&lookup)
.await
.map_err(|e| -> Box<dyn std::error::Error + Send + Sync> { Box::new(e) })?
.collect();
{
DNS_CACHE
.insert(name.as_str().to_string().clone(), fallback.clone())
.await;
let addrs: Addrs = Box::new(fallback.clone().into_iter());
Ok(addrs)
}
})
}
}
/// Information about a successful request /// Information about a successful request
pub struct Request { pub struct Request {
response: Response, response: Response,
@@ -333,12 +275,7 @@ impl Request {
let mut url = url; let mut url = url;
let url_host_str = url.host_str().ok_or(create_error!(ProxyError))?.to_string(); let url_host_str = url.host_str().ok_or(create_error!(ProxyError))?.to_string();
let mut blocker = Request::url_is_blacklisted(&url).await?; Request::url_is_blacklisted(&url).await?;
if blocker.blocked {
return Err(create_error!(InvalidOperation));
}
let mut redirect_count = 0; let mut redirect_count = 0;
loop { loop {
@@ -367,13 +304,9 @@ impl Request {
let location = location.to_str().map_err(|_| create_error!(ProxyError))?; let location = location.to_str().map_err(|_| create_error!(ProxyError))?;
url = Url::from_str(location).to_internal_error()?; url = Url::from_str(location).to_internal_error()?;
blocker = Request::url_is_blacklisted(&url).await?; if !Request::url_is_blacklisted(&url).await? {
continue;
if blocker.blocked {
return Err(create_error!(InvalidOperation));
} }
continue;
} else { } else {
return Err(create_error!(ProxyError)); return Err(create_error!(ProxyError));
} }
@@ -418,25 +351,17 @@ impl Request {
Ok(Request::exists(proper_url).await) Ok(Request::exists(proper_url).await)
} }
pub async fn url_is_blacklisted(url: &Url) -> Result<IPRequest> { pub async fn url_is_blacklisted(url: &Url) -> Result<bool> {
let resolved_address: IpAddr;
if let Some(host) = url.host() { if let Some(host) = url.host() {
match host { match host {
Host::Ipv4(ipv4) => { Host::Ipv4(ipv4) => {
resolved_address = ipv4.into(); let url_str = ipv4.to_string();
if !IP_BLOCKLIST.is_allowed(&ipv4.to_string()) { if !IP_BLOCKLIST.is_allowed(&url_str) {
return Err(create_error!(InvalidOperation));
}
}
Host::Ipv6(ipv6) => {
resolved_address = ipv6.into();
if !IP_BLOCKLIST.is_allowed(&ipv6.to_string()) {
return Err(create_error!(InvalidOperation)); return Err(create_error!(InvalidOperation));
} }
} }
Host::Domain(domain) => { Host::Domain(domain) => {
let domain = domain.to_string(); let mut domain = domain.to_string();
let config = config().await; let config = config().await;
@@ -447,22 +372,14 @@ impl Request {
return Err(create_error!(InvalidOperation)); return Err(create_error!(InvalidOperation));
} }
if !domain.contains(":") {
domain += ":80";
}
// Second step: resolve the IP and check the blocklist // Second step: resolve the IP and check the blocklist
let resolver = CachedDnsResolver {}; if let Ok(mut resolved_ip) = tokio::net::lookup_host(domain.clone()).await {
if let Ok(mut resolved_ip) = resolver
.resolve(
Name::from_str(&domain)
.map_err(|_| create_error!(ProxyError))
.unwrap(),
)
.await
{
if let Some(resolved_ip) = resolved_ip.next() { if let Some(resolved_ip) = resolved_ip.next() {
resolved_address = resolved_ip.ip(); if !IP_BLOCKLIST.is_allowed(&resolved_ip.ip().to_string()) {
let resolved_string = resolved_address.to_string();
if !IP_BLOCKLIST.is_allowed(&resolved_string)
|| resolved_string.contains("::ffff:")
{
return Err(create_error!(InvalidOperation)); return Err(create_error!(InvalidOperation));
} }
} else { } else {
@@ -472,15 +389,10 @@ impl Request {
return Err(create_error!(ProxyError)); return Err(create_error!(ProxyError));
} }
} }
_ => (),
} }
} else {
return Err(create_error!(ProxyError));
}; };
Ok(IPRequest { Ok(false)
url: url.clone(),
ip: resolved_address,
blocked: false,
})
} }
} }
+1 -1
View File
@@ -1 +1 @@
0.13.5 0.12.1