From 8d9dc830476170d01f94fe4dc6967b3d4ecdbab0 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Wed, 4 Jan 2023 11:50:52 +0100 Subject: refactor: Deserialize into struct directly (#127) Instead of deserializing into a generic serde struct and then extracting specific value from it, deserialize directly into the struct we want. --- src-tauri/src/github/release_notes.rs | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src-tauri/src/github/release_notes.rs b/src-tauri/src/github/release_notes.rs index f139ead5..803132e2 100644 --- a/src-tauri/src/github/release_notes.rs +++ b/src-tauri/src/github/release_notes.rs @@ -91,28 +91,9 @@ pub async fn get_northstar_release_notes() -> Result, String> { let url = "https://api.github.com/repos/R2Northstar/Northstar/releases"; let res = fetch_github_releases_api(url).await?; - let json_response: Vec = + let release_info_vector: Vec = serde_json::from_str(&res).expect("JSON was not well-formatted"); println!("Done checking GitHub API"); - return Ok(json_response - .iter() - .map(|release| ReleaseInfo { - name: release - .get("name") - .and_then(|value| value.as_str()) - .unwrap() - .to_string(), - published_at: release - .get("published_at") - .and_then(|value| value.as_str()) - .unwrap() - .to_string(), - body: release - .get("body") - .and_then(|value| value.as_str()) - .unwrap() - .to_string(), - }) - .collect()); + return Ok(release_info_vector); } -- cgit v1.2.3 From 6bfc6996e12ba201f52de586c67f3db4a97bc722 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Wed, 4 Jan 2023 19:12:53 +0100 Subject: feat: Show newest version number (#124) * refactor: Move getting new FC version to own func * refactor: Deserialize into object * refactor: Return whole object instead of 2 strings More readable * refactor: Rename variable * refactor: Use fields of object directly instead of assigning to variables first * feat: Expose backend func to get newest FC version and then call it to get newest version number if current is outdated. This way we can display to the user how far behind their currently installed version is. --- src-tauri/src/github/release_notes.rs | 38 +++++++++++++++++--------------- src-tauri/src/main.rs | 5 ++++- src-vue/src/plugins/store.ts | 4 +++- src-vue/src/utils/FlightCoreVersion.d.ts | 5 +++++ 4 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 src-vue/src/utils/FlightCoreVersion.d.ts diff --git a/src-tauri/src/github/release_notes.rs b/src-tauri/src/github/release_notes.rs index 803132e2..a1d174fa 100644 --- a/src-tauri/src/github/release_notes.rs +++ b/src-tauri/src/github/release_notes.rs @@ -8,6 +8,12 @@ pub struct ReleaseInfo { pub body: String, } +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct FlightCoreVersion { + tag_name: String, + published_at: String, +} + // Fetches repo release API and returns response as string async fn fetch_github_releases_api(url: &str) -> Result { println!("Fetching releases notes from GitHub API"); @@ -27,24 +33,26 @@ async fn fetch_github_releases_api(url: &str) -> Result { Ok(res) } -/// Checks if installed FlightCore version is up-to-date -/// false -> FlightCore install is up-to-date -/// true -> FlightCore install is outdated -pub async fn check_is_flightcore_outdated() -> Result { +/// Gets newest FlighCore version from GitHub +#[tauri::command] +pub async fn get_newest_flightcore_version() -> Result { // Get newest version number from GitHub API println!("Checking GitHub API"); let url = "https://api.github.com/repos/R2NorthstarTools/FlightCore/releases/latest"; let res = fetch_github_releases_api(url).await?; - let json_response: serde_json::Value = + let flightcore_version: FlightCoreVersion = serde_json::from_str(&res).expect("JSON was not well-formatted"); println!("Done checking GitHub API"); - // Extract version number from JSON - let newest_release_version = json_response - .get("tag_name") - .and_then(|value| value.as_str()) - .unwrap(); + Ok(flightcore_version) +} + +/// Checks if installed FlightCore version is up-to-date +/// false -> FlightCore install is up-to-date +/// true -> FlightCore install is outdated +pub async fn check_is_flightcore_outdated() -> Result { + let newest_flightcore_release = get_newest_flightcore_version().await?; // Get version of installed FlightCore... let version = env!("CARGO_PKG_VERSION"); @@ -52,16 +60,10 @@ pub async fn check_is_flightcore_outdated() -> Result { let version = format!("v{}", version); // TODO: This shouldn't be a string compare but promper semver compare - let is_outdated = version != newest_release_version; + let is_outdated = version != newest_flightcore_release.tag_name; // If outdated, check how new the update is if is_outdated { - // Extract release date from JSON - let release_date = json_response - .get("published_at") - .and_then(|value| value.as_str()) - .unwrap(); - // Time to wait (2h) h * m * s let threshold_seconds = 2 * 60 * 60; @@ -69,7 +71,7 @@ pub async fn check_is_flightcore_outdated() -> Result { let current_time = chrono::Utc::now(); // Get latest release time from GitHub API response - let result = chrono::DateTime::parse_from_rfc3339(release_date) + let result = chrono::DateTime::parse_from_rfc3339(&newest_flightcore_release.published_at) .unwrap() .with_timezone(&chrono::Utc); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index e8912d60..7d08e72e 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -12,7 +12,9 @@ use std::{ use app::*; mod github; -use github::release_notes::{check_is_flightcore_outdated, get_northstar_release_notes}; +use github::release_notes::{ + check_is_flightcore_outdated, get_newest_flightcore_version, get_northstar_release_notes, +}; mod repair_and_verify; use repair_and_verify::{ @@ -101,6 +103,7 @@ fn main() { get_installed_mods_caller, install_mod_caller, clean_up_download_folder_caller, + get_newest_flightcore_version, ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index c22479e0..3db85e64 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -5,6 +5,7 @@ import { InstallType } from "../utils/InstallType"; import { invoke } from "@tauri-apps/api"; import { GameInstall } from "../utils/GameInstall"; import { ReleaseCanal } from "../utils/ReleaseCanal"; +import { FlightCoreVersion } from "../utils/FlightCoreVersion"; import { ElNotification, NotificationHandle } from 'element-plus'; import { NorthstarState } from '../utils/NorthstarState'; import { appDir } from '@tauri-apps/api/path'; @@ -377,9 +378,10 @@ async function _checkForFlightCoreUpdates(state: FlightCoreStore) { let flightcore_is_outdated = await invoke("check_is_flightcore_outdated_caller") as boolean; if (flightcore_is_outdated) { + let newest_flightcore_version = await invoke("get_newest_flightcore_version") as FlightCoreVersion; ElNotification({ title: 'FlightCore outdated!', - message: `Please update FlightCore. Running outdated version ${state.flightcore_version}`, + message: `Please update FlightCore.\nRunning outdated version ${state.flightcore_version}.\nNewest is ${newest_flightcore_version.tag_name}!`, type: 'warning', position: 'bottom-right', duration: 0 // Duration `0` means the notification will not auto-vanish diff --git a/src-vue/src/utils/FlightCoreVersion.d.ts b/src-vue/src/utils/FlightCoreVersion.d.ts new file mode 100644 index 00000000..2516bf25 --- /dev/null +++ b/src-vue/src/utils/FlightCoreVersion.d.ts @@ -0,0 +1,5 @@ +// derived from release_notes.rs +export interface FlightCoreVersion { + tag_name: string, + published_at: string, +} -- cgit v1.2.3 From 131b101045bbc4419f98afe58557a8d532af9bd6 Mon Sep 17 00:00:00 2001 From: Rémy Raes Date: Wed, 4 Jan 2023 19:21:17 +0100 Subject: feat: Thunderstore mods pagination (#122) * feat: add basic pagination * refactor: put paginator inside filters container * fix: limit filter container width * refactor: filters container is now responsive * fix: add missing type to pagination listener parameter * fix: don't display entire mods list while filtering mods * refactor: filteredMods is now a computed value * refactor: store mods per page value on UI store * feat: user can change modsPerPage count in settings * fix: limit mods count (min=5, max=100) * feat: add control on pages value When leaving settings vue, we check if the pages value is a number and is included in the interval [5-100]. If that's not the case, we reset it to 20. * feat: retrieve and save pages value in persistent store * fix: don't load an empty value from persistent store on boot * fix: cast modsPerPage to string to check if it's empty * refactor: remove search debounce * Update src-vue/src/plugins/store.ts * style: add trailing comma * fix: mention impact on TS mods only * refactor: remove limitations on modsPerPage * style: explicitly cast mods_per_page to number * feat: disable pagination with modsPerPage === 0 * feat: add pagination under thunderstore mod cards * fix: adjust bottom pagination padding * feat: clicking bottom pagination scrolls to page top * fix: use same containers for both paginations * feat: do not display pagination if mods fit on one page * style: trailing spaces * style: trailing spaces * feat: add a button to reset modsPerPage * feat: add explanation text about disabling pagination --- src-vue/src/plugins/store.ts | 15 ++- src-vue/src/views/SettingsView.vue | 48 +++++++++ src-vue/src/views/ThunderstoreModsView.vue | 158 +++++++++++++++++++---------- 3 files changed, 167 insertions(+), 54 deletions(-) diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index 3db85e64..18191555 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -36,7 +36,10 @@ export interface FlightCoreStore { installed_mods: NorthstarMod[], northstar_is_running: boolean, - origin_is_running: boolean + origin_is_running: boolean, + + // user custom settings + mods_per_page: number, } let notification_handle: NotificationHandle; @@ -60,7 +63,9 @@ export const store = createStore({ installed_mods: [], northstar_is_running: false, - origin_is_running: false + origin_is_running: false, + + mods_per_page: 20, } }, mutations: { @@ -320,6 +325,12 @@ async function _initializeApp(state: any) { state.enableReleasesSwitch = valueFromStore.value; } + // Grab "Thunderstore mods per page" setting from store if possible + const perPageFromStore: {value: number} | null = await persistentStore.get('thunderstore-mods-per-page'); + if (perPageFromStore && perPageFromStore.value) { + state.mods_per_page = perPageFromStore.value; + } + // Get FlightCore version number state.flightcore_version = await invoke("get_flightcore_version_number"); diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue index ff87c394..1c03fe4f 100644 --- a/src-vue/src/views/SettingsView.vue +++ b/src-vue/src/views/SettingsView.vue @@ -14,6 +14,24 @@ + + +
+

Number of Thunderstore mods per page

+
+ This has an impact on display performances when browsing Thunderstore mods.
+ Set this value to 0 to disable pagination. +
+ + + +
+

About:

FlightCore Version: {{ flightcoreVersion === '' ? 'Unknown version' : `${flightcoreVersion}` }} @@ -64,6 +82,15 @@ export default defineComponent({ this.$store.commit('toggleReleaseCandidate'); } } + }, + modsPerPage: { + get(): number { + return this.$store.state.mods_per_page; + }, + set(value: number) { + this.$store.state.mods_per_page = value; + persistentStore.set('thunderstore-mods-per-page', { value }); + } } }, methods: { @@ -86,6 +113,12 @@ export default defineComponent({ }, mounted() { document.querySelector('input')!.disabled = true; + }, + unmounted() { + if (('' + this.modsPerPage) === '') { + console.warn('Incorrect value for modsPerPage, resetting it to 20.'); + this.modsPerPage = 20; + } } }); @@ -110,4 +143,19 @@ h3:first-of-type { .el-switch { margin-left: 50px; } + + +/* Parameter panel styles */ +.fc_parameter__panel { + margin: 30px 0; +} + +.fc_parameter__panel h3 { + margin-bottom: 5px; +} + +.fc_parameter__panel h6 { + margin-top: 0; + margin-bottom: 12px; +} diff --git a/src-vue/src/views/ThunderstoreModsView.vue b/src-vue/src/views/ThunderstoreModsView.vue index 5b74bd1c..5733d30b 100644 --- a/src-vue/src/views/ThunderstoreModsView.vue +++ b/src-vue/src/views/ThunderstoreModsView.vue @@ -3,7 +3,7 @@
- +
@@ -12,6 +12,16 @@ + + +
@@ -21,16 +31,32 @@
- + +
+ + +
+
+ +
+ + diff --git a/src-vue/src/main.ts b/src-vue/src/main.ts index 25f1b064..95bea7af 100644 --- a/src-vue/src/main.ts +++ b/src-vue/src/main.ts @@ -6,7 +6,6 @@ import { store } from './plugins/store'; import PlayView from "./views/PlayView.vue"; import ChangelogView from "./views/ChangelogView.vue"; import ModsView from "./views/ModsView.vue"; -import ThunderstoreModsView from "./views/ThunderstoreModsView.vue"; import SettingsView from "./views/SettingsView.vue"; import DeveloperView from "./views/DeveloperView.vue"; import {createRouter, createWebHashHistory} from "vue-router"; @@ -35,7 +34,6 @@ const routes = [ { path: '/', name: 'Main', component: async () => PlayView}, { path: '/changelog', name: 'Changelog', component: async () => ChangelogView}, { path: '/mods', name: 'Mods', component: async () => ModsView}, - { path: '/thunderstoreMods', name: 'Thunderstore mods', component: async () => ThunderstoreModsView}, { path: '/settings', name: 'Settings', component: async () => SettingsView}, { path: '/dev', name: 'Dev', component: async () => DeveloperView} ]; diff --git a/src-vue/src/plugins/modules/search.ts b/src-vue/src/plugins/modules/search.ts new file mode 100644 index 00000000..16260387 --- /dev/null +++ b/src-vue/src/plugins/modules/search.ts @@ -0,0 +1,19 @@ +interface SearchStoreState { + searchValue: string +} + +export const searchModule = { + state: () => ({ + // This is the treated value of search input + searchValue: '', + // Selected mod categories + selectedCategories: [], + sortValue: {label: '', value: ''} + }), + getters: { + searchWords(state: SearchStoreState): string { + return state.searchValue.toLowerCase(); + } + } + } + \ No newline at end of file diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index edeb13df..2eae843a 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -15,6 +15,7 @@ import { router } from "../main"; import ReleaseInfo from "../utils/ReleaseInfo"; import { ThunderstoreMod } from '../utils/thunderstore/ThunderstoreMod'; import { NorthstarMod } from "../utils/NorthstarMod"; +import { searchModule } from './modules/search'; const persistentStore = new Store('flight-core-settings.json'); @@ -33,6 +34,7 @@ export interface FlightCoreStore { releaseNotes: ReleaseInfo[], thunderstoreMods: ThunderstoreMod[], + thunderstoreModsCategories: string[], installed_mods: NorthstarMod[], northstar_is_running: boolean, @@ -48,6 +50,9 @@ export interface FlightCoreStore { let notification_handle: NotificationHandle; export const store = createStore({ + modules: { + search: searchModule + }, state(): FlightCoreStore { return { developer_mode: false, @@ -63,6 +68,7 @@ export const store = createStore({ releaseNotes: [], thunderstoreMods: [], + thunderstoreModsCategories: [], installed_mods: [], northstar_is_running: false, @@ -244,6 +250,16 @@ export const store = createStore({ state.thunderstoreMods = mods.filter((mod: ThunderstoreMod) => { return !removedMods.includes(mod.name) && !mod.is_deprecated; }); + + // Retrieve categories from mods + state.thunderstoreModsCategories = mods + .map((mod: ThunderstoreMod) => mod.categories) + .filter((modCategories: string[]) => modCategories.length !== 0) + .reduce((accumulator: string[], modCategories: string[]) => { + accumulator.push( ...modCategories.filter((cat: string) => !accumulator.includes(cat)) ); + return accumulator; + }, []) + .sort(); }, async loadInstalledMods(state: FlightCoreStore) { let game_install = { diff --git a/src-vue/src/utils/SortOptions.d.ts b/src-vue/src/utils/SortOptions.d.ts new file mode 100644 index 00000000..6bdd0a4a --- /dev/null +++ b/src-vue/src/utils/SortOptions.d.ts @@ -0,0 +1,8 @@ +export enum SortOptions { + NAME_ASC = 'By name (A to Z)', + NAME_DESC = 'By name (Z to A)', + DATE_ASC = 'By date (from oldest)', + DATE_DESC = 'By date (from newest)', + MOST_DOWNLOADED = "Most downloaded", + TOP_RATED = "Top rated" +} diff --git a/src-vue/src/utils/thunderstore/ThunderstoreMod.d.ts b/src-vue/src/utils/thunderstore/ThunderstoreMod.d.ts index 6fddd06f..6387c47e 100644 --- a/src-vue/src/utils/thunderstore/ThunderstoreMod.d.ts +++ b/src-vue/src/utils/thunderstore/ThunderstoreMod.d.ts @@ -3,8 +3,10 @@ import { ThunderstoreModVersion } from "./ThunderstoreModVersion"; export interface ThunderstoreMod { name: string; owner: string; + date_updated: string; rating_score: number; package_url: string; is_deprecated: boolean; versions: ThunderstoreModVersion[]; + categories: string[]; } diff --git a/src-vue/src/views/ModsView.vue b/src-vue/src/views/ModsView.vue index 2f352ded..7c309832 100644 --- a/src-vue/src/views/ModsView.vue +++ b/src-vue/src/views/ModsView.vue @@ -1,112 +1,50 @@ - diff --git a/src-vue/src/views/ThunderstoreModsView.vue b/src-vue/src/views/ThunderstoreModsView.vue deleted file mode 100644 index 5733d30b..00000000 --- a/src-vue/src/views/ThunderstoreModsView.vue +++ /dev/null @@ -1,240 +0,0 @@ - - - - - diff --git a/src-vue/src/views/mods/LocalModsView.vue b/src-vue/src/views/mods/LocalModsView.vue new file mode 100644 index 00000000..470ab4f7 --- /dev/null +++ b/src-vue/src/views/mods/LocalModsView.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/src-vue/src/views/mods/ThunderstoreModsView.vue b/src-vue/src/views/mods/ThunderstoreModsView.vue new file mode 100644 index 00000000..aaf15220 --- /dev/null +++ b/src-vue/src/views/mods/ThunderstoreModsView.vue @@ -0,0 +1,272 @@ + + + + + diff --git a/src-vue/tsconfig.json b/src-vue/tsconfig.json index d4aefa2c..7f0f0012 100644 --- a/src-vue/tsconfig.json +++ b/src-vue/tsconfig.json @@ -10,7 +10,7 @@ "resolveJsonModule": true, "isolatedModules": true, "esModuleInterop": true, - "lib": ["ESNext", "DOM"], + "lib": ["ESNext", "DOM", "ES2018"], "skipLibCheck": true }, "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], -- cgit v1.2.3 From a5e71758b3d5b8315153e75f8bbf9e6cc4d3aa8a Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Sat, 14 Jan 2023 01:29:24 +0100 Subject: chore: Bump FlightCore version to 1.6.0 --- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 65133a9e..0376d592 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -81,7 +81,7 @@ checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" [[package]] name = "app" -version = "1.5.0" +version = "1.6.0" dependencies = [ "anyhow", "async-recursion", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 71c861fc..dcdf8d3b 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "1.5.0" +version = "1.6.0" description = "A Tauri App" authors = ["you"] license = "" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index ad7045b8..ca5ec9c3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "FlightCore", - "version": "1.5.0" + "version": "1.6.0" }, "tauri": { "allowlist": { -- cgit v1.2.3 From 8eab75a03ce56a8522fc7504ebb0f01acd1c8d30 Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Sat, 14 Jan 2023 01:55:41 +0100 Subject: docs: Update download link to v1.6.0 of FlightCore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d3cf5d6..f4f2e7ff 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

- +

-- cgit v1.2.3 From 70c3a381018e7aca75f37086ba4702688ba5b28c Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Thu, 19 Jan 2023 17:03:25 +0100 Subject: fix: Fix wrong comments (#138) Typo and referencing wrong functionality --- src-vue/src/views/DeveloperView.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue index f199ddaf..6770caaa 100644 --- a/src-vue/src/views/DeveloperView.vue +++ b/src-vue/src/views/DeveloperView.vue @@ -162,7 +162,7 @@ export default defineComponent({ } as GameInstall; let mod_to_install = this.mod_to_install_field_string; await invoke("install_mod_caller", { gameInstall: game_install, thunderstoreModString: mod_to_install }).then((message) => { - // Show user notificatio if mod install completed. + // Show user notification if mod install completed. ElNotification({ title: `Installed ${mod_to_install}`, message: message as string, @@ -185,7 +185,7 @@ export default defineComponent({ install_type: this.$store.state.install_type } as GameInstall; await invoke("clean_up_download_folder_caller", { gameInstall: game_install, force: true }).then((message) => { - // Show user notificatio if mod install completed. + // Show user notification if task completed. ElNotification({ title: `Done`, message: `Done`, -- cgit v1.2.3 From 2a9136fe520e5298d65603fc8804a7176b4719db Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 22 Jan 2023 18:46:47 +0100 Subject: fix: Properly parse mod string (#141) --- src-tauri/src/mod_management/mod.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index 008f72f0..e45fa3c1 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -284,8 +284,19 @@ async fn get_ns_mod_download_url(thunderstore_mod_string: String) -> Result res, + Err(_) => return Err("Failed to parse mod string".to_string()), + }; + + // Encode as URL + let ts_mod_string_url = format!( + "{}/{}/{}", + parsed_ts_mod_string.author_name, + parsed_ts_mod_string.mod_name, + parsed_ts_mod_string.version.unwrap() + ); for ns_mod in index { // Iterate over all versions of a given mod -- cgit v1.2.3 From 5ba596cc67856b0a6335130b1e43808adaba978e Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:13:38 +0100 Subject: fix: Remove unused serde import in `main.rs` (#142) fix: Remove unused serde import in main.rs Seems like I forgot to remove it when I did some code refactoring --- src-tauri/src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index b47a796e..0e62aa3c 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -30,7 +30,6 @@ use mod_management::{ mod northstar; use northstar::get_northstar_version_number; -use serde::{Deserialize, Serialize}; use tauri::Manager; use tauri_plugin_store::PluginBuilder; use tokio::time::sleep; -- cgit v1.2.3 From a69d79bb4be922faebd3b43fe2fd6d14d916ed16 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:14:55 +0100 Subject: chore: Autoformat Rust source files (#143) --- src-tauri/src/main.rs | 7 ++++--- src-tauri/src/mod_management/mod.rs | 18 +++++++++--------- src-tauri/src/repair_and_verify/mod.rs | 6 ++++-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0e62aa3c..4eab7a00 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,7 +9,10 @@ use std::{ time::Duration, }; -use app::{*, constants::{APP_USER_AGENT, MASTER_SERVER_URL, SERVER_BROWSER_ENDPOINT}}; +use app::{ + constants::{APP_USER_AGENT, MASTER_SERVER_URL, SERVER_BROWSER_ENDPOINT}, + *, +}; mod github; use github::release_notes::{ @@ -309,11 +312,9 @@ async fn clean_up_download_folder_caller( } } - /// Gets server and playercount from master server API #[tauri::command] async fn get_server_player_count() -> Result<(i32, usize), String> { - let url = format!("{MASTER_SERVER_URL}{SERVER_BROWSER_ENDPOINT}"); let client = reqwest::Client::new(); let res = client diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs index e45fa3c1..c37882fe 100644 --- a/src-tauri/src/mod_management/mod.rs +++ b/src-tauri/src/mod_management/mod.rs @@ -184,7 +184,10 @@ fn parse_for_thunderstore_mod_string(nsmod_path: String) -> Result Result, } }; // Get Thunderstore mod string if it exists - let thunderstore_mod_string = - match parse_for_thunderstore_mod_string(directory_str) { - Ok(thunderstore_mod_string) => Some(thunderstore_mod_string), - Err(_err) => None, - }; + let thunderstore_mod_string = match parse_for_thunderstore_mod_string(directory_str) { + Ok(thunderstore_mod_string) => Some(thunderstore_mod_string), + Err(_err) => None, + }; // Get directory path let mod_directory = directory.to_str().unwrap().to_string(); @@ -409,13 +411,11 @@ pub async fn fc_download_mod_and_install( let author = thunderstore_mod_string.split("-").next().unwrap(); // Extract the mod to the mods directory - match thermite::core::manage::install_mod(author, &f, std::path::Path::new(&mods_directory)) - { + match thermite::core::manage::install_mod(author, &f, std::path::Path::new(&mods_directory)) { Ok(()) => (), Err(err) => return Err(err.to_string()), }; - // Delete downloaded zip file std::fs::remove_file(path).unwrap(); diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs index 393a8cdd..fb108f37 100644 --- a/src-tauri/src/repair_and_verify/mod.rs +++ b/src-tauri/src/repair_and_verify/mod.rs @@ -1,4 +1,7 @@ -use crate::{mod_management::{set_mod_enabled_status, rebuild_enabled_mods_json}, northstar::CORE_MODS}; +use crate::{ + mod_management::{rebuild_enabled_mods_json, set_mod_enabled_status}, + northstar::CORE_MODS, +}; use anyhow::anyhow; /// Contains various functions to repair common issues and verifying installation use app::{get_enabled_mods, GameInstall}; @@ -14,7 +17,6 @@ pub fn verify_game_files(game_install: GameInstall) -> Result { /// Enables core mods if disabled #[tauri::command] pub fn disable_all_but_core(game_install: GameInstall) -> Result<(), String> { - // Rebuild `enabledmods.json` first to ensure all mods are added rebuild_enabled_mods_json(game_install.clone())?; -- cgit v1.2.3 From 31b32c725ce4f47a6726cb0d8ef5f21ec6030580 Mon Sep 17 00:00:00 2001 From: Rémy Raes Date: Sun, 29 Jan 2023 13:28:32 +0100 Subject: fix: Set current route as menu active item (#149) fix: set current route as menu active item --- src-vue/src/App.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-vue/src/App.vue b/src-vue/src/App.vue index 0ecea16d..c28919e1 100644 --- a/src-vue/src/App.vue +++ b/src-vue/src/App.vue @@ -50,7 +50,7 @@ export default {