From cf716674806b6a94a5e8ab035ce85784cd848c92 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 10 Dec 2023 20:49:52 +0100 Subject: [PATCH 01/13] Prepare 0.3.0 --- Cargo.lock | 153 +++++++---------------------------------------------- Cargo.toml | 2 +- 2 files changed, 21 insertions(+), 134 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 30e80e8..4a29855 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -549,13 +549,12 @@ checksum = "186dce98367766de751c42c4f03970fc60fc012296e706ccbb9d5df9b6c1e271" [[package]] name = "colored" -version = "2.0.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -787,16 +786,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "flate2" version = "1.0.28" @@ -1084,12 +1073,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "hermit-abi" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" - [[package]] name = "html-escape" version = "0.2.13" @@ -1261,17 +1244,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.48.0", -] - [[package]] name = "itertools" version = "0.10.5" @@ -1566,9 +1538,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.150" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "linear-map" @@ -1586,12 +1558,6 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" -[[package]] -name = "linux-raw-sys" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" - [[package]] name = "local-channel" version = "0.1.5" @@ -1703,7 +1669,7 @@ dependencies = [ "libc", "log", "wasi", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1766,7 +1732,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -1827,7 +1793,7 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "portfolio" -version = "0.2.1" +version = "0.3.0" dependencies = [ "actix-files", "actix-web", @@ -2172,19 +2138,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.38.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - [[package]] name = "ryu" version = "1.0.16" @@ -2383,7 +2336,7 @@ dependencies = [ "colored", "log", "time", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2428,7 +2381,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2578,7 +2531,7 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "socket2 0.5.5", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2892,16 +2845,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", + "windows-targets", ] [[package]] @@ -2910,28 +2854,13 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] @@ -2940,84 +2869,42 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" - [[package]] name = "winreg" version = "0.50.0" @@ -3025,7 +2912,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f6d10a0..1060943 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "portfolio" -version = "0.2.3" +version = "0.3.0" edition = "2021" [lib] -- 2.45.3 From 06ab69d1b8163290a30e388146f61b46657c86ab Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 10 Dec 2023 20:54:18 +0100 Subject: [PATCH 02/13] Rename markdowns folder to data_src folder --- Dockerfile | 2 +- {markdowns => data_src}/posts/test.md | 0 src/app/models/post.rs | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename {markdowns => data_src}/posts/test.md (100%) diff --git a/Dockerfile b/Dockerfile index c60fb6e..644d00a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,7 @@ COPY --from=builder /app/target/site /app/site # Copy Cargo.toml if it’s needed at runtime COPY --from=builder /app/Cargo.toml /app/ # Copy all data files -COPY --from=builder /app/markdowns /app/markdowns +COPY --from=builder /app/data_src /app/data_src WORKDIR /app # Set any required env variables and diff --git a/markdowns/posts/test.md b/data_src/posts/test.md similarity index 100% rename from markdowns/posts/test.md rename to data_src/posts/test.md diff --git a/src/app/models/post.rs b/src/app/models/post.rs index f9a517a..39a6e88 100644 --- a/src/app/models/post.rs +++ b/src/app/models/post.rs @@ -61,7 +61,7 @@ cfg_if::cfg_if! { let mut posts: Vec = Vec::new(); - let folder_path = Path::new("markdowns").join(folder); + let folder_path = Path::new("data_src").join(folder); let paths = read_dir(folder_path).map_err(|e| e.to_string())?; for path_result in paths { -- 2.45.3 From 7dd090be7b9d2378afc1c6ae03c4f9eb4b6e4e14 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 10 Dec 2023 21:13:38 +0100 Subject: [PATCH 03/13] Add serde_yaml only for ssr + Add tags yml file --- Cargo.lock | 20 ++++++ Cargo.toml | 2 + data_src/tags.yml | 168 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 190 insertions(+) create mode 100644 data_src/tags.yml diff --git a/Cargo.lock b/Cargo.lock index 4a29855..3bc41c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1811,6 +1811,7 @@ dependencies = [ "log", "pulldown-cmark", "serde", + "serde_yaml", "simple_logger", "wasm-bindgen", ] @@ -2251,6 +2252,19 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.9.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "server_fn" version = "0.5.4" @@ -2675,6 +2689,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "unsafe-libyaml" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" + [[package]] name = "url" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index 1060943..8a4070f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,7 @@ futures = { version = "0.3", optional = true } simple_logger = { version = "4.2", optional = true } pulldown-cmark = { version = "0.9", optional = true } # Markdown parser gray_matter = { version = "0.2", optional = true } # frontmatter parser +serde_yaml = { version = "0.9", optional = true } [features] default = ["csr"] @@ -70,6 +71,7 @@ ssr = [ "dep:simple_logger", "dep:pulldown-cmark", "dep:gray_matter", + "dep:serde_yaml" ] [package.metadata.cargo-all-features] diff --git a/data_src/tags.yml b/data_src/tags.yml new file mode 100644 index 0000000..d5fb5bf --- /dev/null +++ b/data_src/tags.yml @@ -0,0 +1,168 @@ +tags: + rust: + name: Rust + url: https://www.rust-lang.org/ + groups: + - lang + - backend + - system + - web + java: + name: Java + url: https://www.java.com/fr/ + groups: + - lang + - backend + - desktop + cpp: + name: C++ + url: https://isocpp.org/ + groups: + - lang + - backend + - system + - game + react: + name: React + url: https://fr.legacy.reactjs.org/ + groups: + - frontend + symfony: + name: Symfony + url: https://symfony.com/ + groups: + - backend + - web + flutter: + name: Flutter + url: https://flutter.dev/ + groups: + - mobile + - desktop + ruby_on_rails: + name: Ruby on rails + url: https://rubyonrails.org/ + groups: + - backend + - frontend + - web + hotwired: + name: Hotwired + url: https://hotwired.dev/ + groups: + - frontend + - web + docker: + name: Docker + url: https://www.docker.com/ + groups: + - devops + steam_api: + name: Steam API + url: https://partner.steamgames.com/doc/sdk/api/example + groups: + - game + gitlab_ci: + name: Gitlab CI + url: https://docs.gitlab.com/ee/ci/ + groups: + - devops + unity: + name: Unity 3D + url: https://unity.com/fr + groups: + - game + wordpress: + name: Wordpress + url: https://wordpress.com/fr/ + groups: + - web + cordova: + name: Cordova + url: https://cordova.apache.org/ + groups: + - mobile + electron: + name: Electron + url: https://www.electronjs.org/ + groups: + - desktop + lwjgl: + name: LWJGL + url: https://www.lwjgl.org/ + groups: + - desktop + - game + opengl: + name: OpenGL + url: https://www.opengl.org/ + groups: + - desktop + - game + vulkan: + name: Vulkan + url: https://www.vulkan.org/ + groups: + - desktop + - game + midi: + name: MIDI + url: https://fr.wikipedia.org/wiki/Musical_Instrument_Digital_Interface + groups: + - desktop + - web + - music + - game + requirejs: + name: RequireJS + url: https://requirejs.org/ + groups: + - frontend + - web + webpack: + name: Webpack + url: https://webpack.js.org/ + groups: + - frontend + - web + vite: + name: Vite + url: https://vitejs.dev/ + groups: + - frontend + - web + maven: + name: Maven + url: https://maven.apache.org/ + groups: + - desktop + gradle: + name: Gradle + url: https://gradle.org/ + groups: + - desktop + - mobile + babylonjs: + name: BabylonJS + url: https://www.babylonjs.com/ + groups: + - game + rocket_rs: + name: Rocket.rs + url: https://rocket.rs/ + groups: + - backend + - web + actix_web: + name: Actix Web + url: https://actix.rs/ + groups: + - backend + - web + leptos: + name: Leptos + url: https://leptos.dev/ + groups: + - web + - backend + - frontend \ No newline at end of file -- 2.45.3 From dc80396b0578636b9f6ae4e74de458e021c3e9e5 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 12 Dec 2023 00:23:28 +0100 Subject: [PATCH 04/13] Tag: Add serde_yaml --- src/app/models/mod.rs | 6 +++++- src/app/models/tag.rs | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/app/models/tag.rs diff --git a/src/app/models/mod.rs b/src/app/models/mod.rs index 40d1b51..69d39bb 100644 --- a/src/app/models/mod.rs +++ b/src/app/models/mod.rs @@ -1,3 +1,7 @@ mod post; -pub use post::Post; \ No newline at end of file +pub use post::Post; + +mod tag; + +pub use tag::{Tags, Tag}; diff --git a/src/app/models/tag.rs b/src/app/models/tag.rs new file mode 100644 index 0000000..dda9a88 --- /dev/null +++ b/src/app/models/tag.rs @@ -0,0 +1,41 @@ +use std::collections::HashMap; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Serialize, Deserialize, Debug)] +pub struct Tag { + pub name : String, + pub url : String, + pub groups : Vec, +} + +#[derive(Clone, Serialize, Deserialize, Debug)] +pub struct Tags { + pub tags : HashMap, +} + +cfg_if::cfg_if! { + if #[cfg(feature = "ssr")] { + impl Tags { + fn from_content(content: String) -> Option { + let tags = serde_yaml::from_str(&content).ok()?; + + Some(Self { + tags + }) + } + + fn from_path(path: &std::path::Path) -> Option { + let content = std::fs::read_to_string(path); + let content = match content { + Ok(content) => content, + Err(e) => { + eprintln!("{:?}", e); + return None; + } + }; + + Self::from_content(content) + } + } + } +} -- 2.45.3 From 9cd7029ede6ccd4118d4d050b5ee2b1aca057bbf Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Tue, 12 Dec 2023 19:49:58 +0100 Subject: [PATCH 05/13] Begin add tags models + Parse file --- src/app/components/mod.rs | 2 +- src/app/models/tag.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/components/mod.rs b/src/app/components/mod.rs index 0250873..2eebd68 100644 --- a/src/app/components/mod.rs +++ b/src/app/components/mod.rs @@ -31,4 +31,4 @@ mod title; pub use title::Title; -pub use mon_parcours::{MonParcours}; \ No newline at end of file +pub use mon_parcours::MonParcours; diff --git a/src/app/models/tag.rs b/src/app/models/tag.rs index dda9a88..403afdc 100644 --- a/src/app/models/tag.rs +++ b/src/app/models/tag.rs @@ -36,6 +36,11 @@ cfg_if::cfg_if! { Self::from_content(content) } + + fn from_default() -> Option { + let path = std::path::Path::new("data_src").join("tags.yml"); + Self::from_path(&path) + } } } } -- 2.45.3 From 51f34eb290b798bbed9cd938ad09e08f9f2c4210 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 6 Jan 2024 21:13:10 +0100 Subject: [PATCH 06/13] Refactor posts parsing and begin add tags --- Cargo.lock | 2 + Cargo.toml | 8 +- data_src/posts/test.md | 3 + data_src/tags.yml | 168 ----------------------------- src/app/components/mon_parcours.rs | 2 +- src/app/mod.rs | 5 + src/app/models/mod.rs | 44 +++++++- src/app/models/post.rs | 76 +++++-------- src/app/models/tag.rs | 46 -------- src/app/pages/posts.rs | 39 ++++--- src/app/utils/data_src.rs | 33 ++++++ src/app/utils/mod.rs | 1 + src/main.rs | 1 + 13 files changed, 146 insertions(+), 282 deletions(-) delete mode 100644 data_src/tags.yml delete mode 100644 src/app/models/tag.rs create mode 100644 src/app/utils/data_src.rs create mode 100644 src/app/utils/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 3bc41c0..d129790 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1797,6 +1797,7 @@ version = "0.3.0" dependencies = [ "actix-files", "actix-web", + "anyhow", "cfg-if", "console_error_panic_hook", "console_log", @@ -1813,6 +1814,7 @@ dependencies = [ "serde", "serde_yaml", "simple_logger", + "thiserror", "wasm-bindgen", ] diff --git a/Cargo.toml b/Cargo.toml index 8a4070f..4bd2ef8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ crate-type = ["cdylib", "rlib"] [dependencies] leptos = { version = "0.5", features = ["nightly"] } -leptos_actix = { version = "0.5", optional = true } leptos_meta = { version = "0.5", features = ["nightly"] } leptos_router = { version = "0.5", features = ["nightly"] } gloo-net = { version = "0.4", features = ["http"] } @@ -36,11 +35,14 @@ console_error_panic_hook = { version = "0.1", optional = true } # dependecies for server (enable when ssr set) actix-files = { version = "0.6", optional = true } actix-web = { version = "4", features = ["macros"], optional = true } +leptos_actix = { version = "0.5", optional = true } futures = { version = "0.3", optional = true } simple_logger = { version = "4.2", optional = true } pulldown-cmark = { version = "0.9", optional = true } # Markdown parser gray_matter = { version = "0.2", optional = true } # frontmatter parser serde_yaml = { version = "0.9", optional = true } +anyhow = { version = "1.0", optional = true } +thiserror = { version = "1.0", optional = true } [features] default = ["csr"] @@ -71,7 +73,9 @@ ssr = [ "dep:simple_logger", "dep:pulldown-cmark", "dep:gray_matter", - "dep:serde_yaml" + "dep:serde_yaml", + "dep:anyhow", + "dep:thiserror" ] [package.metadata.cargo-all-features] diff --git a/data_src/posts/test.md b/data_src/posts/test.md index fea2c17..0cc74e5 100644 --- a/data_src/posts/test.md +++ b/data_src/posts/test.md @@ -1,10 +1,13 @@ --- image_path: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/783px-Test-Logo.svg.png?20150906031702" +slug: test_layout title: Testing layout date: 2023-11-26 description: Testing the layout of the site. project_link: none draft: true +tags: + - test --- # Heading 1 diff --git a/data_src/tags.yml b/data_src/tags.yml deleted file mode 100644 index d5fb5bf..0000000 --- a/data_src/tags.yml +++ /dev/null @@ -1,168 +0,0 @@ -tags: - rust: - name: Rust - url: https://www.rust-lang.org/ - groups: - - lang - - backend - - system - - web - java: - name: Java - url: https://www.java.com/fr/ - groups: - - lang - - backend - - desktop - cpp: - name: C++ - url: https://isocpp.org/ - groups: - - lang - - backend - - system - - game - react: - name: React - url: https://fr.legacy.reactjs.org/ - groups: - - frontend - symfony: - name: Symfony - url: https://symfony.com/ - groups: - - backend - - web - flutter: - name: Flutter - url: https://flutter.dev/ - groups: - - mobile - - desktop - ruby_on_rails: - name: Ruby on rails - url: https://rubyonrails.org/ - groups: - - backend - - frontend - - web - hotwired: - name: Hotwired - url: https://hotwired.dev/ - groups: - - frontend - - web - docker: - name: Docker - url: https://www.docker.com/ - groups: - - devops - steam_api: - name: Steam API - url: https://partner.steamgames.com/doc/sdk/api/example - groups: - - game - gitlab_ci: - name: Gitlab CI - url: https://docs.gitlab.com/ee/ci/ - groups: - - devops - unity: - name: Unity 3D - url: https://unity.com/fr - groups: - - game - wordpress: - name: Wordpress - url: https://wordpress.com/fr/ - groups: - - web - cordova: - name: Cordova - url: https://cordova.apache.org/ - groups: - - mobile - electron: - name: Electron - url: https://www.electronjs.org/ - groups: - - desktop - lwjgl: - name: LWJGL - url: https://www.lwjgl.org/ - groups: - - desktop - - game - opengl: - name: OpenGL - url: https://www.opengl.org/ - groups: - - desktop - - game - vulkan: - name: Vulkan - url: https://www.vulkan.org/ - groups: - - desktop - - game - midi: - name: MIDI - url: https://fr.wikipedia.org/wiki/Musical_Instrument_Digital_Interface - groups: - - desktop - - web - - music - - game - requirejs: - name: RequireJS - url: https://requirejs.org/ - groups: - - frontend - - web - webpack: - name: Webpack - url: https://webpack.js.org/ - groups: - - frontend - - web - vite: - name: Vite - url: https://vitejs.dev/ - groups: - - frontend - - web - maven: - name: Maven - url: https://maven.apache.org/ - groups: - - desktop - gradle: - name: Gradle - url: https://gradle.org/ - groups: - - desktop - - mobile - babylonjs: - name: BabylonJS - url: https://www.babylonjs.com/ - groups: - - game - rocket_rs: - name: Rocket.rs - url: https://rocket.rs/ - groups: - - backend - - web - actix_web: - name: Actix Web - url: https://actix.rs/ - groups: - - backend - - web - leptos: - name: Leptos - url: https://leptos.dev/ - groups: - - web - - backend - - frontend \ No newline at end of file diff --git a/src/app/components/mon_parcours.rs b/src/app/components/mon_parcours.rs index d07587b..427db64 100644 --- a/src/app/components/mon_parcours.rs +++ b/src/app/components/mon_parcours.rs @@ -62,7 +62,7 @@ const GRADLE_TAG : Lang<'static> = Lang { lang: "Gradle", url: "https://gradle.o const BABYLONJS_TAG : Lang<'static> = Lang { lang: "BabylonJS", url: "https://www.babylonjs.com/" }; const ROCKET_RS_TAG : Lang<'static> = Lang { lang: "Rocket", url: "https://rocket.rs/" }; const ACTIX_WEB_TAG : Lang<'static> = Lang { lang: "Actix Web", url: "https://actix.rs/" }; -const LEPTOS_TAG : Lang<'static> = Lang { lang: "Leptos", url: "https://leptos.dev/" }; +const _LEPTOS_TAG : Lang<'static> = Lang { lang: "Leptos", url: "https://leptos.dev/" }; #[component] diff --git a/src/app/mod.rs b/src/app/mod.rs index 1d304ce..87881e6 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,7 +1,12 @@ pub mod components; + pub mod models; + mod pages; +#[cfg(feature = "ssr")] +mod utils; + use leptos::*; use leptos_meta::*; use leptos_router::*; diff --git a/src/app/models/mod.rs b/src/app/models/mod.rs index 69d39bb..9375f3d 100644 --- a/src/app/models/mod.rs +++ b/src/app/models/mod.rs @@ -2,6 +2,46 @@ mod post; pub use post::Post; -mod tag; +cfg_if::cfg_if! { + if #[cfg(feature = "ssr")] { + use std::collections::HashMap; + use std::sync::Arc; -pub use tag::{Tags, Tag}; + pub struct Data { + pub posts: Vec>, + pub posts_by_slug: HashMap>, + pub posts_by_tag: HashMap>>, + } + + impl Data { + #[allow(dead_code)] // Use in main.rs + pub fn new() -> anyhow::Result { + let posts = crate::app::utils::data_src::get_all::("posts")? + .into_iter() + .map(|post| Arc::new(post)) + .collect::>(); + + let mut posts_by_slug : HashMap> = HashMap::new(); + let mut posts_by_tag : HashMap>> = HashMap::new(); + + for post in &posts { + posts_by_slug.insert(post.metadata.slug.clone(), post.clone()); + + for tag in &post.metadata.tags { + let tag = tag.to_lowercase(); + let posts = posts_by_tag.entry(tag).or_insert(Vec::new()); + posts.push(post.clone()); + } + } + + Ok(Self { + posts, + posts_by_slug, + posts_by_tag, + }) + } + } + + + } +} \ No newline at end of file diff --git a/src/app/models/post.rs b/src/app/models/post.rs index 39a6e88..04ae40e 100644 --- a/src/app/models/post.rs +++ b/src/app/models/post.rs @@ -1,34 +1,43 @@ use serde::{Deserialize, Serialize}; -#[derive(Clone, Serialize, Deserialize, Debug)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct PostMetadata { + pub slug: String, pub image_path: String, pub title: String, pub date: String, pub description: String, pub project_link: String, - pub draft: bool + pub draft: bool, + pub tags: Vec, } -#[derive(Clone, Serialize, Deserialize, Debug)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct Post { - pub slug : String, pub metadata: PostMetadata, pub content: String, } cfg_if::cfg_if! { if #[cfg(feature = "ssr")] { - impl Post { - fn from_content(content: String) -> Option { + #[derive(Debug, thiserror::Error)] + pub enum PostDeserializationError { + #[error("Invalid front matter")] + InvalidFrontMatter, + #[error("Invalid markdown")] + InvalidMarkdown, + } + + impl TryFrom for Post { + type Error = PostDeserializationError; + + fn try_from(content: String) -> Result { use gray_matter::{Matter, engine::YAML}; let matter = Matter::::new(); - let post_data = matter - .parse_with_struct::(&content)?; + .parse_with_struct::(&content) + .ok_or_else(|| PostDeserializationError::InvalidFrontMatter)?; - let metadata = post_data.data; - let slug = format!("{}_{}", metadata.date, metadata.title.to_lowercase().replace(' ', "_")); let content = post_data.content; use pulldown_cmark::{Parser, Options, html}; @@ -36,49 +45,14 @@ cfg_if::cfg_if! { let mut html_output = String::new(); html::push_html(&mut html_output, parser); - Some(Self { - slug, - metadata, - content: html_output, - }) - } - - fn from_path(path: &std::path::Path) -> Option { - let content = std::fs::read_to_string(path); - let content = match content { - Ok(content) => content, - Err(e) => { - eprintln!("{:?}", e); - return None; - } - }; - - Self::from_content(content) - } - - pub fn get_all(folder: &str) -> Result, String> { - use std::{path::Path, fs::read_dir}; - - let mut posts: Vec = Vec::new(); - - let folder_path = Path::new("data_src").join(folder); - let paths = read_dir(folder_path).map_err(|e| e.to_string())?; - - for path_result in paths { - let path = match path_result { - Ok(path) => path.path(), - Err(e) => { - eprintln!("{:?}", e); - continue; - } - }; - - if let Some(post) = Self::from_path(&path) { - posts.push(post); - } + if html_output.is_empty() { + return Err(PostDeserializationError::InvalidMarkdown); } - Ok(posts) + Ok(Self { + metadata: post_data.data, + content: html_output, + }) } } } diff --git a/src/app/models/tag.rs b/src/app/models/tag.rs deleted file mode 100644 index 403afdc..0000000 --- a/src/app/models/tag.rs +++ /dev/null @@ -1,46 +0,0 @@ -use std::collections::HashMap; -use serde::{Deserialize, Serialize}; - -#[derive(Clone, Serialize, Deserialize, Debug)] -pub struct Tag { - pub name : String, - pub url : String, - pub groups : Vec, -} - -#[derive(Clone, Serialize, Deserialize, Debug)] -pub struct Tags { - pub tags : HashMap, -} - -cfg_if::cfg_if! { - if #[cfg(feature = "ssr")] { - impl Tags { - fn from_content(content: String) -> Option { - let tags = serde_yaml::from_str(&content).ok()?; - - Some(Self { - tags - }) - } - - fn from_path(path: &std::path::Path) -> Option { - let content = std::fs::read_to_string(path); - let content = match content { - Ok(content) => content, - Err(e) => { - eprintln!("{:?}", e); - return None; - } - }; - - Self::from_content(content) - } - - fn from_default() -> Option { - let path = std::path::Path::new("data_src").join("tags.yml"); - Self::from_path(&path) - } - } - } -} diff --git a/src/app/pages/posts.rs b/src/app/pages/posts.rs index 453f178..96c2242 100644 --- a/src/app/pages/posts.rs +++ b/src/app/pages/posts.rs @@ -10,23 +10,38 @@ use crate::app::{ #[server] pub async fn get_posts() -> Result, ServerFnError> { - let posts = Post::get_all("posts") - .map_err(|e| ServerFnError::ServerError(e.to_string()))?; - - Ok(posts) + leptos_actix::extract( + |data: actix_web::web::Data| async move { + let data = data.into_inner(); + data.posts + .iter() + .map(|post| { + Post { + metadata: post.metadata.clone(), + content: post.content.clone(), + } + }) + .collect::, >() + }, + ).await } #[server] pub async fn get_post( slug: String ) -> Result { - let posts = Post::get_all("posts") - .map_err(|e| ServerFnError::ServerError(e.to_string()))?; - - let post = posts.into_iter().find(|post| post.slug == slug) - .ok_or(ServerFnError::ServerError("Post not found".to_string()))?; - - Ok(post) + leptos_actix::extract( + |data: actix_web::web::Data| async move { + let data = data.into_inner(); + data.posts_by_slug.get(&slug) + .and_then(|post| Some(Post { + metadata: post.metadata.clone(), + content: post.content.clone(), + })) + }, + ) + .await + .and_then(|post| post.ok_or_else(|| ServerFnError::ServerError("Post not found".to_string()))) } #[component] @@ -37,7 +52,7 @@ pub fn PostList() -> impl IntoView { posts.and_then(|posts| { posts.iter() .map(|post| view! { - + format!("Image { diff --git a/src/app/utils/data_src.rs b/src/app/utils/data_src.rs new file mode 100644 index 0000000..09fff16 --- /dev/null +++ b/src/app/utils/data_src.rs @@ -0,0 +1,33 @@ +#[allow(dead_code)] // Use in main.rs +pub fn get_all(folder: &str) -> anyhow::Result> +where + T: TryFrom, +{ + use std::{path::Path, fs::read_dir}; + + let mut datas: Vec = Vec::new(); + + let folder_path = Path::new("data_src").join(folder); + let paths = read_dir(folder_path)?; + + for path_result in paths { + let data : Result = path_result + .and_then(|path| std::fs::File::open(path.path())) + .map_err(|e| format!("Open file Error: {:?}", e)) + .and_then(|mut file| { + use std::io::Read; + let mut content = String::new(); + file.read_to_string(&mut content) + .map_err(|e| format!("Read file Error: {:?}", e))?; + T::try_from(content) + .map_err(|_e| "Parse file Error".to_string()) + }); + + match data { + Ok(data) => datas.push(data), + Err(e) => eprintln!("{:?}", e), + } + } + + Ok(datas) +} \ No newline at end of file diff --git a/src/app/utils/mod.rs b/src/app/utils/mod.rs new file mode 100644 index 0000000..0dfbad9 --- /dev/null +++ b/src/app/utils/mod.rs @@ -0,0 +1 @@ +pub(crate) mod data_src; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 53782cf..a918395 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,6 +24,7 @@ cfg_if! { let site_root = &leptos_options.site_root; let routes = &routes; App::new() + .app_data(web::Data::new(app::models::Data::new().unwrap())) // Must panic if data can't be loaded .route("/api/{tail:.*}", leptos_actix::handle_server_fns()) .leptos_routes(leptos_options.to_owned(), routes.to_owned(), || view! { }) .service(Files::new("/", site_root)) -- 2.45.3 From 921658075f3730f9505d1558b6b630faf8415688 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 6 Jan 2024 21:58:24 +0100 Subject: [PATCH 07/13] Fix logger --- src/app/utils/data_src.rs | 2 +- src/lib.rs | 9 +++++---- src/main.rs | 7 +++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/app/utils/data_src.rs b/src/app/utils/data_src.rs index 09fff16..d341f1a 100644 --- a/src/app/utils/data_src.rs +++ b/src/app/utils/data_src.rs @@ -25,7 +25,7 @@ where match data { Ok(data) => datas.push(data), - Err(e) => eprintln!("{:?}", e), + Err(e) => log::warn!("{}", e), } } diff --git a/src/lib.rs b/src/lib.rs index 346a48f..b214cef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,10 +12,10 @@ cfg_if! { _ = console_log::init_with_level(log::Level::Debug); console_error_panic_hook::set_once(); - logging::log!("hydrate mode - hydrating"); - logging::log!("Portfolio version : {}", env!("CARGO_PKG_VERSION")); + log::info!("hydrate mode - hydrating"); + log::info!("Portfolio version : {}", env!("CARGO_PKG_VERSION")); - leptos::mount_to_body(|| { + mount_to_body(|| { view! { } }); } @@ -30,7 +30,8 @@ cfg_if! { _ = console_log::init_with_level(log::Level::Debug); console_error_panic_hook::set_once(); - logging::log!("csr mode - mounting to body"); + log::info!("csr mode - mounting to body"); + log::info!("Portfolio version : {}", env!("CARGO_PKG_VERSION")); mount_to_body(|| { view! { } diff --git a/src/main.rs b/src/main.rs index a918395..fac6503 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,9 +8,16 @@ cfg_if! { use leptos::*; use crate::app::*; use leptos_actix::{generate_route_list, LeptosRoutes}; + use simple_logger::SimpleLogger; #[actix_web::main] async fn main() -> std::io::Result<()> { + // Configure logger + SimpleLogger::new() + .env() + .init() + .unwrap(); + // Setting this to None means we'll be using cargo-leptos and its env vars. let conf = get_configuration(None).await.unwrap(); -- 2.45.3 From 7611176a8e3ce8355724a934366e5d2cd2ad3015 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 6 Jan 2024 22:23:36 +0100 Subject: [PATCH 08/13] Avoid load data for each worker + fix Clippy warning --- Dockerfile | 2 +- src/app/models/mod.rs | 7 +++++-- src/main.rs | 6 +++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 644d00a..c6a6a6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ COPY --from=builder /app/data_src /app/data_src WORKDIR /app # Set any required env variables and -ENV RUST_LOG="info" +ENV RUST_LOG="warn" ENV APP_ENVIRONMENT="production" ENV LEPTOS_SITE_ADDR="0.0.0.0:8080" ENV LEPTOS_SITE_ROOT="site" diff --git a/src/app/models/mod.rs b/src/app/models/mod.rs index 9375f3d..73f805a 100644 --- a/src/app/models/mod.rs +++ b/src/app/models/mod.rs @@ -18,7 +18,7 @@ cfg_if::cfg_if! { pub fn new() -> anyhow::Result { let posts = crate::app::utils::data_src::get_all::("posts")? .into_iter() - .map(|post| Arc::new(post)) + .map(Arc::new) .collect::>(); let mut posts_by_slug : HashMap> = HashMap::new(); @@ -29,11 +29,14 @@ cfg_if::cfg_if! { for tag in &post.metadata.tags { let tag = tag.to_lowercase(); - let posts = posts_by_tag.entry(tag).or_insert(Vec::new()); + let posts = posts_by_tag.entry(tag).or_default(); posts.push(post.clone()); } } + log::info!("Loaded {} posts", posts.len()); + log::info!("Found {} tags", posts_by_tag.len()); + Ok(Self { posts, posts_by_slug, diff --git a/src/main.rs b/src/main.rs index fac6503..fb799b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,10 +14,14 @@ cfg_if! { async fn main() -> std::io::Result<()> { // Configure logger SimpleLogger::new() + .with_level(log::LevelFilter::Info) .env() .init() .unwrap(); + // Load required data + let data = web::Data::::new(models::Data::new().unwrap()); + // Setting this to None means we'll be using cargo-leptos and its env vars. let conf = get_configuration(None).await.unwrap(); @@ -31,7 +35,7 @@ cfg_if! { let site_root = &leptos_options.site_root; let routes = &routes; App::new() - .app_data(web::Data::new(app::models::Data::new().unwrap())) // Must panic if data can't be loaded + .app_data(web::Data::clone(&data)) // Must panic if data can't be loaded .route("/api/{tail:.*}", leptos_actix::handle_server_fns()) .leptos_routes(leptos_options.to_owned(), routes.to_owned(), || view! { }) .service(Files::new("/", site_root)) -- 2.45.3 From 315474b70849595710d46fecd2c730a59dda8f1b Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 7 Jan 2024 00:22:49 +0100 Subject: [PATCH 09/13] Update cargo dependencies --- Cargo.lock | 300 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 8 +- 2 files changed, 149 insertions(+), 159 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d129790..bbb1144 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,16 +21,15 @@ dependencies = [ [[package]] name = "actix-files" -version = "0.6.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d832782fac6ca7369a70c9ee9a20554623c5e51c76e190ad151780ebea1cf689" +checksum = "cc517050e349356239da19a5e100cd61c21658b3ae183b02c1c6799c581bddf3" dependencies = [ "actix-http", "actix-service", "actix-utils", "actix-web", - "askama_escape", - "bitflags 1.3.2", + "bitflags 2.4.1", "bytes", "derive_more", "futures-core", @@ -40,19 +39,20 @@ dependencies = [ "mime_guess", "percent-encoding", "pin-project-lite", + "v_htmlescape", ] [[package]] name = "actix-http" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92ef85799cba03f76e4f7c10f533e66d87c9a7e7055f3391f09000ad8351bc9" +checksum = "129d4c88e98860e1758c5de288d1632b07970a16d59bdf7b8d66053d582bb71f" dependencies = [ "actix-codec", "actix-rt", "actix-service", "actix-utils", - "ahash 0.8.6", + "ahash 0.8.7", "base64", "bitflags 2.4.1", "brotli", @@ -88,14 +88,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "actix-router" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" +checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" dependencies = [ "bytestring", "http", @@ -126,7 +126,7 @@ dependencies = [ "futures-core", "futures-util", "mio", - "socket2 0.5.5", + "socket2", "tokio", "tracing", ] @@ -154,9 +154,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.4.0" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4a5b5e29603ca8c94a77c65cf874718ceb60292c5a5c3e5f4ace041af462b9" +checksum = "e43428f3bf11dee6d166b00ec2df4e3aa8cc1606aaa0b7433c146852e2f4e03b" dependencies = [ "actix-codec", "actix-http", @@ -167,7 +167,7 @@ dependencies = [ "actix-service", "actix-utils", "actix-web-codegen", - "ahash 0.8.6", + "ahash 0.8.7", "bytes", "bytestring", "cfg-if", @@ -187,7 +187,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "smallvec", - "socket2 0.5.5", + "socket2", "time", "url", ] @@ -201,7 +201,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", "getrandom", @@ -275,15 +275,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "askama_escape" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "async-recursion" @@ -293,18 +287,18 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -316,7 +310,7 @@ dependencies = [ "attribute-derive-macro", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -332,7 +326,7 @@ dependencies = [ "proc-macro2", "quote", "quote-use", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -655,9 +649,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -718,22 +712,22 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] [[package]] name = "derive-where" -version = "1.2.6" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d9b1fc2a6d7e19c89e706a3769e31ee862ac7a4c810c7c0ff3910e1a42a4ce" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -819,9 +813,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -834,9 +828,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -844,15 +838,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -861,38 +855,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -966,9 +960,9 @@ dependencies = [ [[package]] name = "gloo-net" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ac9e8288ae2c632fa9f8657ac70bfe38a1530f345282d7ba66a1f70b72b7dc4" +checksum = "43aaa242d1239a8822c15c645f02166398da4f8b5c4bae795c1f5b44e9eee173" dependencies = [ "futures-channel", "futures-core", @@ -1069,7 +1063,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.7", "allocator-api2", ] @@ -1124,9 +1118,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -1139,7 +1133,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2", "tokio", "tower-service", "tracing", @@ -1234,9 +1228,9 @@ checksum = "71dd52191aae121e8611f1e8dc3e324dd0dd1dee1e6dd91d10ee07a3cfb4d9d8" [[package]] name = "inventory" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0508c56cfe9bfd5dfeb0c22ab9a6abfda2f27bdca422132e494266351ed8d83c" +checksum = "c8573b2b1fb643a372c73b23f4da5f888677feef3305146d68a539250a9bccc7" [[package]] name = "ipnet" @@ -1395,7 +1389,7 @@ dependencies = [ "quote", "rstml", "serde", - "syn 2.0.39", + "syn 2.0.48", "walkdir", ] @@ -1442,7 +1436,7 @@ dependencies = [ "quote", "rstml", "server_fn_macro", - "syn 2.0.39", + "syn 2.0.48", "tracing", "uuid", ] @@ -1609,7 +1603,7 @@ dependencies = [ "manyhow-macros", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1625,9 +1619,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" @@ -1693,9 +1687,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -1770,7 +1764,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1787,9 +1781,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" [[package]] name = "portfolio" @@ -1802,7 +1796,7 @@ dependencies = [ "console_error_panic_hook", "console_log", "futures", - "gloo-net 0.4.0", + "gloo-net 0.5.0", "gray_matter", "leptos", "leptos_actix", @@ -1832,12 +1826,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1876,9 +1870,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -1891,7 +1885,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "version_check", "yansi", ] @@ -1930,9 +1924,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1945,7 +1939,7 @@ checksum = "a7b5abe3fe82fdeeb93f44d66a7b444dedf2e4827defb0a8e69c437b2de2ef94" dependencies = [ "quote", "quote-use-macros", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1957,7 +1951,7 @@ dependencies = [ "derive-where", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2045,9 +2039,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ "base64", "bytes", @@ -2080,12 +2074,13 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.42" +version = "0.7.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" +checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" dependencies = [ "bitvec", "bytecheck", + "bytes", "hashbrown 0.12.3", "ptr_meta", "rend", @@ -2097,9 +2092,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.42" +version = "0.7.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" +checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" dependencies = [ "proc-macro2", "quote", @@ -2115,7 +2110,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.39", + "syn 2.0.48", "syn_derive", "thiserror", ] @@ -2170,21 +2165,21 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "self_cell" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e388332cd64eb80cd595a00941baf513caffae8dce9cfd0467fc9c66397dade6" +checksum = "58bf37232d3bb9a2c4e641ca2a11d83b5062066f88df7fed36c28772046d65ba" [[package]] name = "semver" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] @@ -2202,20 +2197,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -2256,9 +2251,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.27" +version = "0.9.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" +checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" dependencies = [ "indexmap", "itoa", @@ -2287,7 +2282,7 @@ dependencies = [ "serde_json", "serde_qs", "server_fn_macro_default", - "syn 2.0.39", + "syn 2.0.48", "thiserror", "xxhash-rust", ] @@ -2303,7 +2298,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.39", + "syn 2.0.48", "xxhash-rust", ] @@ -2314,7 +2309,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7256ba61dfadb220598db418376e7bc2a34b96df36c4dc48f24ffe161810fc0b" dependencies = [ "server_fn_macro", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2345,9 +2340,9 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple_logger" -version = "4.3.0" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0ca6504625ee1aa5fda33913d2005eab98c7a42dd85f116ecce3ff54c9d3ef" +checksum = "8e7e46c8c90251d47d08b28b8a419ffb4aede0f87c2eea95e17d1d5bacbf3ef1" dependencies = [ "colored", "log", @@ -2380,16 +2375,6 @@ version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.5" @@ -2419,9 +2404,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -2437,7 +2422,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2469,29 +2454,29 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", @@ -2511,9 +2496,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -2535,9 +2520,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -2546,7 +2531,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2", "windows-sys", ] @@ -2599,7 +2584,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2634,7 +2619,7 @@ checksum = "982ee4197351b5c9782847ef5ec1fdcaf50503fb19d68f9771adae314e72b492" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2693,9 +2678,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unsafe-libyaml" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" +checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" [[package]] name = "url" @@ -2723,6 +2708,12 @@ dependencies = [ "getrandom", ] +[[package]] +name = "v_htmlescape" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e8257fbc510f0a46eb602c10215901938b5c2a7d5e70fc11483b1d3c9b5b18c" + [[package]] name = "version_check" version = "0.9.4" @@ -2775,7 +2766,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -2809,7 +2800,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2948,9 +2939,9 @@ dependencies = [ [[package]] name = "xxhash-rust" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" +checksum = "53be06678ed9e83edb1745eb72efc0bbcd7b5c3c35711a860906aed827a13d61" [[package]] name = "yaml-rust" @@ -2969,40 +2960,39 @@ checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" [[package]] name = "zerocopy" -version = "0.7.30" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306dca4455518f1f31635ec308b6b3e4eb1b11758cefafc782827d0aa7acb5c7" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.30" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be912bf68235a88fbefd1b73415cb218405958d1655b2ece9035a19920bdf6ba" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "zstd" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 4bd2ef8..f26e679 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib", "rlib"] leptos = { version = "0.5", features = ["nightly"] } leptos_meta = { version = "0.5", features = ["nightly"] } leptos_router = { version = "0.5", features = ["nightly"] } -gloo-net = { version = "0.4", features = ["http"] } +gloo-net = { version = "0.5", features = ["http"] } log = "0.4" cfg-if = "1.0" serde = "1.0" @@ -29,15 +29,15 @@ leptos_icons = { version = "0.1.0", features = [ # dependecies for client (enable when csr or hydrate set) wasm-bindgen = { version = "0.2", optional = true } -console_log = { version = "1", optional = true } +console_log = { version = "1.0", optional = true } console_error_panic_hook = { version = "0.1", optional = true } # dependecies for server (enable when ssr set) actix-files = { version = "0.6", optional = true } -actix-web = { version = "4", features = ["macros"], optional = true } +actix-web = { version = "4.4", features = ["macros"], optional = true } leptos_actix = { version = "0.5", optional = true } futures = { version = "0.3", optional = true } -simple_logger = { version = "4.2", optional = true } +simple_logger = { version = "4.3", optional = true } pulldown-cmark = { version = "0.9", optional = true } # Markdown parser gray_matter = { version = "0.2", optional = true } # frontmatter parser serde_yaml = { version = "0.9", optional = true } -- 2.45.3 From cf65d5b8e93998defde4abd67f08f6a2ea4eaf70 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 7 Jan 2024 00:23:12 +0100 Subject: [PATCH 10/13] Fix css hot reload --- Cargo.toml | 2 ++ src/main.rs | 7 +++++++ style/main.scss | 0 3 files changed, 9 insertions(+) create mode 100644 style/main.scss diff --git a/Cargo.toml b/Cargo.toml index f26e679..1ef83e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,7 +100,9 @@ opt-level = 'z' name = "portfolio" site-root = "target/site" site-pkg-dir = "pkg" +style-file = "style/main.scss" # Important for Hot Reload to work properly (File must exist) tailwind-input-file = "style/portfolio.css" +watch-additional-files = ["data_src"] assets-dir = "public" site-addr = "127.0.0.1:3000" reload-port = 3001 diff --git a/src/main.rs b/src/main.rs index fb799b0..b735169 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,12 @@ cfg_if! { use leptos_actix::{generate_route_list, LeptosRoutes}; use simple_logger::SimpleLogger; + #[get("/style.css")] + async fn css() -> impl Responder { + actix_files::NamedFile::open_async("./style/output.css").await + } + + #[actix_web::main] async fn main() -> std::io::Result<()> { // Configure logger @@ -38,6 +44,7 @@ cfg_if! { .app_data(web::Data::clone(&data)) // Must panic if data can't be loaded .route("/api/{tail:.*}", leptos_actix::handle_server_fns()) .leptos_routes(leptos_options.to_owned(), routes.to_owned(), || view! { }) + .service(css) .service(Files::new("/", site_root)) .wrap(middleware::Compress::default()) }) diff --git a/style/main.scss b/style/main.scss new file mode 100644 index 0000000..e69de29 -- 2.45.3 From d353161c9290521d7b166c2ee568681547452aa5 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sun, 7 Jan 2024 00:23:25 +0100 Subject: [PATCH 11/13] Add tags in post --- src/app/components/title.rs | 3 +- src/app/pages/posts.rs | 91 +++++++++++++++++++++++++------------ style/post.css | 10 +++- 3 files changed, 74 insertions(+), 30 deletions(-) diff --git a/src/app/components/title.rs b/src/app/components/title.rs index b625c1d..e834a8d 100644 --- a/src/app/components/title.rs +++ b/src/app/components/title.rs @@ -1,4 +1,5 @@ use leptos::*; +use leptos_router::A; #[component] pub fn Title( @@ -8,7 +9,7 @@ pub fn Title( ) -> impl IntoView { view! {
- r"< Retour" + r"< Retour"

{title}

diff --git a/src/app/pages/posts.rs b/src/app/pages/posts.rs index 96c2242..1c6eb1a 100644 --- a/src/app/pages/posts.rs +++ b/src/app/pages/posts.rs @@ -9,12 +9,18 @@ use crate::app::{ }; #[server] -pub async fn get_posts() -> Result, ServerFnError> { +pub async fn get_posts( + tag: Option +) -> Result, ServerFnError> { leptos_actix::extract( |data: actix_web::web::Data| async move { let data = data.into_inner(); - data.posts - .iter() + let default = vec![]; + let posts = match tag { + Some(tag) => data.posts_by_tag.get(&tag).unwrap_or(&default), + None => &data.posts + }; + posts.iter() .map(|post| { Post { metadata: post.metadata.clone(), @@ -44,44 +50,72 @@ pub async fn get_post( .and_then(|post| post.ok_or_else(|| ServerFnError::ServerError("Post not found".to_string()))) } +#[component] +pub fn PostTags( + tags: Vec +) -> impl IntoView { + view! { +
+ { + tags.into_iter().map(|tag| view! { {tag}}).collect_view() + } +
+ } +} + +#[component] +pub fn PostListCard( + post: Post +) -> impl IntoView { + view! { +
+ format!("Image + + { + if post.metadata.draft { + Some(view!{ +
+ +
+ }) + } else { + None + } + } + +
+ +

