diff options
Diffstat (limited to 'src-tauri')
-rw-r--r-- | src-tauri/Cargo.lock | 75 | ||||
-rw-r--r-- | src-tauri/Cargo.toml | 6 | ||||
-rw-r--r-- | src-tauri/bindings/PullsApiResponseElement.ts | 2 | ||||
-rw-r--r-- | src-tauri/src/github/pull_requests.rs | 10 | ||||
-rw-r--r-- | src-tauri/src/mod_management/mod.rs | 26 | ||||
-rw-r--r-- | src-tauri/tauri.conf.json | 2 |
6 files changed, 80 insertions, 41 deletions
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2b7413c8..db7379e2 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -849,10 +849,11 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ + "powerfmt", "serde", ] @@ -1164,7 +1165,7 @@ dependencies = [ [[package]] name = "flightcore" -version = "2.23.1" +version = "2.23.2" dependencies = [ "anyhow", "async-recursion", @@ -1176,7 +1177,7 @@ dependencies = [ "libthermite", "log", "octocrab", - "open 5.1.4", + "open 5.3.0", "pretty_env_logger", "regex", "remove-markdown-links", @@ -2314,9 +2315,9 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libthermite" -version = "0.7.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4f076e602c8aa9ec99cd8b2d23cdf1606c27e5f04cba13aa61bdc50e678ee8" +checksum = "c27ac02c14161a4b0db739b37618d929d7f2af320c1f993e3d674599f77b79e7" dependencies = [ "flate2", "json5", @@ -2649,6 +2650,12 @@ dependencies = [ ] [[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] name = "num-integer" version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2814,9 +2821,9 @@ dependencies = [ [[package]] name = "open" -version = "5.1.4" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5ca541f22b1c46d4bb9801014f234758ab4297e7870b904b6a8415b980a7388" +checksum = "61a877bf6abd716642a53ef1b89fb498923a4afca5c754f9050b4d081c05c4b3" dependencies = [ "is-wsl", "libc", @@ -3279,6 +3286,12 @@ dependencies = [ ] [[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4676,9 +4689,9 @@ checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tauri" -version = "1.6.2" +version = "1.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "047aefcc7721bfb8024a9bc39d4719112262610502de7a224fa62c4570cd78d4" +checksum = "77567d2b3b74de4588d544147142d02297f3eaa171a25a065252141d8597a516" dependencies = [ "anyhow", "base64 0.21.2", @@ -4690,6 +4703,7 @@ dependencies = [ "encoding_rs", "flate2", "futures-util", + "getrandom 0.2.10", "glib", "glob", "gtk", @@ -4757,9 +4771,9 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "1.4.2" +version = "1.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1554c5857f65dbc377cefb6b97c8ac77b1cb2a90d30d3448114d5d6b48a77fc" +checksum = "c1aed706708ff1200ec12de9cfbf2582b5d8ec05f6a7293911091effbd22036b" dependencies = [ "base64 0.21.2", "brotli", @@ -4783,11 +4797,11 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "1.4.3" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "277abf361a3a6993ec16bcbb179de0d6518009b851090a01adfea12ac89fa875" +checksum = "b88f831d2973ae4f81a706a0004e67dac87f2e4439973bbe98efbd73825d8ede" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "proc-macro2", "quote", "syn 1.0.109", @@ -4809,9 +4823,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.14.2" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2d0652aa2891ff3e9caa2401405257ea29ab8372cce01f186a5825f1bd0e76" +checksum = "3068ed62b63dedc705558f4248c7ecbd5561f0f8050949859ea0db2326f26012" dependencies = [ "gtk", "http 0.2.9", @@ -4830,9 +4844,9 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "0.14.5" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "067c56fc153b3caf406d7cd6de4486c80d1d66c0f414f39e94cb2f5543f6445f" +checksum = "d4c3db170233096aa30330feadcd895bf9317be97e624458560a20e814db7955" dependencies = [ "arboard", "cocoa", @@ -4851,9 +4865,9 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "1.5.4" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "450b17a7102e5d46d4bdabae0d1590fd27953e704e691fc081f06c06d2253b35" +checksum = "2826db448309d382dac14d520f0c0a40839b87b57b977e59cf5f296b3ace6a93" dependencies = [ "brotli", "ctor", @@ -4981,12 +4995,14 @@ dependencies = [ [[package]] name = "time" -version = "0.3.25" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa 1.0.9", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -4994,16 +5010,17 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.11" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -6219,9 +6236,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.24.7" +version = "0.24.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ad85d0e067359e409fcb88903c3eac817c392e5d638258abfb3da5ad8ba6fc4" +checksum = "00711278ed357350d44c749c286786ecac644e044e4da410d466212152383b45" dependencies = [ "base64 0.13.1", "block", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0f7e0e34..c9a559a7 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flightcore" -version = "2.23.1" +version = "2.23.2" description = "Mod-manager for Northstar" authors = ["https://github.com/R2NorthstarTools/FlightCore/graphs/contributors"] license = "MIT" @@ -33,7 +33,7 @@ steamlocate = "2.0.0-beta.2" # Error messages anyhow = "1.0" # libthermite for Northstar/mod install handling -libthermite = { version = "0.7.1", features = ["proton"] } +libthermite = { version = "0.8.1", features = ["proton"] } # zip stuff zip = "0.6.2" # Regex @@ -60,7 +60,7 @@ log = "0.4" # Extracting zip files easily zip-extract = "0.1.3" # open urls -open = "5.1.4" +open = "5.3.0" semver = "1.0" # simplified filesystem access glob = "0.3.1" diff --git a/src-tauri/bindings/PullsApiResponseElement.ts b/src-tauri/bindings/PullsApiResponseElement.ts index 489039e3..2db93fe2 100644 --- a/src-tauri/bindings/PullsApiResponseElement.ts +++ b/src-tauri/bindings/PullsApiResponseElement.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { CommitHead } from "./CommitHead"; -export type PullsApiResponseElement = { number: bigint, title: string, url: string, head: CommitHead, html_url: string, };
\ No newline at end of file +export type PullsApiResponseElement = { number: bigint, title: string, url: string, head: CommitHead, html_url: string, labels: Array<string>, };
\ No newline at end of file diff --git a/src-tauri/src/github/pull_requests.rs b/src-tauri/src/github/pull_requests.rs index 7e400c1a..de733feb 100644 --- a/src-tauri/src/github/pull_requests.rs +++ b/src-tauri/src/github/pull_requests.rs @@ -32,6 +32,7 @@ pub struct PullsApiResponseElement { url: String, head: CommitHead, html_url: String, + labels: Vec<String>, } // GitHub API response JSON elements as structs @@ -102,6 +103,14 @@ pub async fn get_pull_requests( repo, }; + // Get labels and their names and put the into vector + let label_names: Vec<String> = item + .labels + .unwrap_or_else(Vec::new) + .into_iter() + .map(|label| label.name) + .collect(); + // TODO there's probably a way to automatically serialize into the struct but I don't know yet how to let elem = PullsApiResponseElement { number: item.number, @@ -112,6 +121,7 @@ pub async fn get_pull_requests( .html_url .ok_or(anyhow!("html_url not found"))? .to_string(), + labels: label_names, }; all_pull_requests.push(elem); diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index d5b5214e..ebbcf431 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -7,6 +7,7 @@ use thermite::prelude::ThermiteError; use crate::NorthstarMod; use anyhow::{anyhow, Result}; use serde::{Deserialize, Serialize}; +use std::error::Error; use std::str::FromStr; use std::string::ToString; use std::{fs, path::PathBuf}; @@ -505,10 +506,14 @@ fn delete_older_versions( /// Checks whether some mod is correctly formatted /// Currently checks whether /// - Some `mod.json` exists under `mods/*/mod.json` -fn fc_sanity_check(input: &&fs::File) -> bool { +fn fc_sanity_check(input: &&fs::File) -> Result<(), Box<dyn Error + Send + Sync + 'static>> { let mut archive = match zip::read::ZipArchive::new(*input) { Ok(archive) => archive, - Err(_) => return false, + Err(_) => { + return Err(Box::new(ThermiteError::UnknownError( + "Failed reading zip file".into(), + ))) + } }; let mut has_mods = false; @@ -538,14 +543,22 @@ fn fc_sanity_check(input: &&fs::File) -> bool { if name.to_str().unwrap().contains(".dll") { log::warn!("Plugin detected, prompting user"); if !plugins::plugin_prompt() { - return false; // Plugin detected and user denied install + return Err(Box::new(ThermiteError::UnknownError( + "Plugin detected and install denied".into(), + ))); } } } } } - has_mods && mod_json_exists + if has_mods && mod_json_exists { + Ok(()) + } else { + Err(Box::new(ThermiteError::UnknownError( + "Mod not correctly formatted".into(), + ))) + } } // Copied from `libtermite` source code and modified @@ -643,9 +656,8 @@ pub async fn fc_download_mod_and_install( Err(err) => { log::warn!("libthermite couldn't install mod {thunderstore_mod_string} due to {err:?}",); return match err { - ThermiteError::SanityError => Err( - "Mod failed sanity check during install. It's probably not correctly formatted" - .to_string(), + ThermiteError::SanityError(e) => Err( + format!("Mod failed sanity check during install. It's probably not correctly formatted. {}", e) ), _ => Err(err.to_string()), }; diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 292df9ce..63721461 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "FlightCore", - "version": "2.23.1" + "version": "2.23.2" }, "tauri": { "allowlist": { |