Merge remote-tracking branch 'origin/main' into feat/audit-log
Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
@@ -15,7 +15,7 @@ mongodb = ["dep:mongodb", "bson"]
|
||||
|
||||
# ... Other
|
||||
tasks = ["isahc", "linkify", "url-escape"]
|
||||
async-std-runtime = ["async-std"]
|
||||
tokio-runtime = ["tokio"]
|
||||
rocket-impl = [
|
||||
"rocket",
|
||||
"schemars",
|
||||
@@ -27,7 +27,7 @@ redis-is-patched = ["revolt-presence/redis-is-patched"]
|
||||
voice = ["livekit-api", "livekit-protocol", "livekit-runtime"]
|
||||
|
||||
# Default Features
|
||||
default = ["mongodb", "async-std-runtime", "tasks"]
|
||||
default = ["mongodb", "tokio-runtime", "tasks"]
|
||||
|
||||
[dependencies]
|
||||
# Core
|
||||
@@ -64,7 +64,7 @@ serde = { workspace = true }
|
||||
iso8601-timestamp = { workspace = true, features = ["serde", "bson"] }
|
||||
|
||||
# Events
|
||||
redis-kiss = { workspace = true }
|
||||
redis-kiss = { workspace = true, default-features = false, features = ["tokio-runtime"] }
|
||||
|
||||
# Database
|
||||
bson = { workspace = true, optional = true }
|
||||
@@ -81,7 +81,7 @@ async-trait = { workspace = true }
|
||||
async-recursion = { workspace = true }
|
||||
|
||||
# Async
|
||||
async-std = { workspace = true, features = ["attributes"], optional = true }
|
||||
tokio = { workspace = true, optional = true }
|
||||
|
||||
# Axum Impl
|
||||
axum = { workspace = true, optional = true }
|
||||
|
||||
@@ -25,8 +25,8 @@ pub use mongodb;
|
||||
#[macro_use]
|
||||
extern crate bson;
|
||||
|
||||
#[cfg(not(feature = "async-std-runtime"))]
|
||||
compile_error!("async-std-runtime feature must be enabled.");
|
||||
#[cfg(not(feature = "tokio-runtime"))]
|
||||
compile_error!("tokio-runtime feature must be enabled.");
|
||||
|
||||
#[macro_export]
|
||||
#[cfg(debug_assertions)]
|
||||
|
||||
@@ -11,7 +11,7 @@ auto_derived!(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn migrate() {
|
||||
database_test!(|db| async move {
|
||||
// Initialise the database
|
||||
|
||||
@@ -452,7 +452,7 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
|
||||
warn!("This is a destructive operation and will wipe existing permission data (excl. defaults for SendMessage).");
|
||||
warn!("Taking a backup is advised.");
|
||||
warn!("Continuing in 10 seconds...");
|
||||
async_std::task::sleep(Duration::from_secs(10)).await;
|
||||
tokio::time::sleep(Duration::from_secs(10)).await;
|
||||
|
||||
let servers = db.col::<Document>("servers");
|
||||
let mut cursor = servers.find(doc! {}).await.unwrap();
|
||||
|
||||
@@ -164,7 +164,7 @@ impl Bot {
|
||||
mod tests {
|
||||
use crate::{Bot, FieldsBot, PartialBot, User};
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn crud() {
|
||||
database_test!(|db| async move {
|
||||
let owner = User::create(&db, "Owner".to_string(), None, None)
|
||||
|
||||
@@ -128,7 +128,7 @@ impl Webhook {
|
||||
mod tests {
|
||||
use crate::{FieldsWebhook, PartialWebhook, Webhook};
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn crud() {
|
||||
database_test!(|db| async move {
|
||||
let webhook_id = "webhook";
|
||||
|
||||
@@ -898,7 +898,7 @@ mod tests {
|
||||
|
||||
use crate::{fixture, util::permissions::DatabasePermissionQuery};
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn permissions_group_channel() {
|
||||
database_test!(|db| async move {
|
||||
fixture!(db, "group_with_members",
|
||||
@@ -924,7 +924,7 @@ mod tests {
|
||||
});
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn permissions_text_channel() {
|
||||
database_test!(|db| async move {
|
||||
fixture!(db, "server_with_roles",
|
||||
|
||||
@@ -340,7 +340,7 @@ mod tests {
|
||||
|
||||
use crate::{Member, PartialMember, RemovalIntention, Server, User};
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn muted_member_rejoin() {
|
||||
database_test!(|db| async move {
|
||||
match db {
|
||||
|
||||
@@ -464,7 +464,7 @@ mod tests {
|
||||
|
||||
use crate::{fixture, util::permissions::DatabasePermissionQuery};
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn permissions() {
|
||||
database_test!(|db| async move {
|
||||
fixture!(db, "server_with_roles",
|
||||
|
||||
@@ -926,7 +926,7 @@ mod tests {
|
||||
assert!(User::validate_username(username_https).is_err());
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn username_sanitisation_clean() {
|
||||
let username_clean = "Test";
|
||||
|
||||
@@ -936,7 +936,7 @@ mod tests {
|
||||
assert_eq!(username_clean, username_clean_sanitised.unwrap());
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn username_sanitisation_homoglyphs() {
|
||||
let username_homoglyphs = "𝔽𝕌Ňℕy";
|
||||
|
||||
@@ -947,7 +947,7 @@ mod tests {
|
||||
assert_eq!("funny", username_homoglyphs_sanitised);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn username_sanitisation_padding() {
|
||||
let username_padding = "a";
|
||||
|
||||
@@ -956,7 +956,7 @@ mod tests {
|
||||
assert_eq!("a_", username);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn create_user() {
|
||||
use revolt_result::Result;
|
||||
|
||||
|
||||
@@ -305,6 +305,6 @@ pub async fn worker(db: Database, amqp: AMQP) {
|
||||
}
|
||||
|
||||
// Sleep for an arbitrary amount of time.
|
||||
async_std::task::sleep(Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,6 @@ pub async fn worker(db: Database) {
|
||||
}
|
||||
|
||||
// Sleep for an arbitrary amount of time.
|
||||
async_std::task::sleep(Duration::from_secs(1)).await;
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::{Database, AMQP};
|
||||
|
||||
use async_std::task;
|
||||
use tokio::task;
|
||||
use std::time::Instant;
|
||||
|
||||
const WORKER_COUNT: usize = 5;
|
||||
|
||||
@@ -7,11 +7,11 @@ use revolt_config::config;
|
||||
use revolt_result::Result;
|
||||
|
||||
use async_lock::Semaphore;
|
||||
use async_std::task::spawn;
|
||||
use deadqueue::limited::Queue;
|
||||
use once_cell::sync::Lazy;
|
||||
use revolt_models::v0::Embed;
|
||||
use std::{collections::HashSet, sync::Arc};
|
||||
use tokio::task::spawn;
|
||||
|
||||
use isahc::prelude::*;
|
||||
|
||||
@@ -159,6 +159,7 @@ pub async fn generate(
|
||||
.await
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.flatten()
|
||||
.collect::<Vec<Embed>>();
|
||||
|
||||
// Prevent database update when no embeds are found.
|
||||
|
||||
@@ -5,7 +5,7 @@ use revolt_result::{create_error, Result};
|
||||
#[cfg(feature = "rocket-impl")]
|
||||
use revolt_result::Error;
|
||||
|
||||
use async_std::sync::Mutex;
|
||||
use tokio::sync::Mutex;
|
||||
use once_cell::sync::Lazy;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user