Add WS debug console
This commit is contained in:
@ -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()))
|
||||
}
|
||||
|
Reference in New Issue
Block a user