diff --git a/nixin_farm_ssr/Cargo.lock b/nixin_farm_ssr/Cargo.lock index ab5d72d..ba53385 100644 --- a/nixin_farm_ssr/Cargo.lock +++ b/nixin_farm_ssr/Cargo.lock @@ -406,9 +406,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" -version = "0.7.7" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", @@ -1990,9 +1990,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.40.0" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6593a41c7a73841868772495db7dc1e8ecab43bb5c0b6da2059246c4b506ab60" +checksum = "7e9ffc4d4892617c50a928c52b2961cb5174b6fc6ebf252b2fac9d21955c48b8" dependencies = [ "console", "lazy_static", @@ -2254,11 +2254,88 @@ dependencies = [ "tracing", ] +[[package]] +name = "loco-gen" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b918975ceca60b4fc09180b0431efbe236c7b9cf29393130cac7572ba22c7cc4" +dependencies = [ + "chrono", + "clap", + "dialoguer", + "duct", + "regex", + "rrgen", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "loco-rs" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f22fc4dccb697923ab293e5ef12cfb5e94e1af400543dad1dee01123586d5d5d" +dependencies = [ + "argon2", + "async-trait", + "axum", + "axum-extra", + "backtrace_printer", + "bb8", + "byte-unit", + "bytes", + "cfg-if", + "chrono", + "clap", + "colored", + "duct", + "duct_sh", + "english-to-cron", + "fs-err", + "futures-util", + "heck 0.4.1", + "hyper", + "include_dir", + "ipnetwork", + "jsonwebtoken", + "lazy_static", + "lettre", + "loco-gen 0.11.1", + "mime", + "moka", + "object_store", + "rand", + "regex", + "rusty-sidekiq", + "sea-orm", + "sea-orm-migration", + "semver", + "serde", + "serde_json", + "serde_variant", + "serde_yaml", + "sqlx", + "tera", + "thiserror", + "tokio", + "tokio-cron-scheduler", + "tower 0.4.13", + "tower-http", + "tracing", + "tracing-appender", + "tracing-subscriber", + "ulid", + "uuid", + "validator", +] + +[[package]] +name = "loco-rs" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda11695a517c1a51e5ac44eb4ea8b76d593c29544ca4523d8885279d0adfa22" dependencies = [ "argon2", "async-trait", @@ -2283,9 +2360,8 @@ dependencies = [ "include_dir", "ipnetwork", "jsonwebtoken", - "lazy_static", "lettre", - "loco-gen", + "loco-gen 0.13.2", "mime", "moka", "object_store", @@ -2302,8 +2378,11 @@ dependencies = [ "sqlx", "tera", "thiserror", + "thousands", "tokio", "tokio-cron-scheduler", + "tokio-util", + "toml", "tower 0.4.13", "tower-http", "tracing", @@ -2359,7 +2438,7 @@ name = "migration" version = "0.1.0" dependencies = [ "async-std", - "loco-rs", + "loco-rs 0.11.1", "sea-orm-migration", ] @@ -2437,7 +2516,7 @@ dependencies = [ "fluent-templates", "include_dir", "insta", - "loco-rs", + "loco-rs 0.13.2", "migration", "rstest", "sea-orm", @@ -3753,6 +3832,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3789,9 +3877,9 @@ dependencies = [ [[package]] name = "serial_test" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" dependencies = [ "futures", "log", @@ -3803,9 +3891,9 @@ dependencies = [ [[package]] name = "serial_test_derive" -version = "3.1.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", @@ -4418,6 +4506,12 @@ dependencies = [ "syn 2.0.82", ] +[[package]] +name = "thousands" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" + [[package]] name = "thread_local" version = "1.1.8" @@ -4485,9 +4579,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -4562,11 +4656,26 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -4575,6 +4684,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -4652,9 +4763,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -4676,9 +4787,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -4687,9 +4798,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -4708,9 +4819,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" dependencies = [ "serde", "tracing-core", @@ -4718,9 +4829,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", diff --git a/nixin_farm_ssr/Cargo.toml b/nixin_farm_ssr/Cargo.toml index 309f8ff..698e19c 100644 --- a/nixin_farm_ssr/Cargo.toml +++ b/nixin_farm_ssr/Cargo.toml @@ -11,14 +11,14 @@ default-run = "nixin_farm_ssr-cli" [dependencies] -loco-rs = { version = "0.11.1" } +loco-rs = { version = "0.13.2" } migration = { path = "migration" } serde = { version = "1", features = ["derive"] } serde_json = "1" -tokio = { version = "1.41.0", default-features = false } +tokio = { version = "1.42.0", default-features = false } async-trait = "0.1.83" -tracing = "0.1.40" +tracing = "0.1.41" chrono = "0.4" validator = { version = "0.18" } sea-orm = { version = "1.1.0", features = [ @@ -28,11 +28,11 @@ sea-orm = { version = "1.1.0", features = [ "macros", ] } -axum = "0.7.7" +axum = "0.7.9" axum-extra = { version = "0.9", features = ["cookie"] } include_dir = "0.7" uuid = { version = "1.11.0", features = ["v4"] } -tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] } +tracing-subscriber = { version = "0.3.19", features = ["env-filter", "json"] } # view engine i18n fluent-templates = { version = "0.11.0", features = ["tera"] } @@ -50,7 +50,7 @@ path = "src/bin/tool.rs" required-features = [] [dev-dependencies] -serial_test = "3.1.1" +serial_test = "3.2.0" rstest = "0.23.0" -loco-rs = { version = "0.11.1", features = ["testing"] } -insta = { version = "1.40.0", features = ["redactions", "yaml", "filters"] } +loco-rs = { version = "0.13.2", features = ["testing"] } +insta = { version = "1.41.1", features = ["redactions", "yaml", "filters"] } diff --git a/nixin_farm_ssr/migration/src/lib.rs b/nixin_farm_ssr/migration/src/lib.rs index c62898e..4641b44 100644 --- a/nixin_farm_ssr/migration/src/lib.rs +++ b/nixin_farm_ssr/migration/src/lib.rs @@ -14,11 +14,13 @@ pub struct Migrator; impl MigratorTrait for Migrator { fn migrations() -> Vec> { vec![ + // inject-below (do not remove this comment) Box::new(m20220101_000001_users::Migration), Box::new(m20241016_181828_servers::Migration), Box::new(m20241021_121449_bundles::Migration), Box::new(m20241021_121806_services::Migration), Box::new(m20241021_124238_bundles_services::Migration), + // inject-above (do not remove this comment) ] } -} \ No newline at end of file +} diff --git a/nixin_farm_ssr/src/initializers/view_engine.rs b/nixin_farm_ssr/src/initializers/view_engine.rs index f0a5ffb..d7e3ed2 100644 --- a/nixin_farm_ssr/src/initializers/view_engine.rs +++ b/nixin_farm_ssr/src/initializers/view_engine.rs @@ -18,6 +18,7 @@ impl Initializer for ViewEngineInitializer { } async fn after_routes(&self, router: AxumRouter, _ctx: &AppContext) -> Result { + #[allow(unused_mut)] let mut tera_engine = engines::TeraView::build()?; if std::path::Path::new(I18N_DIR).exists() { let arc = ArcLoader::builder(&I18N_DIR, unic_langid::langid!("en-US")) @@ -25,6 +26,14 @@ impl Initializer for ViewEngineInitializer { .customize(|bundle| bundle.set_use_isolating(false)) .build() .map_err(|e| Error::string(&e.to_string()))?; + #[cfg(debug_assertions)] + tera_engine + .tera + .lock() + .expect("lock") + .register_function("t", FluentLoader::new(arc)); + + #[cfg(not(debug_assertions))] tera_engine .tera .register_function("t", FluentLoader::new(arc)); @@ -33,4 +42,5 @@ impl Initializer for ViewEngineInitializer { Ok(router.layer(Extension(ViewEngine::from(tera_engine)))) } + }