Compare commits
3
Commits
20251020-1
...
20251022-3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20a4816235 | ||
|
|
6ba48a0197 | ||
|
|
47002ec81c |
No files matched your search
@@ -295,7 +295,9 @@ pub enum EventV1 {
|
|||||||
},
|
},
|
||||||
UserMoveVoiceChannel {
|
UserMoveVoiceChannel {
|
||||||
node: String,
|
node: String,
|
||||||
token: String
|
from: String,
|
||||||
|
to: String,
|
||||||
|
token: String,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ struct MigrationInfo {
|
|||||||
revision: i32,
|
revision: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const LATEST_REVISION: i32 = 48; // MUST BE +1 to last migration
|
pub const LATEST_REVISION: i32 = 49; // MUST BE +1 to last migration
|
||||||
|
|
||||||
pub async fn migrate_database(db: &MongoDb) {
|
pub async fn migrate_database(db: &MongoDb) {
|
||||||
let migrations = db.col::<Document>("migrations");
|
let migrations = db.col::<Document>("migrations");
|
||||||
@@ -1246,8 +1246,8 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
|
|||||||
.expect("Failed to update voice channels");
|
.expect("Failed to update voice channels");
|
||||||
};
|
};
|
||||||
|
|
||||||
if revision <= 47 {
|
if revision <= 48 {
|
||||||
info!("Running migration [revision 47 / 29-04-2025]: Add Video to default permissions");
|
info!("Running migration [revision 48 / 22-10-2025]: Add Video + Listen to default permissions");
|
||||||
|
|
||||||
db.col::<Document>("servers")
|
db.col::<Document>("servers")
|
||||||
.update_many(
|
.update_many(
|
||||||
@@ -1255,7 +1255,7 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
|
|||||||
doc! {
|
doc! {
|
||||||
"$bit": {
|
"$bit": {
|
||||||
"default_permissions": {
|
"default_permissions": {
|
||||||
"or": ChannelPermission::Video as i64
|
"or": (ChannelPermission::Video + ChannelPermission::Speak + ChannelPermission::Listen) as i64
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ pub async fn ingress(
|
|||||||
if disconnect {
|
if disconnect {
|
||||||
log::debug!("Removing user {user_id} from channel {channel_id} {event:?} due to forbidden track.");
|
log::debug!("Removing user {user_id} from channel {channel_id} {event:?} due to forbidden track.");
|
||||||
|
|
||||||
voice_client.remove_user(node, user_id, channel_id).await?;
|
let _ = voice_client.remove_user(node, user_id, channel_id).await;
|
||||||
delete_voice_state(channel_id, channel.server(), user_id).await?;
|
delete_voice_state(channel_id, channel.server(), user_id).await?;
|
||||||
|
|
||||||
return Ok(EmptyResponse);
|
return Ok(EmptyResponse);
|
||||||
|
|||||||
@@ -22,10 +22,11 @@ pub async fn delete_bot(
|
|||||||
bot.delete(db).await?;
|
bot.delete(db).await?;
|
||||||
|
|
||||||
for channel_id in get_user_voice_channels(&bot.id).await? {
|
for channel_id in get_user_voice_channels(&bot.id).await? {
|
||||||
let node = get_channel_node(&channel_id).await?.unwrap();
|
if let Some(node) = get_channel_node(&channel_id).await? {
|
||||||
let channel = Reference::from_unchecked(&channel_id).as_channel(db).await?;
|
let _ = voice_client.remove_user(&node, &bot.id, &channel_id).await;
|
||||||
|
}
|
||||||
|
|
||||||
voice_client.remove_user(&node, &bot.id, &channel_id).await?;
|
let channel = Reference::from_unchecked(&channel_id).as_channel(db).await?;
|
||||||
|
|
||||||
delete_voice_state(&channel_id, channel.server(), &bot.id).await?;
|
delete_voice_state(&channel_id, channel.server(), &bot.id).await?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,10 @@ pub async fn remove_member(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if is_in_voice_channel(&user.id, channel.id()).await? {
|
if is_in_voice_channel(&user.id, channel.id()).await? {
|
||||||
let node = get_channel_node(channel.id()).await?.unwrap();
|
if let Some(node) = get_channel_node(channel.id()).await? {
|
||||||
|
let _ = voice_client.remove_user(&node, &user.id, channel.id()).await;
|
||||||
|
}
|
||||||
|
|
||||||
voice_client.remove_user(&node, &user.id, channel.id()).await?;
|
|
||||||
delete_voice_state(channel.id(), None, &user.id).await?;
|
delete_voice_state(channel.id(), None, &user.id).await?;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -79,15 +79,15 @@ pub async fn call(
|
|||||||
// should only ever loop once but just to cover our backs.
|
// should only ever loop once but just to cover our backs.
|
||||||
|
|
||||||
for channel_id in get_user_voice_channels(&user.id).await? {
|
for channel_id in get_user_voice_channels(&user.id).await? {
|
||||||
let node = get_channel_node(&channel_id).await?.unwrap();
|
if let Some(node) = get_channel_node(&channel_id).await? {
|
||||||
|
// if this errors its just a mismatching state - ignore and proceed to still delete our state
|
||||||
|
let _ = voice_client.remove_user(&node, &user.id, &channel_id).await;
|
||||||
|
};
|
||||||
|
|
||||||
let channel = Reference::from_unchecked(&channel_id)
|
let channel = Reference::from_unchecked(&channel_id)
|
||||||
.as_channel(db)
|
.as_channel(db)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
voice_client
|
|
||||||
.remove_user(&node, &user.id, &channel_id)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
delete_voice_state(&channel_id, channel.server(), &user.id).await?;
|
delete_voice_state(&channel_id, channel.server(), &user.id).await?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ pub async fn ban(
|
|||||||
|
|
||||||
// If the member is in a voice channel while banned kick them from the voice channel
|
// If the member is in a voice channel while banned kick them from the voice channel
|
||||||
if let Some(channel_id) = get_user_voice_channel_in_server(&user.id, &server.id).await? {
|
if let Some(channel_id) = get_user_voice_channel_in_server(&user.id, &server.id).await? {
|
||||||
let node = get_channel_node(&channel_id).await?.unwrap();
|
if let Some(node) = get_channel_node(&channel_id).await? {
|
||||||
|
let _ = voice_client.remove_user(&node, &user.id, &channel_id).await;
|
||||||
voice_client.remove_user(&node, &user.id, &channel_id).await?;
|
}
|
||||||
|
|
||||||
delete_voice_state(&channel_id, Some(&server.id), &user.id).await?
|
delete_voice_state(&channel_id, Some(&server.id), &user.id).await?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,6 +217,8 @@ pub async fn edit(
|
|||||||
|
|
||||||
EventV1::UserMoveVoiceChannel {
|
EventV1::UserMoveVoiceChannel {
|
||||||
node: new_node,
|
node: new_node,
|
||||||
|
from: channel,
|
||||||
|
to: new_voice_channel.id().to_string(),
|
||||||
token,
|
token,
|
||||||
}
|
}
|
||||||
.p_user(target_user.id.clone(), db)
|
.p_user(target_user.id.clone(), db)
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ pub async fn kick(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if let Some(channel_id) = get_user_voice_channel_in_server(&user.id, &server.id).await? {
|
if let Some(channel_id) = get_user_voice_channel_in_server(&user.id, &server.id).await? {
|
||||||
let node = get_channel_node(&channel_id).await?.unwrap();
|
if let Some(node) = get_channel_node(&channel_id).await? {
|
||||||
|
let _ = voice_client.remove_user(&node, &user.id, &channel_id).await;
|
||||||
voice_client.remove_user(&node, &user.id, &channel_id).await?;
|
}
|
||||||
|
|
||||||
delete_voice_state(&channel_id, Some(&server.id), &user.id).await?;
|
delete_voice_state(&channel_id, Some(&server.id), &user.id).await?;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ pub async fn delete(
|
|||||||
} else {
|
} else {
|
||||||
if let Some(channel_id) = get_user_voice_channel_in_server(&user.id, &server.id).await? {
|
if let Some(channel_id) = get_user_voice_channel_in_server(&user.id, &server.id).await? {
|
||||||
if server.channels.iter().any(|c| c == &channel_id) {
|
if server.channels.iter().any(|c| c == &channel_id) {
|
||||||
let node = get_channel_node(&channel_id).await?.unwrap();
|
if let Some(node) = get_channel_node(&channel_id).await? {
|
||||||
|
let _ = voice_client.remove_user(&node, &user.id, &channel_id).await;
|
||||||
voice_client.remove_user(&node, &user.id, &channel_id).await?;
|
}
|
||||||
|
|
||||||
delete_voice_state(&channel_id, Some(&server.id), &user.id).await?;
|
delete_voice_state(&channel_id, Some(&server.id), &user.id).await?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user