Skip to content

Commit

Permalink
fix cli build
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Sep 10, 2024
1 parent 8bb7aff commit 73289cd
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
tauri = { git = "https://github.com/modrinth/tauri", rev = "5b26cbf" }
4 changes: 2 additions & 2 deletions apps/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ 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"] }

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"
Expand Down
2 changes: 1 addition & 1 deletion apps/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion packages/app-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
15 changes: 12 additions & 3 deletions packages/app-lib/src/state/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
pub description: Option<String>,
Expand Down Expand Up @@ -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::<CacheValue>(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;
Expand All @@ -727,9 +738,7 @@ impl CachedEntry {
.unwrap_or(false)
});

if let Some(data) = row
.data
.and_then(|x| serde_json::from_value::<CacheValue>(x).ok())
if let Some(data) = parsed_data
{
return_vals.push(Self {
id: row.id,
Expand Down

0 comments on commit 73289cd

Please sign in to comment.