hand

finger proxy server
Log | Files | Refs | README

commit b7181e0ad7ed38fb9e4a305815520f5109c58ab8
parent 1204988bbe282683d6d159fb9e09c92f817af4a8
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu,  2 Dec 2021 00:33:39 -0800

Improve style etc

Diffstat:
Msrc/main.rs | 34+++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -6,18 +6,42 @@ routes! { POST "/" => post; } -const form: &str = "<style> +const form: &str = r#"<style> +body { + background-color: #f7ffd6; +} +main { + max-width: 90ch; + padding: 2ch; + margin: auto; + font-family: monospace; + word-wrap: break-word; + background-color: #c2ffd2; + line-height: 1.5; + border: 1px solid black; +} +pre { + border: 1px solid black; + padding: 1ch; + white-space: pre-wrap; + background-color: #e3fffd; +} </style> -<h1>👉</h1> +<main> +<h1>👐finger.flounder.online👐</h1> <form method='POST'> -<input type='text' placeholder='e.g. alex@flounder.online' name='query'/> + 👉<input type='text' placeholder='e.g. alex@flounder.online' name='query'/> <input type='submit'/> -</form>"; +</form>"#; fn index(_: Request) -> &'static str { form } +// TODO: escape HTML +// TODO: error handling +// TODO: add permalink / url params +// add finger URI at bottom fn post(req: Request) -> String { let query = req.form("query").unwrap(); let user: &str; @@ -35,7 +59,7 @@ fn post(req: Request) -> String { .max_response_len(1024 * 10) .send() .unwrap(); - format!("{}\n<pre class='response'>{}</pre>", form, response) + format!("{}\n<pre class='response'>{}</pre></main>", form, response) } fn main() {