Fix initial vc users

This commit is contained in:
2026-08-29 11:51:33 -04:00
parent 1436b229ce
commit c4ba1b19bb
2 changed files with 14 additions and 13 deletions
+12 -12
View File
@@ -5,11 +5,7 @@ use std::{
use ed25519_dalek::{Signer, VerifyingKey}; use ed25519_dalek::{Signer, VerifyingKey};
use crate::{ use crate::{server::Server, types::ClientMeta, ws::EnclaveWebSocket};
server::Server,
types::ClientMeta,
ws::EnclaveWebSocket,
};
use super::*; use super::*;
@@ -41,7 +37,9 @@ pub async fn initialize(
let server_timestamp = SystemTime::now().duration_since(UNIX_EPOCH)?.as_millis() as u64; let server_timestamp = SystemTime::now().duration_since(UNIX_EPOCH)?.as_millis() as u64;
if server_timestamp.saturating_sub(timestamp) > 2000 { if server_timestamp.saturating_sub(timestamp) > 2000 {
log::warn!("Client timestamp wasn't correct (server {server_timestamp}, client {timestamp})"); log::warn!(
"Client timestamp wasn't correct (server {server_timestamp}, client {timestamp})"
);
socket socket
.send(&ClientMethod::Error { .send(&ClientMethod::Error {
@@ -103,9 +101,11 @@ pub async fn initialize(
socket socket
.send(&ClientMethod::Initialized { .send(&ClientMethod::Initialized {
public_key: crate::crypto::to_string(&server.identity.key.verifying_key()), public_key: crate::crypto::to_string(&server.identity.key.verifying_key()),
signature: crate::crypto::to_string_sig(&server.identity.key.sign( signature: crate::crypto::to_string_sig(
format!("{server_timestamp}@{hostname}@{public_key_string}").as_bytes(), &server.identity.key.sign(
)), format!("{server_timestamp}@{hostname}@{public_key_string}").as_bytes(),
),
),
timestamp: server_timestamp, timestamp: server_timestamp,
hostname, hostname,
@@ -127,11 +127,11 @@ pub async fn initialize(
)); ));
}; };
for pin in server.voice.pins.lock().await.values() { for (pubkey, conn) in server.voice.participants.lock().await.iter() {
socket socket
.send(&ClientMethod::UserJoinedVoice { .send(&ClientMethod::UserJoinedVoice {
channel_id: pin.channel_id.clone(), channel_id: conn.channel_id.clone(),
pubkey: crate::crypto::to_string(&pin.pubkey), pubkey: crate::crypto::to_string(pubkey),
}) })
.await?; .await?;
} }
+1
View File
@@ -18,6 +18,7 @@ use crate::{
server::UserConnections, server::UserConnections,
}; };
#[derive(Debug)]
pub struct VoicePin { pub struct VoicePin {
pub pubkey: VerifyingKey, pub pubkey: VerifyingKey,
pub channel_id: String, pub channel_id: String,