2024-05-11 13:58:58 -04:00
|
|
|
use minijinja::Environment;
|
2024-05-11 13:50:05 -04:00
|
|
|
use rand::Rng;
|
2025-03-08 13:27:41 -05:00
|
|
|
use rand::distributions::Alphanumeric;
|
2024-05-11 13:50:05 -04:00
|
|
|
|
|
|
|
pub mod config;
|
2024-06-29 13:56:54 -04:00
|
|
|
pub mod patchlist;
|
2024-05-11 13:50:05 -04:00
|
|
|
|
|
|
|
pub fn generate_sid() -> String {
|
|
|
|
let random_id: String = rand::thread_rng()
|
|
|
|
.sample_iter(&Alphanumeric)
|
|
|
|
.take(56)
|
|
|
|
.map(char::from)
|
|
|
|
.collect();
|
|
|
|
random_id.to_lowercase()
|
2024-05-11 13:58:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn setup_default_environment() -> Environment<'static> {
|
|
|
|
let mut env = Environment::new();
|
2025-03-08 13:27:41 -05:00
|
|
|
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();
|
2024-05-11 13:58:58 -04:00
|
|
|
|
|
|
|
env
|
2025-03-08 13:27:41 -05:00
|
|
|
}
|