- update: schema now sets the skills column to prevent a crash

- update: frontend to only pass the session id
- update: launcher to pass the session correctly
- update: validate session response now returns the session id and user id to the requester
- update: auth client based on session id instead of a jwt token
This commit is contained in:
2025-03-08 13:47:53 -05:00
parent b6f2d3f456
commit 8ba8fce20b
13 changed files with 151 additions and 79 deletions

View File

@@ -14,14 +14,18 @@ pub struct Packet {
}
pub trait PacketPayload {
fn encode(&self) -> Result<Vec<u8>, Box<dyn std::error::Error + Send + Sync>> where Self: Encode {
fn encode(&self) -> Result<Vec<u8>, Box<dyn std::error::Error + Send + Sync>>
where
Self: Encode,
{
let config = bincode::config::standard().with_fixed_int_encoding();
Ok(bincode::encode_to_vec(self, config)?)
}
fn decode(data: &[u8]) -> Result<Self, Box<dyn std::error::Error + Send + Sync>>
where
Self: Sized, Self: Decode<()>
Self: Sized,
Self: Decode<()>,
{
let config = bincode::config::standard().with_fixed_int_encoding();
Ok(bincode::decode_from_slice(data, config)?.0)
@@ -107,7 +111,7 @@ impl Packet {
pub async fn send_packet(stream: &mut TcpStream, packet: &Packet) -> Result<(), std::io::Error> {
let data = packet.to_raw();
debug!("Sending data: {:?}", data);
debug!("Sending '{:#X}' bytes of data. {:?}", data.len(), data);
stream.write_all(&data).await?;
Ok(())
}