feat: implement session last_seen update

This commit is contained in:
Jef Roosens 2025-03-15 20:59:00 +01:00
parent 330877c8c5
commit f00d842bad
No known key found for this signature in database
GPG key ID: 21FD3D77D56BAF49
4 changed files with 35 additions and 5 deletions

View file

@ -47,10 +47,15 @@ pub async fn auth_middleware(State(ctx): State<Context>, mut req: Request, next:
.get(SESSION_ID_COOKIE)
.and_then(|c| c.value().parse::<i64>().ok())
{
let ctx_clone = ctx.clone();
match tokio::task::spawn_blocking(move || ctx_clone.store.validate_session(session_id))
.await
.unwrap()
let ctx = ctx.clone();
match tokio::task::spawn_blocking(move || {
let session = ctx.store.get_session(session_id)?;
ctx.store.refresh_session(&session)?;
Ok(session)
})
.await
.unwrap()
{
Ok(session) => {
auth_user = Some(session.user);