Add WS debug console

This commit is contained in:
2025-02-11 21:57:34 +01:00
parent 558d5cda3f
commit b8a8e14f3c
6 changed files with 318 additions and 173 deletions

View File

@ -223,3 +223,22 @@ pub async fn sign_out(session: Session) -> HttpResult {
.insert_header(("location", "/"))
.finish())
}
#[derive(askama::Template)]
#[template(path = "ws_debug.html")]
struct WsDebugTemplate {
name: String,
}
/// WebSocket debug
pub async fn ws_debug(session: Session) -> HttpResult {
let Some(user): Option<User> = session.get(USER_SESSION_KEY)? else {
return Ok(HttpResponse::Found()
.insert_header(("location", "/"))
.finish());
};
Ok(HttpResponse::Ok()
.content_type("text/html")
.body(WsDebugTemplate { name: user.name }.render().unwrap()))
}