ass
confusedbread confuseddbread@gmail.com
Thu, 03 Jul 2025 15:14:01 +0200
1 files changed,
10 insertions(+),
3 deletions(-)
jump to
M
src/main.rs
→
src/main.rs
@@ -11,6 +11,12 @@ href: String,
class: String } +#[cfg(debug_assertions)] +const URL: &str = "http://localhost:5050"; + +#[cfg(not(debug_assertions))] +const URL: &str = "https://kate.breadlabs.de/api"; + fn head(page_title: &str) -> Markup { html! { (DOCTYPE)@@ -56,7 +62,7 @@ NavElement{ name: "waf".to_string(), href: "/waf".to_string(), class: String::from("navElement")},
], current)) - div class="htmx-indicator nowPlaying loading" hx-get="http://localhost:5050/now-playing" hx-swap="outerHTML" hx-trigger="load" { ". . ." } + div class="htmx-indicator nowPlaying loading" hx-get={(format!("{}/now-playing", URL))} hx-swap="outerHTML" hx-trigger="load" { ". . ." } } ) }@@ -88,10 +94,10 @@ fn boop() -> Markup {
html! { h1 { "Boop me" } div class="boop timestamp" { (format!("boops since {}:",Local::now().format("%d/%m/%Y %H:%M UTC%Z"))) } - div class="boop counter" #boop-counter hx-get="http://localhost:5050/boop" hx-trigger="load" {} + div class="boop counter" #boop-counter hx-get={(format!("{}/boop", URL))} hx-trigger="load" {} div class="boop stack" { img class="boop unboop" src="./static/neodog.png" {} - button class="boop button" hx-post="http://localhost:5050/boop" hx-trigger="mousedown throttle:300ms" hx-swap="swap:275ms" hx-target="#boop-counter" {} + button class="boop button" hx-post={(format!("{}/boop", URL))} hx-trigger="mousedown throttle:300ms" hx-swap="swap:275ms" hx-target="#boop-counter" {} } } }@@ -137,6 +143,7 @@ }
#[actix_web::main] async fn main() -> io::Result<()> { + HttpServer::new(|| App::new() .service(breadsite_index) .service(breadsite_boop)