diff --git a/src/main.rs b/src/main.rs index 6734793..f8486ae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,11 +7,12 @@ use warp::{http::StatusCode, reject::Rejection, reply::{html, json, with_status, #[derive(Debug, Clone, Template)] #[template(path = "invite.html")] struct Invite { - pub name: String + pub name: String, + pub invitee: String } -async fn gen(name: String) -> Result, Rejection> { - let inv = Invite { name }; +async fn gen(name: String, invitee: String) -> Result, Rejection> { + let inv = Invite { name, invitee }; let rendered = inv.render(); if let Err(err) = rendered { Ok( @@ -26,6 +27,8 @@ async fn gen(name: String) -> Result, Rejection> { #[tokio::main] async fn main() { - let route = warp::path!("gen" / String).and_then(gen); - warp::serve(route).bind(env::var("LISTEN").unwrap_or("0.0.0.0:80".into()).parse::().expect("Invalid LISTEN url")).await; + let route = warp::path!("gen" / String / String).and_then(gen); + let url = env::var("LISTEN").unwrap_or("0.0.0.0:80".into()).parse::().expect("Invalid LISTEN url"); + println!("Listening on {url}"); + warp::serve(route).bind(url).await; } diff --git a/templates/invite.html b/templates/invite.html index db19644..8f7ea3a 100644 --- a/templates/invite.html +++ b/templates/invite.html @@ -16,7 +16,7 @@

you have been invited to join blek! cc!

- a trusted member {{ name }} has invited you to join blek! cc + a trusted member {{ name }} has invited you ({{ invitee }}) to join blek! cc

if you want to create an account, please follow these instructions: