2024-06-30 22:47:28 +03:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2025-01-31 14:50:31 +02:00
|
|
|
use rinja::Template;
|
2024-06-30 22:47:28 +03:00
|
|
|
use tracing_subscriber::EnvFilter;
|
|
|
|
|
2025-01-31 14:50:31 +02:00
|
|
|
#[cfg(feature = "bbs")]
|
2024-09-28 16:32:23 +03:00
|
|
|
mod bbs;
|
2025-01-31 14:50:31 +02:00
|
|
|
|
|
|
|
#[cfg(feature = "ddd")]
|
2024-09-29 02:15:18 +03:00
|
|
|
mod ddd;
|
2025-01-31 14:50:31 +02:00
|
|
|
|
|
|
|
#[cfg(feature = "kh3")]
|
2025-01-27 14:55:10 +02:00
|
|
|
mod kh3;
|
2024-06-30 22:47:28 +03:00
|
|
|
|
2024-07-01 18:24:37 +03:00
|
|
|
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
2024-06-30 22:47:28 +03:00
|
|
|
|
2025-01-31 14:50:31 +02:00
|
|
|
#[derive(Template)]
|
|
|
|
#[template(path = "pages/index.html")]
|
|
|
|
struct IndexTemplate {}
|
|
|
|
|
2024-06-30 22:47:28 +03:00
|
|
|
fn main() {
|
|
|
|
// Initialize tracing
|
|
|
|
tracing_subscriber::fmt()
|
|
|
|
.with_env_filter(EnvFilter::from_default_env())
|
|
|
|
.event_format(tracing_subscriber::fmt::format().with_source_location(true))
|
|
|
|
.init();
|
|
|
|
|
2025-01-31 14:50:31 +02:00
|
|
|
tracing::info!("Generating the main menu template");
|
|
|
|
let template = IndexTemplate {};
|
|
|
|
|
|
|
|
std::fs::write("./out/index.html", template.render().unwrap()).unwrap();
|
|
|
|
|
|
|
|
#[cfg(feature = "bbs")]
|
2024-09-28 16:32:23 +03:00
|
|
|
bbs::init();
|
2025-01-31 14:50:31 +02:00
|
|
|
|
|
|
|
#[cfg(feature = "ddd")]
|
2024-09-29 02:15:18 +03:00
|
|
|
ddd::init();
|
2025-01-31 14:50:31 +02:00
|
|
|
|
|
|
|
#[cfg(feature = "kh3")]
|
2025-01-27 14:55:10 +02:00
|
|
|
kh3::init();
|
2024-06-30 22:47:28 +03:00
|
|
|
}
|
2025-01-31 15:06:04 +02:00
|
|
|
|
|
|
|
fn create_file(dir: &str, file: &str, buf: String) -> std::io::Result<()> {
|
|
|
|
std::fs::create_dir_all(dir)?;
|
|
|
|
std::fs::write(format!("{}/{}.html", dir, file), buf)?;
|
|
|
|
Ok(())
|
|
|
|
}
|