From 03b584a042a890746481e9743ad572236e51763c Mon Sep 17 00:00:00 2001 From: Doloro1978 Date: Fri, 3 Jul 2026 12:33:51 +0100 Subject: [PATCH] fix: session cookie not saving --- crates/server/src/http.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/crates/server/src/http.rs b/crates/server/src/http.rs index e6dd92e..cd81b40 100644 --- a/crates/server/src/http.rs +++ b/crates/server/src/http.rs @@ -74,6 +74,7 @@ impl HttpServer { "/api/stream-key", post(create_stream_key_handler).get(get_all_stream_keys), ) + // .route("/api/admin/server_stats", get(todo!())) .route("/api/whip", post(handle_whip_injest)) .route("/api/login", post(login_handler)) .route("/api/stream/{slug}", post(stream_handler)) @@ -184,11 +185,20 @@ async fn create_stream_key_handler( .unwrap() .len(); if payload.label.is_empty() || payload.label.len() > MAX_LABEL_LEN { - warn!(user_id = auth.0.id, label_len = payload.label.len(), max = MAX_LABEL_LEN, "stream key creation rejected: label length invalid"); + warn!( + user_id = auth.0.id, + label_len = payload.label.len(), + max = MAX_LABEL_LEN, + "stream key creation rejected: label length invalid" + ); return StatusCode::UNPROCESSABLE_ENTITY; } if key_amount >= auth.0.stream_key_limit.try_into().unwrap() { - warn!(user_id = auth.0.id, limit = auth.0.stream_key_limit, "stream key limit reached"); + warn!( + user_id = auth.0.id, + limit = auth.0.stream_key_limit, + "stream key limit reached" + ); return StatusCode::NOT_ACCEPTABLE; } let key = stream_key::Entity::create(&state.db, auth.0.id, value, payload.label, false).await; @@ -255,7 +265,7 @@ async fn login_handler( let mut meow = Response::new("".to_string()); meow.headers_mut().insert( SET_COOKIE, - format!("session={token}; HttpOnly; SameSite=Strict; Path=/") + format!("session={token}; SameSite=Strict; Path=/; Max-Age=2592000") .parse() .unwrap(), );