diff options
Diffstat (limited to 'src/server/mod.rs')
-rw-r--r-- | src/server/mod.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/server/mod.rs b/src/server/mod.rs index d9b3beb..81dc519 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -1,11 +1,11 @@ mod admin; mod config; +mod falx; mod login; -mod nginx_check; mod panel; mod store; -use std::{future::IntoFuture, path::PathBuf}; +use std::{future::IntoFuture, path::PathBuf, sync::Arc}; use axum::{ body::Body, @@ -16,6 +16,7 @@ use axum::{ Router, }; use axum_extra::extract::CookieJar; +use cursive::reexports::ahash::HashSet; use eyre::Context; use maud::{html, PreEscaped}; use tap::Pipe; @@ -41,12 +42,13 @@ pub async fn serve() -> eyre::Result<()> { let app = Router::new() .pipe(login::bind) - .pipe(nginx_check::bind) + .pipe(falx::bind) .pipe(panel::bind) .with_state(ApiState { store, cookie_domain: CookieDomain(config.cookie_domain), web_base: WebBase(config.web_base), + handoffs: Handoffs(Arc::new(config.handoffs)), }) .fallback(get(|| async { render_html( @@ -72,6 +74,7 @@ struct ApiState { pub store: Store, pub cookie_domain: CookieDomain, pub web_base: WebBase, + pub handoffs: Handoffs, } #[derive(Clone)] @@ -80,6 +83,9 @@ struct CookieDomain(Option<String>); #[derive(Clone)] struct WebBase(String); +#[derive(Clone)] +struct Handoffs(Arc<HashSet<String>>); + fn render_html(head: PreEscaped<impl AsRef<str>>, body: PreEscaped<impl AsRef<str>>) -> Response { let html = html! { (PreEscaped("<!doctype html>")) |