From 73289cdaa40e5de462eb2c08b7ed4627cbfa94f5 Mon Sep 17 00:00:00 2001 From: Jai A Date: Mon, 9 Sep 2024 19:04:54 -0700 Subject: [PATCH] fix cli build --- .github/workflows/app-release.yml | 2 +- .github/workflows/ci.yml | 2 +- Cargo.lock | 26 +++++++++++++------------- Cargo.toml | 2 +- apps/app/Cargo.toml | 4 ++-- apps/app/README.md | 2 +- packages/app-lib/Cargo.toml | 2 +- packages/app-lib/src/state/cache.rs | 15 ++++++++++++--- 8 files changed, 32 insertions(+), 23 deletions(-) diff --git a/.github/workflows/app-release.yml b/.github/workflows/app-release.yml index 15d85eada..b3e31e84a 100644 --- a/.github/workflows/app-release.yml +++ b/.github/workflows/app-release.yml @@ -42,7 +42,7 @@ jobs: components: rustfmt, clippy - name: Install Tauri CLI - run: cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev c2b059b85370e1a7018faf3286d2cd8b8ce58a38 + run: cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev 5b26cbff93fe4697338e56dfc7299ac8864b3445 - name: Setup rust cache uses: actions/cache@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index def3365b0..dac31ac21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf - name: Install Tauri CLI - run: cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev c2b059b85370e1a7018faf3286d2cd8b8ce58a38 + run: cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev 5b26cbff93fe4697338e56dfc7299ac8864b3445 - name: Setup Node.JS environment uses: actions/setup-node@v4 diff --git a/Cargo.lock b/Cargo.lock index 07b242e40..6a01b0d2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5259,7 +5259,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" version = "2.0.0-rc.10" -source = "git+https://github.com/modrinth/tauri?rev=c2b059b#c2b059b85370e1a7018faf3286d2cd8b8ce58a38" +source = "git+https://github.com/modrinth/tauri?rev=5b26cbf#5b26cbff93fe4697338e56dfc7299ac8864b3445" dependencies = [ "anyhow", "bytes", @@ -5293,7 +5293,7 @@ dependencies = [ "tauri-macros", "tauri-runtime", "tauri-runtime-wry", - "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=c2b059b)", + "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=5b26cbf)", "thiserror", "tokio", "tray-icon", @@ -5308,7 +5308,7 @@ dependencies = [ [[package]] name = "tauri-build" version = "2.0.0-rc.9" -source = "git+https://github.com/modrinth/tauri?rev=c2b059b#c2b059b85370e1a7018faf3286d2cd8b8ce58a38" +source = "git+https://github.com/modrinth/tauri?rev=5b26cbf#5b26cbff93fe4697338e56dfc7299ac8864b3445" dependencies = [ "anyhow", "cargo_toml", @@ -5322,7 +5322,7 @@ dependencies = [ "serde", "serde_json", "tauri-codegen", - "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=c2b059b)", + "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=5b26cbf)", "tauri-winres", "toml 0.8.19", "walkdir", @@ -5331,7 +5331,7 @@ dependencies = [ [[package]] name = "tauri-codegen" version = "2.0.0-rc.9" -source = "git+https://github.com/modrinth/tauri?rev=c2b059b#c2b059b85370e1a7018faf3286d2cd8b8ce58a38" +source = "git+https://github.com/modrinth/tauri?rev=5b26cbf#5b26cbff93fe4697338e56dfc7299ac8864b3445" dependencies = [ "base64 0.22.1", "brotli", @@ -5346,7 +5346,7 @@ dependencies = [ "serde_json", "sha2", "syn 2.0.77", - "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=c2b059b)", + "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=5b26cbf)", "thiserror", "time", "url", @@ -5357,14 +5357,14 @@ dependencies = [ [[package]] name = "tauri-macros" version = "2.0.0-rc.8" -source = "git+https://github.com/modrinth/tauri?rev=c2b059b#c2b059b85370e1a7018faf3286d2cd8b8ce58a38" +source = "git+https://github.com/modrinth/tauri?rev=5b26cbf#5b26cbff93fe4697338e56dfc7299ac8864b3445" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.77", "tauri-codegen", - "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=c2b059b)", + "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=5b26cbf)", ] [[package]] @@ -5543,7 +5543,7 @@ dependencies = [ [[package]] name = "tauri-runtime" version = "2.0.0-rc.9" -source = "git+https://github.com/modrinth/tauri?rev=c2b059b#c2b059b85370e1a7018faf3286d2cd8b8ce58a38" +source = "git+https://github.com/modrinth/tauri?rev=5b26cbf#5b26cbff93fe4697338e56dfc7299ac8864b3445" dependencies = [ "dpi", "gtk", @@ -5552,7 +5552,7 @@ dependencies = [ "raw-window-handle 0.6.2", "serde", "serde_json", - "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=c2b059b)", + "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=5b26cbf)", "thiserror", "url", "windows 0.58.0", @@ -5561,7 +5561,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" version = "2.0.0-rc.9" -source = "git+https://github.com/modrinth/tauri?rev=c2b059b#c2b059b85370e1a7018faf3286d2cd8b8ce58a38" +source = "git+https://github.com/modrinth/tauri?rev=5b26cbf#5b26cbff93fe4697338e56dfc7299ac8864b3445" dependencies = [ "cocoa 0.26.0", "gtk", @@ -5573,7 +5573,7 @@ dependencies = [ "softbuffer", "tao", "tauri-runtime", - "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=c2b059b)", + "tauri-utils 2.0.0-rc.9 (git+https://github.com/modrinth/tauri?rev=5b26cbf)", "url", "webkit2gtk", "webview2-com", @@ -5617,7 +5617,7 @@ dependencies = [ [[package]] name = "tauri-utils" version = "2.0.0-rc.9" -source = "git+https://github.com/modrinth/tauri?rev=c2b059b#c2b059b85370e1a7018faf3286d2cd8b8ce58a38" +source = "git+https://github.com/modrinth/tauri?rev=5b26cbf#5b26cbff93fe4697338e56dfc7299ac8864b3445" dependencies = [ "brotli", "cargo_metadata", diff --git a/Cargo.toml b/Cargo.toml index 30203536e..944016de2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,4 @@ opt-level = 3 [patch.crates-io] wry = { git = "https://github.com/modrinth/wry", rev = "5840108" } -tauri = { git = "https://github.com/modrinth/tauri", rev = "c2b059b" } \ No newline at end of file +tauri = { git = "https://github.com/modrinth/tauri", rev = "5b26cbf" } \ No newline at end of file diff --git a/apps/app/Cargo.toml b/apps/app/Cargo.toml index 9efdd12c3..bf29700c4 100644 --- a/apps/app/Cargo.toml +++ b/apps/app/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" build = "build.rs" [build-dependencies] -tauri-build = { git = "https://github.com/modrinth/tauri", features = ["codegen"], rev = "c2b059b" } +tauri-build = { git = "https://github.com/modrinth/tauri", features = ["codegen"], rev = "5b26cbf" } [dependencies] theseus = { path = "../../packages/app-lib", features = ["tauri"] } @@ -16,7 +16,7 @@ theseus = { path = "../../packages/app-lib", features = ["tauri"] } serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { git = "https://github.com/modrinth/tauri", features = ["devtools", "macos-private-api", "protocol-asset", "unstable"], rev = "c2b059b" } +tauri = { git = "https://github.com/modrinth/tauri", features = ["devtools", "macos-private-api", "protocol-asset", "unstable"], rev = "5b26cbf" } tauri-plugin-window-state = "2.0.0-rc" tauri-plugin-deep-link = "2.0.0-rc" tauri-plugin-os = "2.0.0-rc" diff --git a/apps/app/README.md b/apps/app/README.md index ecd8d9c12..ce884ebb8 100644 --- a/apps/app/README.md +++ b/apps/app/README.md @@ -22,7 +22,7 @@ Before you begin, ensure you have the following installed on your machine: Follow these steps to set up your development environment: ```bash -cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev c2b059b85370e1a7018faf3286d2cd8b8ce58a38 +cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev 5b26cbff93fe4697338e56dfc7299ac8864b3445 pnpm install pnpm app:dev ``` diff --git a/packages/app-lib/Cargo.toml b/packages/app-lib/Cargo.toml index 87dc39f53..67cd959d2 100644 --- a/packages/app-lib/Cargo.toml +++ b/packages/app-lib/Cargo.toml @@ -36,7 +36,7 @@ tracing-error = "0.2.0" paste = { version = "1.0" } -tauri = { git = "https://github.com/modrinth/tauri", rev = "c2b059b", optional = true } +tauri = { git = "https://github.com/modrinth/tauri", rev = "5b26cbf", optional = true } indicatif = { version = "0.17.3", optional = true } async-tungstenite = { version = "0.27.0", features = ["tokio-runtime", "tokio-rustls-webpki-roots"] } diff --git a/packages/app-lib/src/state/cache.rs b/packages/app-lib/src/state/cache.rs index 2feb1a5cd..73e9dcc56 100644 --- a/packages/app-lib/src/state/cache.rs +++ b/packages/app-lib/src/state/cache.rs @@ -271,6 +271,7 @@ pub struct License { #[derive(Serialize, Deserialize, Clone, Debug)] pub struct GalleryItem { pub url: String, + pub raw_url: String, pub featured: bool, pub title: Option, pub description: Option, @@ -703,6 +704,16 @@ impl CachedEntry { .await?; for row in query { + let row_exists = row.data.is_some(); + let parsed_data = row + .data + .and_then(|x| serde_json::from_value::(x).ok()); + + // If data is corrupted/failed to parse ignore it + if row_exists && parsed_data.is_none() { + continue; + } + if row.expires <= Utc::now().timestamp() { if cache_behaviour == CacheBehaviour::MustRevalidate { continue; @@ -727,9 +738,7 @@ impl CachedEntry { .unwrap_or(false) }); - if let Some(data) = row - .data - .and_then(|x| serde_json::from_value::(x).ok()) + if let Some(data) = parsed_data { return_vals.push(Self { id: row.id,