mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-05 20:27:45 +00:00
Don't include web templates in binaries
I plan on including some Bootstrap styling, and I don't want that to bloat the binaries. This also means people can easily modify the pages if they want.
This commit is contained in:
parent
bc56106e1d
commit
bf089b3bec
14 changed files with 58 additions and 21 deletions
14
Cargo.lock
generated
14
Cargo.lock
generated
|
@ -875,6 +875,12 @@ version = "2.7.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "memo-map"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b"
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.17"
|
||||
|
@ -887,6 +893,8 @@ version = "2.9.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98642a6dfca91122779a307b77cd07a4aa951fbe32232aaf5bad9febc66be754"
|
||||
dependencies = [
|
||||
"memo-map",
|
||||
"self_cell",
|
||||
"serde",
|
||||
]
|
||||
|
||||
|
@ -1188,6 +1196,12 @@ version = "1.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "self_cell"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.219"
|
||||
|
|
|
@ -71,7 +71,7 @@ tracing-subscriber = { version = "0.3", features = ["fmt"], default-features = f
|
|||
fastrand = { version = "2.3", features = ["std"], default-features = false }
|
||||
|
||||
# HTML templates used in the web servers
|
||||
minijinja = { version = "2.9", features = ["serde"], default-features = false }
|
||||
minijinja = { version = "2.9", features = ["serde", "loader"], default-features = false }
|
||||
|
||||
# Serialization of packets
|
||||
binrw = { version = "0.14", features = ["std"], default-features = false }
|
||||
|
|
|
@ -8,8 +8,12 @@ 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.add_template_owned(
|
||||
"admin.html",
|
||||
std::fs::read_to_string("resources/templates/admin.html")
|
||||
.expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
env
|
||||
}
|
||||
|
|
|
@ -8,9 +8,10 @@ use serde::Deserialize;
|
|||
|
||||
fn setup_default_environment() -> Environment<'static> {
|
||||
let mut env = Environment::new();
|
||||
env.add_template(
|
||||
env.add_template_owned(
|
||||
"launcher.html",
|
||||
include_str!("../../templates/launcher.html"),
|
||||
std::fs::read_to_string("resources/templates/launcher.html")
|
||||
.expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -15,18 +15,28 @@ use serde::Deserialize;
|
|||
|
||||
fn setup_default_environment() -> Environment<'static> {
|
||||
let mut env = Environment::new();
|
||||
env.add_template("login.html", include_str!("../../templates/login.html"))
|
||||
.unwrap();
|
||||
env.add_template(
|
||||
"register.html",
|
||||
include_str!("../../templates/register.html"),
|
||||
env.add_template_owned(
|
||||
"login.html",
|
||||
std::fs::read_to_string("resources/templates/login.html")
|
||||
.expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
env.add_template("account.html", include_str!("../../templates/account.html"))
|
||||
.unwrap();
|
||||
env.add_template(
|
||||
env.add_template_owned(
|
||||
"register.html",
|
||||
std::fs::read_to_string("resources/templates/register.html")
|
||||
.expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
env.add_template_owned(
|
||||
"account.html",
|
||||
std::fs::read_to_string("resources/templates/account.html")
|
||||
.expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
env.add_template_owned(
|
||||
"changepassword.html",
|
||||
include_str!("../../templates/changepassword.html"),
|
||||
std::fs::read_to_string("resources/templates/changepassword.html")
|
||||
.expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -7,15 +7,23 @@ 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(
|
||||
"worldstatus.html",
|
||||
include_str!("../../templates/worldstatus.html"),
|
||||
env.add_template_owned(
|
||||
"web.html",
|
||||
std::fs::read_to_string("resources/templates/web.html").expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
env.add_template_owned(
|
||||
"worldstatus.html",
|
||||
std::fs::read_to_string("resources/templates/worldstatus.html")
|
||||
.expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
env.add_template_owned(
|
||||
"account.html",
|
||||
std::fs::read_to_string("resources/templates/account.html")
|
||||
.expect("Failed to find template!"),
|
||||
)
|
||||
.unwrap();
|
||||
env.add_template("account.html", include_str!("../../templates/account.html"))
|
||||
.unwrap();
|
||||
|
||||
env
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue