From 43375bcb875a31ce8c6132ce78552d45f64b261b Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 17 Jun 2025 01:22:54 -0400 Subject: Use a fluent style for the middleware layers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For endpoints that are unavailable, that default behaviour no longer needs to be specified: `Required(app)` will do that for you. For endpoints that are redirects until setup is completed, `Require(app).with_fallback(…response…)` will do that. To make this a bit harder to break by accident, the default unavailable response is now its own type. --- src/ui/routes/mod.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/routes/mod.rs b/src/ui/routes/mod.rs index 328eb73..dc94773 100644 --- a/src/ui/routes/mod.rs +++ b/src/ui/routes/mod.rs @@ -21,10 +21,7 @@ pub fn router(app: &App) -> Router { .route("/login", get(login::get::handler)) .route("/ch/{channel}", get(ch::channel::get::handler)) .route("/invite/{invite}", get(invite::invite::get::handler)) - .route_layer(crate::setup::Required::with_fallback( - app.clone(), - Redirect::to("/setup"), - )), + .route_layer(crate::setup::Required(app.clone()).with_fallback(Redirect::to("/setup"))), ] .into_iter() .fold(Router::default(), Router::merge) -- cgit v1.2.3