Fix messages
This commit is contained in:
@@ -53,7 +53,7 @@ impl MessageStore {
|
|||||||
author_pubkey TEXT NOT NULL,
|
author_pubkey TEXT NOT NULL,
|
||||||
content TEXT NOT NULL,
|
content TEXT NOT NULL,
|
||||||
timestamp INTEGER 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| {
|
self.with_channel(channel_id, |conn| {
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"INSERT INTO messages (id, author_pubkey, content, timestamp, signature)
|
"INSERT INTO messages (id, author_pubkey, content, timestamp, signature)
|
||||||
VALUES (?1, ?2, ?3, ?4, ?5, ?6)",
|
VALUES (?1, ?2, ?3, ?4, ?5)",
|
||||||
params![
|
params![
|
||||||
msg.id,
|
msg.id,
|
||||||
msg.author,
|
msg.author,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use crate::data::messages::{MessageData, StoredMessage};
|
use crate::data::messages::{MessageData, StoredMessage};
|
||||||
use crate::server::Server;
|
use crate::server::Server;
|
||||||
use axum::extract::ws::WebSocket;
|
use axum::extract::ws::WebSocket;
|
||||||
use ed25519_dalek::{Signature, Verifier, VerifyingKey};
|
use ed25519_dalek::{Verifier, VerifyingKey};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
@@ -9,7 +9,7 @@ use tokio::sync::Mutex;
|
|||||||
pub async fn send_message(
|
pub async fn send_message(
|
||||||
server: &Arc<Server>,
|
server: &Arc<Server>,
|
||||||
verifying_key: VerifyingKey,
|
verifying_key: VerifyingKey,
|
||||||
socket: &Arc<Mutex<WebSocket>>,
|
_socket: &Arc<Mutex<WebSocket>>,
|
||||||
message: MessageData,
|
message: MessageData,
|
||||||
channel_id: String,
|
channel_id: String,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ impl Server {
|
|||||||
key: crate::signature::get().await?,
|
key: crate::signature::get().await?,
|
||||||
config: Config::get().await?,
|
config: Config::get().await?,
|
||||||
clients: Mutex::new(HashMap::new()),
|
clients: Mutex::new(HashMap::new()),
|
||||||
message_store: MessageStore::new(PathBuf::from("item"))?,
|
message_store: MessageStore::new(PathBuf::from("messages"))?,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -1,9 +1,14 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[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)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ServerMeta {
|
pub struct ServerMeta {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user