This commit is contained in:
Joscha 2024-03-31 00:22:00 +01:00
parent 1c56349b56
commit 28c44b526c
3 changed files with 54 additions and 2 deletions

View file

@ -29,7 +29,7 @@ pub async fn run(tx: mpsc::Sender<Command>, addr: String) -> anyhow::Result<()>
.route("/calendar", post(post_calendar))
.route("/cells", post(post_cells))
.route("/chat_message", post(post_chat_message))
.route("/egg", post(post_egg))
.route("/egg", post(post_egg).fallback(get_static_file))
.route("/image", post(post_image).fallback(get_static_file))
.route("/photo", post(post_photo).fallback(get_static_file))
.route("/text", post(post_text))
@ -100,8 +100,9 @@ async fn post_chat_message(server: State<Server>, request: Form<PostChatMessageF
// /egg
async fn post_egg(server: State<Server>) {
async fn post_egg(server: State<Server>) -> impl IntoResponse {
let _ = server.tx.send(Command::draw(EggDrawing)).await;
Redirect::to("egg")
}
// /image

View file

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Osterei</title>
<style>
body {
background-color: black;
}
button {
position: absolute;
left: 50%;
top: 50%;
translate: -50% -50%;
padding: 10px;
border: none;
background-color: #0000;
cursor: pointer;
}
button svg {
width: calc(min(80vw, 80svh / 6 * 4));
height: calc(min(80svh, 80vw / 4 * 6));
}
button:hover path {
fill: #db9;
}
button:active path {
fill: #a75;
}
</style>
</head>
<body>
<form method="post">
<button>
<svg viewBox="-2 0 4 6">
<path
fill="#fff"
d="M0,0 C1,0,2,2,2,3.5 S1,6,0,6 S-2,5,-2,3.5 S-1,0,0,0"
/>
</svg>
</button>
</form>
</body>
</html>

View file

@ -10,6 +10,7 @@
<ul>
<li><a href="image">Upload an image</a></li>
<li><a href="photo">Take a photo</a></li>
<li><a href="egg">Osterei</a></li>
</ul>
</body>
</html>