diff options
author | mia <mia@mia.jetzt> | 2024-04-23 18:40:20 -0700 |
---|---|---|
committer | mia <mia@mia.jetzt> | 2024-04-23 18:40:20 -0700 |
commit | b9c1ac1c070f19295c79ad21a7eddf20ea42a49b (patch) | |
tree | 82882bdbb9e43d8cce25ef45f7a2ece81f2fe432 /src/server/mod.rs | |
parent | 796b2cafc798a7faa80a007002831a4c40635fe8 (diff) | |
download | dissociate-0.2.0.tar.gz dissociate-0.2.0.zip |
falx integration v0.2.0
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>")) |