{post.metadata.title.clone()}

+

{post.metadata.description.clone()}

+ {post.metadata.date.clone()} +
+
+ } +} + #[component] pub fn PostList() -> impl IntoView { - let posts = create_resource(|| (), |_| get_posts()); + let query = use_query_map(); + let tag = move || query.with(|query| query.get("tag").cloned()); + let posts = create_resource(move || tag(), move |_| get_posts(tag())); let posts_view = move || { posts.and_then(|posts| { posts.iter() - .map(|post| view! { - - format!("Image - - { - if post.metadata.draft { - Some(view!{ -
- -
- }) - } else { - None - } - } - -
-

{post.metadata.title.clone()}

-

{post.metadata.description.clone()}

- {post.metadata.date.clone()} -
-
- }) + .map(|post| view! { }) .collect_view() }) }; + let title = move || match tag() { + Some(tag) => view! { }, + None => view! { <Title href="/".to_string() title="Posts".to_string()/> } + }; + view! { <Suspense fallback=move || view! { <Loading title="Chargement des posts...".to_string() /> }> <main class="posts"> - <Title href="/".to_string() title="Posts".to_string()/> + { title } <div class="posts__cards">{posts_view}</div> </main> @@ -101,6 +135,7 @@ pub fn PostElement() -> impl IntoView { view! { <> <Title href="/posts".to_string() title=post.metadata.title.clone()/> + <PostTags tags=post.metadata.tags.clone()/> { if post.metadata.draft { Some(view!{ diff --git a/style/post.css b/style/post.css index d3823f5..0c7355e 100644 --- a/style/post.css +++ b/style/post.css @@ -42,13 +42,21 @@ & ol li { @apply list-decimal list-inside; } + + & blockquote { + @apply border-l-4 border-primary/50 dark:border-dark_primary/50 pl-3 my-3; + } + + & .tags_list { + @apply flex flex-row flex-wrap gap-2; + } } .posts { & > .posts__cards { @apply grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 m-5; - & > a { + & > div { @apply rounded-xl overflow-hidden relative; @apply bg-primary/10 dark:bg-dark_primary/10; @apply shadow-md shadow-primary/5 dark:shadow-dark_primary/5; -- 2.45.3 From ac51c71935611466ff79c30e52a4f9a706d21144 Mon Sep 17 00:00:00 2001 From: Florian RICHER <florian.richer@unova.fr> Date: Sun, 7 Jan 2024 00:46:20 +0100 Subject: [PATCH 12/13] Fix link in title --- src/app/pages/posts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/posts.rs b/src/app/pages/posts.rs index 1c6eb1a..832e81b 100644 --- a/src/app/pages/posts.rs +++ b/src/app/pages/posts.rs @@ -85,7 +85,7 @@ pub fn PostListCard( <div> <PostTags tags=post.metadata.tags.clone()/> - <h2>{post.metadata.title.clone()}</h2> + <h2><A href=format!("/posts/{}", post.metadata.slug.clone())>{post.metadata.title.clone()}</A></h2> <p>{post.metadata.description.clone()}</p> <span>{post.metadata.date.clone()}</span> </div> -- 2.45.3 From c8ccd46efb6f7c1df55625c99440f82a49711b29 Mon Sep 17 00:00:00 2001 From: Florian RICHER <florian.richer@unova.fr> Date: Sun, 7 Jan 2024 00:48:13 +0100 Subject: [PATCH 13/13] Bump version to 0.4.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1ef83e1..27bc945 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "portfolio" -version = "0.3.0" +version = "0.4.0" edition = "2021" [lib] -- 2.45.3