diff --git a/src/bin/kawari-admin.rs b/src/bin/kawari-admin.rs index d6cc600..7176108 100644 --- a/src/bin/kawari-admin.rs +++ b/src/bin/kawari-admin.rs @@ -2,10 +2,18 @@ use axum::response::{Html, Redirect}; use axum::routing::post; use axum::{Router, extract::Form, routing::get}; use kawari::config::get_config; -use kawari::setup_default_environment; +use minijinja::Environment; use minijinja::context; use serde::{Deserialize, Serialize}; +fn setup_default_environment() -> Environment<'static> { + let mut env = Environment::new(); + env.add_template("admin.html", include_str!("../../templates/admin.html")) + .unwrap(); + + env +} + #[derive(Debug, Clone, Serialize, Deserialize)] struct GateStatus { status: i32, diff --git a/src/bin/kawari-web.rs b/src/bin/kawari-web.rs index eafb9e5..1cc3c85 100644 --- a/src/bin/kawari-web.rs +++ b/src/bin/kawari-web.rs @@ -1,10 +1,30 @@ use axum::response::Html; use axum::{Router, routing::get}; use kawari::config::get_config; -use kawari::setup_default_environment; +use minijinja::Environment; use minijinja::context; use serde::{Deserialize, Serialize}; +fn setup_default_environment() -> Environment<'static> { + let mut env = Environment::new(); + env.add_template("web.html", include_str!("../../templates/web.html")) + .unwrap(); + env.add_template("login.html", include_str!("../../templates/login.html")) + .unwrap(); + env.add_template( + "register.html", + include_str!("../../templates/register.html"), + ) + .unwrap(); + env.add_template( + "worldstatus.html", + include_str!("../../templates/worldstatus.html"), + ) + .unwrap(); + + env +} + #[derive(Debug, Clone, Serialize, Deserialize)] struct GateStatus { status: i32, diff --git a/src/lib.rs b/src/lib.rs index 4b2c7f1..b885004 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,6 @@ use std::collections::HashMap; -use minijinja::Environment; use patch::Version; /// The blowfish implementation used for packet encryption. @@ -60,22 +59,3 @@ const SUPPORTED_EXPAC_VERSIONS: [(&str, Version); 5] = [ pub fn get_supported_expac_versions() -> HashMap<&'static str, Version<'static>> { HashMap::from(SUPPORTED_EXPAC_VERSIONS) } - -pub fn setup_default_environment() -> Environment<'static> { - let mut env = Environment::new(); - env.add_template("admin.html", include_str!("../templates/admin.html")) - .unwrap(); - env.add_template("web.html", include_str!("../templates/web.html")) - .unwrap(); - env.add_template("login.html", include_str!("../templates/login.html")) - .unwrap(); - env.add_template("register.html", include_str!("../templates/register.html")) - .unwrap(); - env.add_template( - "worldstatus.html", - include_str!("../templates/worldstatus.html"), - ) - .unwrap(); - - env -}