add: last_online and online indicators

This commit is contained in:
trisua 2025-04-02 14:11:01 -04:00
parent d3d0c41334
commit e0a6072cc4
12 changed files with 177 additions and 9 deletions

View file

@ -196,6 +196,24 @@ pub async fn update_user_role_request(
}
}
/// Update the current user's last seen value.
pub async fn seen_request(jar: CookieJar, Extension(data): Extension<State>) -> impl IntoResponse {
let data = &(data.read().await).0;
let user = match get_user_from_token!(jar, data) {
Some(ua) => ua,
None => return Json(Error::NotAllowed.into()),
};
match data.seen_user(&user).await {
Ok(_) => Json(ApiReturn {
ok: true,
message: "User updated".to_string(),
payload: (),
}),
Err(e) => Json(e.into()),
}
}
/// Delete the given user.
pub async fn delete_user_request(
jar: CookieJar,

View file

@ -147,6 +147,7 @@ pub fn routes() -> Router {
"/auth/profile/{id}/verified",
post(auth::profile::update_user_is_verified_request),
)
.route("/auth/profile/me/seen", post(auth::profile::seen_request))
.route(
"/auth/profile/find/{id}",
get(auth::profile::redirect_from_id),