From f018534156ec492f1886ce47466a41097182dbaa Mon Sep 17 00:00:00 2001 From: Zachery Aaron Shores-Chmielewski Date: Fri, 6 Feb 2026 23:53:15 +0700 Subject: [PATCH] feat: better page layout, contact page Move the message box and such around, fix the contact page --- crates/cli/src/main.rs | 16 +- crates/server/bin/main.rs | 6 +- routes/contact/index.html | 336 +++++++++++------------------- routes/contact/message/index.html | 312 +++++++++++++++++++++++++++ routes/root/index.html | 2 +- 5 files changed, 450 insertions(+), 222 deletions(-) create mode 100644 routes/contact/message/index.html diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 7608ee4..07c6625 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -313,7 +313,21 @@ fn build() { let pubkey_file = "target/public_keys.json"; if !std::path::Path::new(pubkey_file).exists() { - panic!("No public key file. Please generate keys first."); + println!("No public keys found at {pubkey_file}. Generating keys automatically..."); + + let sk_out = ".local/secrets.json"; + let num_keys = 100; + + println!("Creating .local directory..."); + std::fs::create_dir_all(".local").expect("failed to create .local directory"); + + println!("Generating {num_keys} keypairs..."); + println!(" Public keys -> {pubkey_file}"); + println!(" Secret keys -> {sk_out}"); + message_tools::gen_keys::generate_keys_to_file(pubkey_file, sk_out, num_keys) + .expect("failed to generate keys"); + + println!("Key generation complete."); } let status = Command::new("mkdir") diff --git a/crates/server/bin/main.rs b/crates/server/bin/main.rs index 4abbb7e..f4bf5a3 100644 --- a/crates/server/bin/main.rs +++ b/crates/server/bin/main.rs @@ -65,11 +65,13 @@ async fn main() -> Result<()> { .route("/who", get(serve_path("./routes/who/index.html")?)) .route("/api/pubkey", get(async || select_key(&PUBLIC_KEYS))) .route("/contact", get(serve_path("./routes/contact/index.html")?)) + .route("/contact/message", get(serve_path("./routes/contact/message/index.html")?)) .route("/api/publish", post(publish_message)) .nest_service("/routes", ServeDir::new("./routes")); - // run our app with hyper, listening globally on port 3000 - let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); + let addr = "0.0.0.0:3000"; + let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); + println!("Server running at http://{addr}"); axum::serve(listener, app).await.unwrap(); Ok(()) diff --git a/routes/contact/index.html b/routes/contact/index.html index c2ab9e4..cc50bfa 100644 --- a/routes/contact/index.html +++ b/routes/contact/index.html @@ -3,247 +3,147 @@ - Input Form + Contact - - - -
-
-
- - -
+ -
- - -
- -
- - -
- -
- -
-
- -
-
- How to use ▼ -
-
-

- Tell me who you are, and add an optional password. If I do not - otherwise have your contact information, please tell me the best way - to reach you back. -

-
+
+
+

Contact

+
+ +
- + + diff --git a/routes/contact/message/index.html b/routes/contact/message/index.html new file mode 100644 index 0000000..37b5977 --- /dev/null +++ b/routes/contact/message/index.html @@ -0,0 +1,312 @@ + + + + + + Direct Message + + + + + + + + +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+
+ How to use ▼ +
+
+

+ Tell me who you are, and add an optional password. If I do not + otherwise have your contact information, please tell me the best way + to reach you back. +

+
+
+
+ + + + + + + diff --git a/routes/root/index.html b/routes/root/index.html index 052f0de..b554639 100755 --- a/routes/root/index.html +++ b/routes/root/index.html @@ -79,7 +79,7 @@