Bump: 0.5.1 : persistent session cookie

This commit is contained in:
2026-08-16 15:06:55 +01:00
parent 0c6705badd
commit 80368b3ea5
3 changed files with 16 additions and 14 deletions
Generated
+2 -1
View File
@@ -2906,7 +2906,7 @@ dependencies = [
[[package]] [[package]]
name = "server" name = "server"
version = "0.4.0" version = "0.5.1"
dependencies = [ dependencies = [
"argon2", "argon2",
"async-broadcast", "async-broadcast",
@@ -2930,6 +2930,7 @@ dependencies = [
"symphonia", "symphonia",
"sysinfo", "sysinfo",
"thiserror 2.0.18", "thiserror 2.0.18",
"time",
"tokio", "tokio",
"tower-http", "tower-http",
"tracing", "tracing",
+2 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "server" name = "server"
version = "0.5.0" version = "0.5.1"
edition = "2024" edition = "2024"
[target.x86_64-unknown-linux-gnu] [target.x86_64-unknown-linux-gnu]
@@ -35,6 +35,7 @@ symphonia = { version = "0.5", features = ["aac"] }
opus = "0.3.1" opus = "0.3.1"
rubato = "3.0.0" rubato = "3.0.0"
chrono = "0.4.45" chrono = "0.4.45"
time = "0.3"
regex = "1" regex = "1"
thiserror = "2.0.18" thiserror = "2.0.18"
sysinfo = "0.36" sysinfo = "0.36"
+12 -12
View File
@@ -375,19 +375,19 @@ where
fn cookie_for_token(token: &str, dev: bool) -> Cookie<'static> { fn cookie_for_token(token: &str, dev: bool) -> Cookie<'static> {
let token = token.to_owned(); let token = token.to_owned();
match dev { let mut cookie = Cookie::build(("session", token))
true => Cookie::build(("session", token)) .path("/")
.path("/") .http_only(true)
.http_only(true) .max_age(time::Duration::days(30))
.same_site(axum_extra::extract::cookie::SameSite::None) .same_site(if dev {
.build(), axum_extra::extract::cookie::SameSite::None
false => Cookie::build(("session", token)) } else {
.path("/") axum_extra::extract::cookie::SameSite::Lax
.http_only(true) });
// .max_age(Duration::from_hours(999999)) if dev {
.same_site(axum_extra::extract::cookie::SameSite::Lax) cookie = cookie.secure(true);
.build(),
} }
cookie.build()
} }
#[axum::debug_handler] #[axum::debug_handler]