Fix messages

This commit is contained in:
2026-08-20 11:24:39 +02:00
parent 1dd75f489b
commit 4fe471243c
4 changed files with 11 additions and 6 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ impl MessageStore {
author_pubkey TEXT NOT NULL,
content TEXT NOT NULL,
timestamp INTEGER NOT NULL,
signature TEXT NOT NULL,
signature TEXT NOT NULL
)",
[],
)?;
@@ -74,7 +74,7 @@ impl MessageStore {
self.with_channel(channel_id, |conn| {
conn.execute(
"INSERT INTO messages (id, author_pubkey, content, timestamp, signature)
VALUES (?1, ?2, ?3, ?4, ?5, ?6)",
VALUES (?1, ?2, ?3, ?4, ?5)",
params![
msg.id,
msg.author,
+2 -2
View File
@@ -1,7 +1,7 @@
use crate::data::messages::{MessageData, StoredMessage};
use crate::server::Server;
use axum::extract::ws::WebSocket;
use ed25519_dalek::{Signature, Verifier, VerifyingKey};
use ed25519_dalek::{Verifier, VerifyingKey};
use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};
use tokio::sync::Mutex;
@@ -9,7 +9,7 @@ use tokio::sync::Mutex;
pub async fn send_message(
server: &Arc<Server>,
verifying_key: VerifyingKey,
socket: &Arc<Mutex<WebSocket>>,
_socket: &Arc<Mutex<WebSocket>>,
message: MessageData,
channel_id: String,
) -> anyhow::Result<()> {
+1 -1
View File
@@ -37,7 +37,7 @@ impl Server {
key: crate::signature::get().await?,
config: Config::get().await?,
clients: Mutex::new(HashMap::new()),
message_store: MessageStore::new(PathBuf::from("item"))?,
message_store: MessageStore::new(PathBuf::from("messages"))?,
}))
}
}
+6 -1
View File
@@ -1,9 +1,14 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClientMeta {}
#[serde(rename_all = "camelCase")]
pub struct ClientMeta {
pub display_name: String,
pub avatar: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ServerMeta {
pub name: String,
pub description: String,