Silence warnings, run cargo fmt
This commit is contained in:
parent
fe1c1d3655
commit
af1c767f5f
77 changed files with 1904 additions and 903 deletions
|
|
@ -6,17 +6,17 @@
|
|||
|
||||
#[cfg(feature = "ssr")]
|
||||
mod server {
|
||||
use axum::{response::Redirect, routing::get, Router};
|
||||
use axum::{Router, response::Redirect, routing::get};
|
||||
use clap::Parser;
|
||||
use leptos::prelude::*;
|
||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||
use leptos_axum::{LeptosRoutes, generate_route_list};
|
||||
use sqlx::postgres::PgPoolOptions;
|
||||
use std::net::SocketAddr;
|
||||
use std::path::Path;
|
||||
use tower_http::services::ServeDir;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
use chattyness_admin_ui::{admin_shell, AdminApp, AdminAppState};
|
||||
use chattyness_admin_ui::{AdminApp, AdminAppState, admin_shell};
|
||||
|
||||
/// CLI arguments.
|
||||
#[derive(Parser)]
|
||||
|
|
@ -77,9 +77,11 @@ mod server {
|
|||
let addr = SocketAddr::new(args.host.parse()?, args.port);
|
||||
|
||||
// Create session layer
|
||||
let session_layer =
|
||||
chattyness_admin_ui::auth::create_admin_session_layer(pool.clone(), args.secure_cookies)
|
||||
.await;
|
||||
let session_layer = chattyness_admin_ui::auth::create_admin_session_layer(
|
||||
pool.clone(),
|
||||
args.secure_cookies,
|
||||
)
|
||||
.await;
|
||||
|
||||
// Create app state
|
||||
let app_state = AdminAppState {
|
||||
|
|
@ -111,15 +113,24 @@ mod server {
|
|||
// Redirect root to admin
|
||||
.route("/", get(|| async { Redirect::permanent("/admin") }))
|
||||
// Nest API routes under /api/admin (matches frontend expectations when UI is at /admin)
|
||||
.nest("/api/admin", chattyness_admin_ui::api::admin_api_router().with_state(app_state.clone()))
|
||||
.nest(
|
||||
"/api/admin",
|
||||
chattyness_admin_ui::api::admin_api_router().with_state(app_state.clone()),
|
||||
)
|
||||
// Uploaded assets (realm backgrounds, props, etc.) - must come before /static
|
||||
.nest_service("/assets/server", ServeDir::new(assets_dir.join("server")))
|
||||
.nest_service("/static/realm", ServeDir::new(assets_dir.join("realm")))
|
||||
// Static files (build output: JS, CSS, WASM)
|
||||
.nest_service("/static", ServeDir::new(&static_dir))
|
||||
.nest_service("/favicon.ico", tower_http::services::ServeFile::new(&favicon_path))
|
||||
.nest_service(
|
||||
"/favicon.ico",
|
||||
tower_http::services::ServeFile::new(&favicon_path),
|
||||
)
|
||||
// Serve admin CSS at standardized path
|
||||
.nest_service("/static/css/admin.css", tower_http::services::ServeFile::new(&admin_css_path))
|
||||
.nest_service(
|
||||
"/static/css/admin.css",
|
||||
tower_http::services::ServeFile::new(&admin_css_path),
|
||||
)
|
||||
// Leptos routes
|
||||
.leptos_routes(&app_state, routes, {
|
||||
let leptos_options = leptos_options.clone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue