1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-19 22:36:49 +00:00

Don't include a copy of unused HTML pages in each binary

This reduces the size of the binary a little.
This commit is contained in:
Joshua Goins 2025-03-31 22:03:33 -04:00
parent 924c5a1530
commit 32b6840e38
3 changed files with 30 additions and 22 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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
}