diff --git a/Cargo.lock b/Cargo.lock index a102643..2c61f27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,9 +317,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.13" +version = "4.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" +checksum = "33e92c5c1a78c62968ec57dbc2440366a2d6e5a23faf829970ff1585dc6b18e2" dependencies = [ "clap_builder", "clap_derive", @@ -327,9 +327,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.12" +version = "4.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +checksum = "f4323769dc8a61e2c39ad7dc26f6f2800524691a44d74fe3d1071a5c24db6370" dependencies = [ "anstream", "anstyle", @@ -930,14 +930,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "proc-file" -version = "1.0.0" -source = "git+https://github.com/RGBCube/proc-file#88d6d829891e56bd89827f0bf5e0eca5aa2c047c" -dependencies = [ - "proc-macro2", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -1230,7 +1222,6 @@ dependencies = [ "maud", "mime_guess", "minify-js", - "proc-file", "pulldown-cmark", "serde", "serde_yaml", diff --git a/Cargo.toml b/Cargo.toml index 7fbc6aa..ea1043b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ log = { version = "0.4.20", features = [ "serde" ] } maud = { git = "https://github.com/lambda-fairy/maud", features = [ "axum" ] } mime_guess = "2.0.4" minify-js = "0.6.0" -proc-file = { git = "https://github.com/RGBCube/proc-file" } pulldown-cmark = "0.9.3" serde = { version = "1.0.195", features = [ "derive" ] } serde_yaml = "0.9.30" diff --git a/src/main.rs b/src/main.rs index c6f10ef..ba9b89b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -74,7 +74,7 @@ async fn redirect_http(args: Cli) { match make_https(host, uri) { Ok(uri) => Ok(Redirect::permanent(&uri.to_string())), Err(error) => { - log::warn!("Failed to convert URI to HTTPS: {}", error); + log::warn!("Failed to convert URI to HTTPS: {error}"); Err(StatusCode::BAD_REQUEST) }, } diff --git a/src/routes/markdown.rs b/src/routes/markdown.rs index cd9818d..5a18241 100644 --- a/src/routes/markdown.rs +++ b/src/routes/markdown.rs @@ -1,6 +1,5 @@ use std::{ collections::HashMap, - path, sync::LazyLock, }; @@ -26,18 +25,8 @@ pub struct Metadata { } pub static PAGES: LazyLock> = LazyLock::new(|| { - let routes_path = dbg!(path::Path::new(proc_file::file!()) - .parent() - .unwrap() - .canonicalize() - .unwrap()); - HashMap::from_iter(embed::dir!(".").flatten().iter().filter_map(|file| { - let path = dbg!(path::Path::new(file.path().as_ref())) - .strip_prefix(&routes_path) - .unwrap() - .to_str() - .unwrap(); + let path = file.path().as_ref().split_once("routes/").unwrap().1; if !path.ends_with(".md") { return None; @@ -52,7 +41,7 @@ pub static PAGES: LazyLock> = LazyLock::new( log::info!("Adding page {path}"); Some(( - path.to_string().strip_suffix(".md").unwrap().to_string(), + path.strip_suffix(".md").unwrap().to_string(), (metadata, markdown::parse(content)), )) }))