feat: improve dependencies
Some checks failed
Rust / build_and_test (push) Failing after 1m38s

This commit is contained in:
Lukas Wölfer
2026-04-10 23:09:43 +02:00
parent 61347de7d0
commit 559f36224e
6 changed files with 1961 additions and 455 deletions

View File

@@ -1,2 +1,33 @@
pub mod handlers;
pub mod models;
pub mod models;
use axum::{routing::{get, post}, Router};
use axum_sessions::{async_session::MemoryStore, SessionLayer};
use oauth2::basic::BasicClient;
use sqlx::SqlitePool;
use tower_http::services::ServeDir;
#[derive(Clone)]
pub struct AppState {
pub pool: SqlitePool,
pub oidc_client: BasicClient,
}
pub fn create_app(state: AppState, session_secret: Vec<u8>) -> Router {
let store = MemoryStore::new();
let session_layer = SessionLayer::new(store, &session_secret).with_secure(false);
let app = Router::new()
.route("/", get(handlers::index))
.route("/auth/login", get(handlers::login))
.route("/auth/callback", get(handlers::callback))
.route("/input", post(handlers::input_post))
.with_state(state)
.layer(session_layer)
.nest_service("/static", ServeDir::new("static"));
#[cfg(test)]
let app = app.route("/test/login", get(handlers::test_login));
app
}