diff --git a/pkgs/servers/ldap/lldap/0001-parameterize-frontend-location.patch b/pkgs/servers/ldap/lldap/0001-parameterize-frontend-location.patch new file mode 100644 index 0000000000000..c33f5a7afa107 --- /dev/null +++ b/pkgs/servers/ldap/lldap/0001-parameterize-frontend-location.patch @@ -0,0 +1,64 @@ +From a09babb0cd9dd532ad2de920a2a35aa03d740dc6 Mon Sep 17 00:00:00 2001 +From: Herwig Hochleitner +Date: Thu, 8 Aug 2024 00:29:14 +0200 +Subject: [PATCH] parameterize frontend location + +--- + server/src/infra/tcp_server.rs | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/server/src/infra/tcp_server.rs b/server/src/infra/tcp_server.rs +index fa5f11f..16e64c5 100644 +--- a/server/src/infra/tcp_server.rs ++++ b/server/src/infra/tcp_server.rs +@@ -25,7 +25,7 @@ use std::sync::RwLock; + use tracing::info; + + async fn index(data: web::Data>) -> actix_web::Result { +- let mut file = std::fs::read_to_string(r"./app/index.html")?; ++ let mut file = std::fs::read_to_string(r"@frontend@/index.html")?; + + if data.server_url.path() != "/" { + file = file.replace( +@@ -80,7 +80,7 @@ pub(crate) fn error_to_http_response(error: TcpError) -> HttpResponse { + async fn main_js_handler( + data: web::Data>, + ) -> actix_web::Result { +- let mut file = std::fs::read_to_string(r"./app/static/main.js")?; ++ let mut file = std::fs::read_to_string(r"@frontend@/static/main.js")?; + + if data.server_url.path() != "/" { + file = file.replace("/pkg/", format!("{}/pkg/", data.server_url.path()).as_str()); +@@ -92,12 +92,12 @@ async fn main_js_handler( + } + + async fn wasm_handler() -> actix_web::Result { +- Ok(actix_files::NamedFile::open_async("./app/pkg/lldap_app_bg.wasm").await?) ++ Ok(actix_files::NamedFile::open_async("@frontend@/pkg/lldap_app_bg.wasm").await?) + } + + async fn wasm_handler_compressed() -> actix_web::Result { + Ok( +- actix_files::NamedFile::open_async("./app/pkg/lldap_app_bg.wasm.gz") ++ actix_files::NamedFile::open_async("@frontend@/pkg/lldap_app_bg.wasm.gz") + .await? + .customize() + .insert_header(header::ContentEncoding::Gzip) +@@ -143,11 +143,11 @@ fn http_config( + .service(web::resource("/pkg/lldap_app_bg.wasm").route(web::route().to(wasm_handler))) + .service(web::resource("/static/main.js").route(web::route().to(main_js_handler::))) + // Serve the /pkg path with the compiled WASM app. +- .service(Files::new("/pkg", "./app/pkg")) ++ .service(Files::new("/pkg", "@frontend@/pkg")) + // Serve static files +- .service(Files::new("/static", "./app/static")) ++ .service(Files::new("/static", "@frontend@/static")) + // Serve static fonts +- .service(Files::new("/static/fonts", "./app/static/fonts")) ++ .service(Files::new("/static/fonts", "@frontend@/static/fonts")) + // Default to serve index.html for unknown routes, to support routing. + .default_service(web::route().guard(guard::Get()).to(index::)); + } +-- +2.45.2 + diff --git a/pkgs/servers/ldap/lldap/Cargo.lock b/pkgs/servers/ldap/lldap/Cargo.lock index 94928b73308bf..f2f9bcb351279 100644 --- a/pkgs/servers/ldap/lldap/Cargo.lock +++ b/pkgs/servers/ldap/lldap/Cargo.lock @@ -233,7 +233,7 @@ dependencies = [ "serde_urlencoded", "smallvec", "socket2", - "time 0.3.19", + "time 0.3.36", "url", ] @@ -395,7 +395,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.19", + "time 0.3.36", ] [[package]] @@ -799,7 +799,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.19", + "time 0.3.36", "version_check", ] @@ -1090,6 +1090,15 @@ dependencies = [ "rusticata-macros", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1351,8 +1360,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e56602b469b2201400dec66a66aec5a9b8761ee97cd1b8c96ab2483fcc16cc9" dependencies = [ "atomic", + "parking_lot", "pear", "serde", + "tempfile", "toml", "uncased", "version_check", @@ -2364,9 +2375,9 @@ dependencies = [ [[package]] name = "ldap3_proto" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db993ebb4a1acda7ac25fa7e8609cff225a65f1f4a668e378eb252a1a6de433a" +checksum = "a29eca0a9fef365d6d376a1b262e269a17b1c8c6de2cee76618642cd3c923506" dependencies = [ "base64 0.21.0", "bytes", @@ -2453,7 +2464,7 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "lldap" -version = "0.5.0" +version = "0.5.1-alpha" dependencies = [ "actix", "actix-files", @@ -2473,6 +2484,7 @@ dependencies = [ "clap", "cron", "derive_builder", + "derive_more", "figment", "figment_file_provider_adapter", "futures", @@ -2509,7 +2521,7 @@ dependencies = [ "sha2 0.10.6", "strum", "thiserror", - "time 0.3.19", + "time 0.3.36", "tokio", "tokio-rustls", "tokio-stream", @@ -2528,7 +2540,7 @@ dependencies = [ [[package]] name = "lldap_app" -version = "0.5.0" +version = "0.5.1-alpha" dependencies = [ "anyhow", "base64 0.13.1", @@ -2569,6 +2581,7 @@ dependencies = [ "opaque-ke", "rand 0.8.5", "rust-argon2", + "sea-orm", "serde", "sha2 0.9.9", "thiserror", @@ -2818,6 +2831,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.45" @@ -3137,6 +3156,12 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -3735,9 +3760,9 @@ checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] @@ -3765,13 +3790,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.32", ] [[package]] @@ -4357,11 +4382,14 @@ dependencies = [ [[package]] name = "time" -version = "0.3.19" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53250a3b3fed8ff8fd988587d8925d26a83ac3845d9e03b220b37f34c2b8d6c2" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ + "deranged", "itoa", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -4369,16 +4397,17 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.7" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a460aeb8de6dcb0f381e1ee05f1cd56fcf5a5f6eb8187ff3d8f0b11078d38b7c" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -4893,9 +4922,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e" +checksum = "07ecc0cd7cac091bf682ec5efa18b1cff79d617b84181f38b3951dbe135f607f" dependencies = [ "ring", "untrusted", @@ -5127,7 +5156,7 @@ dependencies = [ "oid-registry", "rusticata-macros", "thiserror", - "time 0.3.19", + "time 0.3.36", ] [[package]] diff --git a/pkgs/servers/ldap/lldap/default.nix b/pkgs/servers/ldap/lldap/default.nix index 80d7710ccbaf4..24a55436d93d2 100644 --- a/pkgs/servers/ldap/lldap/default.nix +++ b/pkgs/servers/ldap/lldap/default.nix @@ -18,15 +18,15 @@ let cargoHash = "sha256-vcpxcRlW1OKoD64owFF6mkxSqmNrvY+y3Ckn5UwEQ50="; }; - commonDerivationAttrs = rec { + commonDerivationAttrs = { pname = "lldap"; - version = "0.5.0"; + version = "0.5.1-unstable-2024-08-09"; src = fetchFromGitHub { owner = "lldap"; repo = "lldap"; - rev = "v${version}"; - hash = "sha256-2MEfwppkS9l3iHPNlkJB4tJnma0xMi0AckLv6wpzy1Y="; + rev = "4138963bee15f5423629c081ec88805d43b8235c"; + hash = "sha256-g/Y+StSQQiA+1O0yh2xIhBHO9/MjM4QW1DNQIABTHdI="; }; # `Cargo.lock` has git dependencies, meaning can't use `cargoHash` @@ -38,6 +38,7 @@ let "yew_form-0.1.8" = "sha256-1n9C7NiFfTjbmc9B5bDEnz7ZpYJo9ZT8/dioRXJ65hc="; }; }; + }; frontend = rustPlatform.buildRustPackage (commonDerivationAttrs // { @@ -60,11 +61,10 @@ let }); in rustPlatform.buildRustPackage (commonDerivationAttrs // { - cargoBuildFlags = [ "-p" "lldap" "-p" "lldap_migration_tool" "-p" "lldap_set_password" ]; patches = [ - ./static-frontend-path.patch + ./0001-parameterize-frontend-location.patch ]; postPatch = '' diff --git a/pkgs/servers/ldap/lldap/static-frontend-path.patch b/pkgs/servers/ldap/lldap/static-frontend-path.patch deleted file mode 100644 index 6488d58fc26f0..0000000000000 --- a/pkgs/servers/ldap/lldap/static-frontend-path.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/server/src/infra/tcp_server.rs b/server/src/infra/tcp_server.rs -index 43f65ea..e289f2a 100644 ---- a/server/src/infra/tcp_server.rs -+++ b/server/src/infra/tcp_server.rs -@@ -26,7 +26,7 @@ use std::sync::RwLock; - use tracing::info; - - async fn index() -> actix_web::Result { -- let path = PathBuf::from(r"app/index.html"); -+ let path = PathBuf::from(r"@frontend@/index.html"); - Ok(NamedFile::open(path)?) - } - -@@ -68,12 +68,12 @@ pub(crate) fn error_to_http_response(error: TcpError) -> HttpResponse { - } - - async fn wasm_handler() -> actix_web::Result { -- Ok(actix_files::NamedFile::open_async("./app/pkg/lldap_app_bg.wasm").await?) -+ Ok(actix_files::NamedFile::open_async("@frontend@/pkg/lldap_app_bg.wasm").await?) - } - - async fn wasm_handler_compressed() -> actix_web::Result { - Ok( -- actix_files::NamedFile::open_async("./app/pkg/lldap_app_bg.wasm.gz") -+ actix_files::NamedFile::open_async("@frontend@/pkg/lldap_app_bg.wasm.gz") - .await? - .customize() - .insert_header(header::ContentEncoding::Gzip) -@@ -118,11 +118,11 @@ fn http_config( - ) - .service(web::resource("/pkg/lldap_app_bg.wasm").route(web::route().to(wasm_handler))) - // Serve the /pkg path with the compiled WASM app. -- .service(Files::new("/pkg", "./app/pkg")) -+ .service(Files::new("/pkg", "@frontend@/pkg")) - // Serve static files -- .service(Files::new("/static", "./app/static")) -+ .service(Files::new("/static", "@frontend@/static")) - // Serve static fonts -- .service(Files::new("/static/fonts", "./app/static/fonts")) -+ .service(Files::new("/static/fonts", "@frontend@/static/fonts")) - // Default to serve index.html for unknown routes, to support routing. - .default_service(web::route().guard(guard::Get()).to(index)); - }