From 9a581ed5fcc266ff705bda0274f43b7a9db6b36c Mon Sep 17 00:00:00 2001 From: deadvey Date: Sun, 31 May 2026 19:46:05 +0100 Subject: [PATCH] added a static directory --- src/main.rs | 5 ++- static/favicon.ico | Bin 0 -> 1962 bytes static/index.css | 25 +++++++++++ static/index.html | 67 +++++++++++++++++++++++++++++ static/leaderboard/index.html | 77 ++++++++++++++++++++++++++++++++++ 5 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 static/favicon.ico create mode 100644 static/index.css create mode 100644 static/index.html create mode 100644 static/leaderboard/index.html diff --git a/src/main.rs b/src/main.rs index 7870687..f9d7ffc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,6 +24,7 @@ use tokio:: sync::{Mutex, mpsc}, time::{Duration, sleep}, }; +use tower_http::services::ServeDir; use futures::StreamExt as _; use rand::random_bool; use serde::{Deserialize, Serialize, de}; @@ -130,11 +131,11 @@ async fn main() -> anyhow::Result<()> }); } + let static_files = ServeDir::new("./static"); let app = Router::new() - .route("/", get(index)) + .fallback_service(static_files) .route("/ws", get(ws_handler)) .route("/ws-leaderboard", get(leaderboard_handler)) - .route("/leaderboard", get(leaderboard)) .with_state (AppState { tx, diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..6dc66ea3bcdc36b6d581598d502d2fb6636083b4 GIT binary patch literal 1962 zcmZQzU}RuqFg6xoU}Runn8MD$AjZJJpuxbvV9db4kj4O#XJNn(x)~T4{^M6dSe8*x z5Qic`2oS)OW)u_@6jD+G$)ig$3JNMgfFg#$a497vML|?!k)+Ti8DR#(j772%|!q8v_HL@&!c_y4cz`zKi z4=^w=)IVVO-@w4YVE+J81IRyM_y;nX{{h1v5Y7I8;RlFjM$jKXe8vY14?r{nf(9AK zz>vUzPJ@hRU{GKnM1zeZf*@oLOdj1GFh07wVg5n)C(Qq_@Br74@<`zYG7uDgu<(S1 MFD$%a;SY@u0OAnfI{*Lx literal 0 HcmV?d00001 diff --git a/static/index.css b/static/index.css new file mode 100644 index 0000000..ce5843e --- /dev/null +++ b/static/index.css @@ -0,0 +1,25 @@ +#button { + background-color: red; + border: darkred solid 15px; + border-radius: 50%; + font-size: 50px; + padding: 100px; + width: 300px; + height: 300px; + font-family: monospace, arial; +} +#button:active { + background-color: red; + border: red solid 20px; +} +#score-table { + position: absolute; + top: 0px; + right: 0px; +} +td,tr,table,th { + border: black solid; +} +table { + border-collapse: collapse; +} diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..0c43ed2 --- /dev/null +++ b/static/index.html @@ -0,0 +1,67 @@ + + + + + + + +

Each time you press the button there's a 1/3 chance of returning to 0

+ +
+ + + diff --git a/static/leaderboard/index.html b/static/leaderboard/index.html new file mode 100644 index 0000000..a24d759 --- /dev/null +++ b/static/leaderboard/index.html @@ -0,0 +1,77 @@ + + + + + + + +

Hiscores

+

Highest achieved numbers before returning to 0

+
+

Loscores

+

Highest number of consecutive resets to 0

+
+

Userscores

+

Total number of resets and personal bests of each username

+
+ + +