From 0c8c6e294d89fcec056768c1a1ac716be61648c6 Mon Sep 17 00:00:00 2001 From: photino Date: Sat, 14 Oct 2023 11:07:50 +0800 Subject: [PATCH] Release 0.14.1 --- examples/actix-app/Cargo.toml | 2 +- examples/actix-app/config/config.dev.toml | 4 +-- examples/actix-app/config/config.prod.toml | 4 +-- examples/axum-app/Cargo.toml | 2 +- examples/axum-app/config/config.dev.toml | 4 +-- examples/axum-app/config/config.prod.toml | 4 +-- examples/dioxus-desktop/Cargo.toml | 4 +-- .../dioxus-desktop/config/config.dev.toml | 36 +------------------ .../dioxus-desktop/config/config.prod.toml | 32 +---------------- zino-core/src/application/mod.rs | 5 ++- zino-core/src/application/secret_key.rs | 12 +++---- zino-core/src/helper/str_array.rs | 4 +-- zino-model/src/user/mod.rs | 1 - zino/src/application/dioxus_desktop.rs | 13 ++++++- 14 files changed, 37 insertions(+), 90 deletions(-) diff --git a/examples/actix-app/Cargo.toml b/examples/actix-app/Cargo.toml index 4982f8e6..a3b8ad1e 100644 --- a/examples/actix-app/Cargo.toml +++ b/examples/actix-app/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "actix-app" description = "An example for actix-web integration." -version = "0.3.1" +version = "0.3.2" rust-version = "1.72" edition = "2021" publish = false diff --git a/examples/actix-app/config/config.dev.toml b/examples/actix-app/config/config.dev.toml index df2211d5..b2639c15 100644 --- a/examples/actix-app/config/config.dev.toml +++ b/examples/actix-app/config/config.dev.toml @@ -1,7 +1,7 @@ # --env=dev name = "data-cube" -version = "0.6.3" +version = "0.6.4" [dirs] uploads = "local/uploads" @@ -33,7 +33,7 @@ host = "127.0.0.1" port = 5432 database = "data_cube" username = "postgres" -password = "7KlQXgPKdf1pII200zf/0lsod6gOJfrUhiRxCErYvnOyZBHE" +password = "smcddNr2mrpwgYvO6ICRLPFfLFd27WySGN9a7a9JrsYP3tIP" [[sqlite]] database = "local/data/main.db" diff --git a/examples/actix-app/config/config.prod.toml b/examples/actix-app/config/config.prod.toml index 06551e3a..632630ce 100644 --- a/examples/actix-app/config/config.prod.toml +++ b/examples/actix-app/config/config.prod.toml @@ -1,7 +1,7 @@ # --env=prod name = "data-cube" -version = "0.6.3" +version = "0.6.4" [dirs] uploads = "local/uploads" @@ -33,7 +33,7 @@ host = "127.0.0.1" port = 5432 database = "data_cube" username = "postgres" -password = "nNRimGdBSlhiyiz30LYRKUfawlbfAilO0nuZFw+l3cpKsVUZ" +password = "uzU7eGgSw6HLp63qbjpMQMnl4Kk0SrDDp9bIXkRmcjqwRFRf" [[sqlite]] database = "local/data/main.db" diff --git a/examples/axum-app/Cargo.toml b/examples/axum-app/Cargo.toml index e7685efa..efcdad3b 100644 --- a/examples/axum-app/Cargo.toml +++ b/examples/axum-app/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "axum-app" description = "An example for axum integration." -version = "0.9.1" +version = "0.9.2" rust-version = "1.72" edition = "2021" publish = false diff --git a/examples/axum-app/config/config.dev.toml b/examples/axum-app/config/config.dev.toml index a080aa63..bdae729f 100644 --- a/examples/axum-app/config/config.dev.toml +++ b/examples/axum-app/config/config.dev.toml @@ -1,7 +1,7 @@ # --env=dev name = "data-cube" -version = "0.6.3" +version = "0.6.4" [dirs] uploads = "local/uploads" @@ -38,7 +38,7 @@ host = "127.0.0.1" port = 3306 database = "data_cube" username = "root" -password = "Wuf4gbfL1R0DRyUbXsMUDm3lwaA" +password = "GCILxF2OoLWjLKgqnSXSFErrmUU" [[sqlite]] database = "local/data/main.db" diff --git a/examples/axum-app/config/config.prod.toml b/examples/axum-app/config/config.prod.toml index 0fc824c6..265375c3 100644 --- a/examples/axum-app/config/config.prod.toml +++ b/examples/axum-app/config/config.prod.toml @@ -1,7 +1,7 @@ # --env=prod name = "data-cube" -version = "0.6.3" +version = "0.6.4" [dirs] uploads = "local/uploads" @@ -38,7 +38,7 @@ host = "127.0.0.1" port = 3306 database = "data_cube" username = "root" -password = "DHdS3+1IR6bLQjLI7pFu3Pu4XGs" +password = "DI9IDtF0Le2ppYzflOaPpL4DvWo" [[sqlite]] database = "local/data/main.db" diff --git a/examples/dioxus-desktop/Cargo.toml b/examples/dioxus-desktop/Cargo.toml index a2e22b6c..fc9dfa66 100644 --- a/examples/dioxus-desktop/Cargo.toml +++ b/examples/dioxus-desktop/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dioxus-desktop" description = "An example for Dioxus desktop integration." -version = "0.0.3" +version = "0.0.4" rust-version = "1.72" edition = "2021" publish = false @@ -17,7 +17,7 @@ features = ["derive"] [dependencies.zino] path = "../../zino" -version = "0.13.0" +version = "0.13.1" features = ["dioxus"] [dependencies.zino-core] diff --git a/examples/dioxus-desktop/config/config.dev.toml b/examples/dioxus-desktop/config/config.dev.toml index 8db89758..8015606f 100644 --- a/examples/dioxus-desktop/config/config.dev.toml +++ b/examples/dioxus-desktop/config/config.dev.toml @@ -1,7 +1,7 @@ # --env=dev name = "data-cube" -version = "0.1.2" +version = "0.1.3" [dirs] uploads = "local/uploads" @@ -20,37 +20,3 @@ database = "local/data/main.db" [tracing] filter = "info,sqlx=info,zino=trace,zino_core=trace" - -[metrics] -exporter = "prometheus" -host = "127.0.0.1" -port = 9000 - -[jwt] -max-age = "20m" -refresh-interval = "7d" - -[[connector]] -type = "arrow" -name = "mock" -root = "local/data/mock/" - -[[connector.tables]] -type = "csv" -name = "users" -path = "users.csv" - -[[connector.tables]] -type = "ndjson" -name = "logs" -url = "http://localhost:6080/public/data/logs.ndjson" - -[connector.tables.schema] -timestamp = "string" -level = "string" -fields = { message = "string" } -target = "string" -span = { "http.method" = "string", "http.target" = "string", "http.status_code" = "int" } - -[connector.variables] -app-name = "data-cube" diff --git a/examples/dioxus-desktop/config/config.prod.toml b/examples/dioxus-desktop/config/config.prod.toml index d7f801e3..5677686a 100644 --- a/examples/dioxus-desktop/config/config.prod.toml +++ b/examples/dioxus-desktop/config/config.prod.toml @@ -1,7 +1,7 @@ # --env=prod name = "data-cube" -version = "0.1.2" +version = "0.1.3" [dirs] uploads = "local/uploads" @@ -19,33 +19,3 @@ database = "local/data/main.db" [tracing] filter = "warn" - -[metrics] -exporter = "prometheus" -host = "127.0.0.1" -port = 9000 - -[[connector]] -type = "arrow" -name = "mock" -root = "local/data/mock/" - -[[connector.tables]] -type = "csv" -name = "users" -path = "users.csv" - -[[connector.tables]] -type = "ndjson" -name = "logs" -url = "http://localhost:6080/public/data/logs.ndjson" - -[connector.tables.schema] -timestamp = "string" -level = "string" -fields = { message = "string" } -target = "string" -span = { "http.method" = "string", "http.target" = "string", "http.status_code" = "int" } - -[connector.variables] -app-name = "data-cube" diff --git a/zino-core/src/application/mod.rs b/zino-core/src/application/mod.rs index 5ef7c6a2..ebf7de6e 100644 --- a/zino-core/src/application/mod.rs +++ b/zino-core/src/application/mod.rs @@ -277,7 +277,10 @@ pub(crate) static PROJECT_DIR: LazyLock = LazyLock::new(|| { env::var("CARGO_MANIFEST_DIR") .map(PathBuf::from) .unwrap_or_else(|err| { - tracing::warn!("fail to get the environment variable `CARGO_MANIFEST_DIR`: {err}"); + tracing::warn!( + "fail to get the environment variable `CARGO_MANIFEST_DIR`: {err}; \ + the current directory will be used as the project directory" + ); env::current_dir() .expect("the project directory does not exist or permissions are insufficient") }) diff --git a/zino-core/src/application/secret_key.rs b/zino-core/src/application/secret_key.rs index 31ddd3d3..6770d4e0 100644 --- a/zino-core/src/application/secret_key.rs +++ b/zino-core/src/application/secret_key.rs @@ -1,6 +1,6 @@ use super::Application; use crate::{crypto, extension::TomlTableExt}; -use std::{env, sync::OnceLock}; +use std::{sync::OnceLock}; /// Initializes the secret key. pub(super) fn init() { @@ -10,12 +10,10 @@ pub(super) fn init() { .unwrap_or_else(|| { tracing::warn!("the `checksum` is not set properly for deriving a secret key"); - let pkg_name = env::var("CARGO_PKG_NAME") - .expect("fail to get the environment variable `CARGO_PKG_NAME`"); - let pkg_version = env::var("CARGO_PKG_VERSION") - .expect("fail to get the environment variable `CARGO_PKG_VERSION`"); - let pkg_key = format!("{pkg_name}@{pkg_version}"); - crypto::digest(pkg_key.as_bytes()) + let app_name = APP::name(); + let app_version = APP::version(); + let app_key = format!("{app_name}@{app_version}"); + crypto::digest(app_key.as_bytes()) }); let secret_key = crypto::derive_key("ZINO:APPLICATION", &checksum); diff --git a/zino-core/src/helper/str_array.rs b/zino-core/src/helper/str_array.rs index cd9a330e..0c7a5baa 100644 --- a/zino-core/src/helper/str_array.rs +++ b/zino-core/src/helper/str_array.rs @@ -46,8 +46,8 @@ mod tests { #[test] fn it_parses_str_array() { assert_eq!( - parse_str_array("id,name,array_length(roles,1)->roles_count"), - vec!["id", "name", "array_length(roles,1)->roles_count"], + parse_str_array("id,name,roles_count:array_length(roles,1)"), + vec!["id", "name", "roles_count:array_length(roles,1)"], ); } } diff --git a/zino-model/src/user/mod.rs b/zino-model/src/user/mod.rs index edc5dabd..484167b5 100644 --- a/zino-model/src/user/mod.rs +++ b/zino-model/src/user/mod.rs @@ -68,7 +68,6 @@ pub struct User { avatar: String, website: String, email: String, - gender: String, location: String, locale: String, mobile: String, diff --git a/zino/src/application/dioxus_desktop.rs b/zino/src/application/dioxus_desktop.rs index 29ac0926..50a16ebf 100644 --- a/zino/src/application/dioxus_desktop.rs +++ b/zino/src/application/dioxus_desktop.rs @@ -64,13 +64,18 @@ where } }); + let app_env = Self::env(); + let app_name = Self::name(); + let app_version = Self::version(); + let mut window_title = app_name; let mut app_window = WindowBuilder::new() - .with_title(Self::name()) + .with_title(app_name) .with_maximized(true) .with_decorations(true); if let Some(config) = Self::shared_state().get_config("window") { if let Some(title) = config.get_str("title") { app_window = app_window.with_title(title); + window_title = title; } if let Some(maximizable) = config.get_bool("maximizable") { app_window = app_window.with_maximizable(maximizable); @@ -90,6 +95,12 @@ where app_window = app_window.with_transparent(transparent); } } + tracing::warn!( + app_env, + app_name, + app_version, + "launch a window named `{window_title}`", + ); let app_config = Config::new().with_window(app_window); dioxus_desktop::launch_with_props(Self::app_root, Self::state_data(), app_config);