fix: get_voice_state has incorrect unique_key and allowed_sources should be lowercase

This commit is contained in:
Zomatree
2025-06-08 02:33:35 +01:00
parent 901ac56154
commit 95ca735b7b

View File

@@ -102,11 +102,11 @@ pub fn get_allowed_sources(permissions: PermissionValue) -> Vec<&'static str> {
let mut allowed_sources = Vec::new(); let mut allowed_sources = Vec::new();
if permissions.has(ChannelPermission::Speak as u64) { if permissions.has(ChannelPermission::Speak as u64) {
allowed_sources.push("MICROPHONE") allowed_sources.push("microphone")
}; };
if permissions.has(ChannelPermission::Video as u64) { if permissions.has(ChannelPermission::Video as u64) {
allowed_sources.extend(["CAMERA", "SCREEN_SHARE", "SCREEN_SHARE_AUDIO"]); allowed_sources.extend(["camera", "screen_share", "screen_share_audio"]);
}; };
allowed_sources allowed_sources
@@ -259,7 +259,7 @@ pub async fn get_voice_state(
server_id: Option<&str>, server_id: Option<&str>,
user_id: &str, user_id: &str,
) -> Result<Option<UserVoiceState>> { ) -> Result<Option<UserVoiceState>> {
let unique_key = format!("{}:{user_id}", server_id.unwrap_or(channel_id)); let unique_key = format!("{}:{}", user_id, server_id.unwrap_or(channel_id));
let (is_publishing, is_receiving, screensharing, camera) = get_connection() let (is_publishing, is_receiving, screensharing, camera) = get_connection()
.await? .await?