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
|
|
|
|
2025-03-11 18:39:30 -04:00
|
|
|
pub mod blowfish;
|
2025-03-09 09:40:11 -04:00
|
|
|
pub mod client_select_data;
|
2025-03-08 22:03:28 -05:00
|
|
|
mod common;
|
2025-03-09 12:00:58 -04:00
|
|
|
mod compression;
|
2024-05-11 13:50:05 -04:00
|
|
|
pub mod config;
|
2025-03-08 16:10:00 -05:00
|
|
|
pub mod encryption;
|
2025-03-08 22:03:28 -05:00
|
|
|
pub mod ipc;
|
2025-03-10 21:31:21 -04:00
|
|
|
pub mod oodle;
|
2025-03-08 13:58:24 -05:00
|
|
|
pub mod packet;
|
2025-03-08 14:38:31 -05:00
|
|
|
pub mod patchlist;
|
2025-03-12 17:47:58 -04:00
|
|
|
pub mod world;
|
2024-05-11 13:50:05 -04:00
|
|
|
|
2025-03-10 21:31:21 -04:00
|
|
|
// TODO: make this configurable
|
|
|
|
// See https://ffxiv.consolegameswiki.com/wiki/Servers for a list of possible IDs
|
|
|
|
pub const WORLD_ID: u16 = 63;
|
|
|
|
pub const WORLD_NAME: &str = "KAWARI";
|
|
|
|
|
|
|
|
pub const ZONE_ID: u16 = 1255;
|
|
|
|
|
|
|
|
pub const CONTENT_ID: u64 = 11111111111111111;
|
|
|
|
|
2025-03-13 00:18:00 -04:00
|
|
|
/// Maxmimum length of a character's name.
|
|
|
|
pub const CHAR_NAME_MAX_LENGTH: usize = 32;
|
|
|
|
|
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
|
|
|
}
|