diff options
| author | Jomar Milan <jomarm@jomarm.com> | 2026-06-09 17:15:24 -0700 |
|---|---|---|
| committer | Jomar Milan <jomarm@jomarm.com> | 2026-06-09 17:15:24 -0700 |
| commit | acf5e40d02a25a6e99ef23ef61aca8cd261de9d3 (patch) | |
| tree | eb7da2b27e8a47ac1005ded7a0d70f5579ab635b /src | |
| parent | 27e1ef1ad8d7d834054b750708343378ce9e9ec5 (diff) | |
Add player hand display in browser
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 5 | ||||
| -rw-r--r-- | src/play.rs | 2 | ||||
| -rw-r--r-- | src/session.rs | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index d9852e3..fc0a7bb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,6 +65,7 @@ async fn serve_static(Path(path): Path<String>) -> Response { Some(content) => { let mime = match path.split('.').next_back() { Some("js") => "application/javascript", + Some("css") => "text/css", _ => "application/octet-stream", }; ([(header::CONTENT_TYPE, mime)], content.data).into_response() @@ -73,7 +74,9 @@ async fn serve_static(Path(path): Path<String>) -> Response { } } -async fn find_session(Query(query): Query<HashMap<String, String>>) -> axum::response::Result<Redirect> { +async fn find_session( + Query(query): Query<HashMap<String, String>>, +) -> axum::response::Result<Redirect> { let id = query.get("id").ok_or(StatusCode::NOT_FOUND)?; Ok(Redirect::to(format!("/session/{}", id).as_str())) } diff --git a/src/play.rs b/src/play.rs index 574e8b8..e08a895 100644 --- a/src/play.rs +++ b/src/play.rs @@ -34,7 +34,7 @@ pub async fn handle_play(mut socket: WebSocket, app_state: Arc<AppState>) { // Blocked so that the guard is dropped after cloning the color names, // preventing a potential deadlock when using .await after sending something // through the socket, which would be possible if using tokio::sync::Mutex. - // Of course, the sessions HashMap is wrapped instd::sync types instead, which + // Of course, the sessions HashMap is wrapped in std::sync types instead, which // does not enable locking the mutex through .await anyway. let colors: Vec<String> = { let sessions = app_state.sessions.read().unwrap(); diff --git a/src/session.rs b/src/session.rs index 6aeee9f..e472adf 100644 --- a/src/session.rs +++ b/src/session.rs @@ -36,6 +36,8 @@ pub struct CustomDeck { /// Whether the card back should be used as the hidden image (instead of the last slot of the /// `face` image). back_is_hidden: bool, + /// ID of the custom card within the deck. + card_id: f64, } impl Session { |
