From 5a7725e110ec586f70ce4a3c65799ee72169d1b8 Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 3 Aug 2023 22:11:10 +0200 Subject: fix: Give thunderstore mod card images a background color (#471) Give thunderstore mod card images a background color to prevent alpha issues --- src-vue/src/components/ThunderstoreModCard.vue | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src-vue/src') diff --git a/src-vue/src/components/ThunderstoreModCard.vue b/src-vue/src/components/ThunderstoreModCard.vue index 30ffbc68..54241e85 100644 --- a/src-vue/src/components/ThunderstoreModCard.vue +++ b/src-vue/src/components/ThunderstoreModCard.vue @@ -312,4 +312,8 @@ export default defineComponent({ margin-left: 10px; height: auto; } + +.image { + background-color: lightgray; +} -- cgit v1.2.3 From 097ecc3d4896c224a73e76cb80be1dd6a63d82f3 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Thu, 3 Aug 2023 23:05:34 +0200 Subject: fix: Move leftover type definition to auto-generated from Rust (#450) * chore: Delete leftover type definition file * feat: Generate InstallType from Rust enum * fix: Use new generated struct --- src-tauri/bindings/InstallType.ts | 3 +++ src-tauri/src/main.rs | 3 ++- src-vue/src/plugins/store.ts | 4 ++-- src-vue/src/utils/InstallType.ts | 8 -------- 4 files changed, 7 insertions(+), 11 deletions(-) create mode 100644 src-tauri/bindings/InstallType.ts delete mode 100644 src-vue/src/utils/InstallType.ts (limited to 'src-vue/src') diff --git a/src-tauri/bindings/InstallType.ts b/src-tauri/bindings/InstallType.ts new file mode 100644 index 00000000..2a0f9a7f --- /dev/null +++ b/src-tauri/bindings/InstallType.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type InstallType = "STEAM" | "ORIGIN" | "EAPLAY" | "UNKNOWN"; \ No newline at end of file diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 9e812683..a7827a44 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -457,7 +457,8 @@ mod platform_specific; #[cfg(target_os = "linux")] use platform_specific::linux; -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Serialize, Deserialize, Debug, Clone, TS)] +#[ts(export)] pub enum InstallType { STEAM, ORIGIN, diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index 9865b992..e18498a6 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -1,7 +1,7 @@ import { createStore } from 'vuex'; import { listen, Event as TauriEvent } from "@tauri-apps/api/event"; import { Tabs } from "../utils/Tabs"; -import { InstallType } from "../utils/InstallType"; +import { InstallType } from "../../../src-tauri/bindings/InstallType"; import { invoke } from "@tauri-apps/api"; import { GameInstall } from "../utils/GameInstall"; import { ReleaseCanal } from "../utils/ReleaseCanal"; @@ -142,7 +142,7 @@ export const store = createStore({ catch { console.warn("Nothing to close"); } - state.game_install.install_type = InstallType.UNKNOWN; + state.game_install.install_type = "UNKNOWN"; // Save change in persistent store await persistentStore.set('game-install', { value: state.game_install }); diff --git a/src-vue/src/utils/InstallType.ts b/src-vue/src/utils/InstallType.ts deleted file mode 100644 index 797f4077..00000000 --- a/src-vue/src/utils/InstallType.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Enumerates the way Titanfall2 could be installed (Steam/Origin/EA-Desktop) -// Needs to be synced with `pub enum InstallType` in /src-tauri/src/lib.rs -export enum InstallType { - STEAM = 'STEAM', - ORIGIN = 'ORIGIN', - EAPLAY = 'EAPLAY', - UNKNOWN = 'UNKNOWN', // used when the install location was manually selected -} -- cgit v1.2.3 From b188b2982b409ee22488f6b9a3280297bd2d2329 Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Fri, 4 Aug 2023 19:53:47 +0200 Subject: style: Add trailing comma Helps with diff when adding more values later --- src-vue/src/views/SettingsView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-vue/src') diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue index dcc787ae..c7ca2ded 100644 --- a/src-vue/src/views/SettingsView.vue +++ b/src-vue/src/views/SettingsView.vue @@ -104,7 +104,7 @@ export default defineComponent({ }, data() { return { - developerModeClicks: 0 + developerModeClicks: 0, } }, computed: { -- cgit v1.2.3 From c7688e650381f5b06f42bea4ddd3fa32f404cea2 Mon Sep 17 00:00:00 2001 From: Harmony Weblate <96563367+harmony-weblate@users.noreply.github.com> Date: Fri, 4 Aug 2023 23:55:50 +0200 Subject: i18n: Translations update from Weblate (#485) Translated using Weblate (German) Currently translated at 100.0% (102 of 102 strings) Translation: Northstar/FlightCore Translate-URL: https://translate.harmony.tf/projects/northstar/flightcore/de/ Co-authored-by: GeckoEidechse --- src-vue/src/i18n/lang/de.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src-vue/src') diff --git a/src-vue/src/i18n/lang/de.json b/src-vue/src/i18n/lang/de.json index e8392452..e66f4545 100644 --- a/src-vue/src/i18n/lang/de.json +++ b/src-vue/src/i18n/lang/de.json @@ -109,7 +109,9 @@ "delete_persistent_store": "FlightCore Einstellungen zurücksetzen", "reinstall_title": "Northstar wird neu installiert", "reinstall_text": "Bitte warten", - "reinstall_success": "Northstar erfolgreich neu installiert" + "reinstall_success": "Northstar erfolgreich neu installiert", + "disable_modsettings_success": "Der Mod ModSettings wurde deaktiviert", + "disable_modsettings": "Deaktiviere den ModSettings Mod" } }, "show_deprecated_mods_desc1": "Damit werden veraltete Mods in der Online-Mods-Ansicht sichtbar.", -- cgit v1.2.3 From f17c346919a32e481be2d5ee322f76dae8c03e96 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sun, 6 Aug 2023 21:56:05 +0200 Subject: feat: Move button for killing NS to RepairView (#487) * feat: Move button for killing NS to RepairView * i18n: Add German translation --- src-vue/src/i18n/lang/de.json | 1 + src-vue/src/i18n/lang/en.json | 1 + src-vue/src/views/DeveloperView.vue | 14 -------------- src-vue/src/views/RepairView.vue | 14 ++++++++++++++ 4 files changed, 16 insertions(+), 14 deletions(-) (limited to 'src-vue/src') diff --git a/src-vue/src/i18n/lang/de.json b/src-vue/src/i18n/lang/de.json index e66f4545..49950bfb 100644 --- a/src-vue/src/i18n/lang/de.json +++ b/src-vue/src/i18n/lang/de.json @@ -107,6 +107,7 @@ "force_reinstall_ns": "Northstar reinstallieren", "force_delete_temp_dl": "Temporären FlightCore Downloadordner löschen", "delete_persistent_store": "FlightCore Einstellungen zurücksetzen", + "kill_northstar_process": "Laufenden Northstar/Titanfall2 Prozess beenden", "reinstall_title": "Northstar wird neu installiert", "reinstall_text": "Bitte warten", "reinstall_success": "Northstar erfolgreich neu installiert", diff --git a/src-vue/src/i18n/lang/en.json b/src-vue/src/i18n/lang/en.json index 470e98be..238c6c41 100644 --- a/src-vue/src/i18n/lang/en.json +++ b/src-vue/src/i18n/lang/en.json @@ -124,6 +124,7 @@ "force_reinstall_ns": "Force reinstall Northstar", "force_delete_temp_dl": "Force delete temp download folder", "delete_persistent_store": "Delete FlightCore persistent store", + "kill_northstar_process": "Kill running Northstar/Titanfall2 process", "reinstall_title": "Force reinstalling Northstar", "reinstall_text": "Please wait", "reinstall_success": "Successfully reinstalled Northstar" diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue index de83c9a8..c87e4236 100644 --- a/src-vue/src/views/DeveloperView.vue +++ b/src-vue/src/views/DeveloperView.vue @@ -74,10 +74,6 @@ Get installed mods - - Kill Northstar - -

Testing

@@ -228,16 +224,6 @@ export default defineComponent({ showErrorNotification(error); }); }, - async killNorthstar() { - await invoke("kill_northstar") - .then((message) => { - // Just a visual indicator that it worked - showNotification('Success'); - }) - .catch((error) => { - showErrorNotification(error); - }); - }, async installMod() { let mod_to_install = this.mod_to_install_field_string; await invoke("install_mod_caller", { gameInstall: this.$store.state.game_install, thunderstoreModString: mod_to_install }).then((message) => { diff --git a/src-vue/src/views/RepairView.vue b/src-vue/src/views/RepairView.vue index 65c533d2..ce7e154d 100644 --- a/src-vue/src/views/RepairView.vue +++ b/src-vue/src/views/RepairView.vue @@ -17,6 +17,10 @@ {{ $t('settings.repair.window.force_reinstall_ns') }} + + {{ $t('settings.repair.window.kill_northstar_process') }} + + {{ $t('settings.repair.window.disable_modsettings') }} @@ -121,6 +125,16 @@ export default defineComponent({ showErrorNotification(error); }); }, + async killNorthstar() { + await invoke("kill_northstar") + .then((message) => { + // Just a visual indicator that it worked + showNotification('Success'); + }) + .catch((error) => { + showErrorNotification(error); + }); + }, }, watch: { // Lang value is propagated to repair view after it's mounted, so we need to watch -- cgit v1.2.3 From 24fb67f88ceca9bec04b49fae5b58759b7b25ec5 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 8 Aug 2023 23:59:05 +0200 Subject: feat: Add dropdown menu for profiles (#494) Adds a dropdown menu to settings that allows selecting a different profile. Currently gated behind dev mode being active. --- src-tauri/src/main.rs | 2 + src-tauri/src/northstar/mod.rs | 1 + src-tauri/src/northstar/profile.rs | 76 ++++++++++++++++++++++++++++++++++++++ src-vue/src/i18n/lang/en.json | 11 ++++++ src-vue/src/plugins/store.ts | 20 ++++++++++ src-vue/src/views/SettingsView.vue | 60 ++++++++++++++++++++++++++++++ 6 files changed, 170 insertions(+) create mode 100644 src-tauri/src/northstar/profile.rs (limited to 'src-vue/src') diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index a7827a44..66bb98d2 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -158,6 +158,8 @@ fn main() { close_application, development::install_git_main, get_available_northstar_versions, + northstar::profile::fetch_profiles, + northstar::profile::validate_profile, ]) .run(tauri::generate_context!()) { diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs index 173495c6..4fecfe51 100644 --- a/src-tauri/src/northstar/mod.rs +++ b/src-tauri/src/northstar/mod.rs @@ -1,6 +1,7 @@ //! This module deals with handling things around Northstar such as //! - getting version number pub mod install; +pub mod profile; use crate::util::check_ea_app_or_origin_running; use crate::{ diff --git a/src-tauri/src/northstar/profile.rs b/src-tauri/src/northstar/profile.rs new file mode 100644 index 00000000..78e734d0 --- /dev/null +++ b/src-tauri/src/northstar/profile.rs @@ -0,0 +1,76 @@ +use crate::GameInstall; + +// These folders are part of Titanfall 2 and +// should NEVER be used as a Profile +const SKIP_PATHS: [&str; 8] = [ + "___flightcore-temp", + "__overlay", + "bin", + "Core", + "r2", + "vpk", + "platform", + "Support", +]; + +// A profile may have one of these to be detected +const MAY_CONTAIN: [&str; 10] = [ + "mods/", + "plugins/", + "packages/", + "logs/", + "runtime/", + "save_data/", + "Northstar.dll", + "enabledmods.json", + "placeholder.playerdata.pdata", + "LEGAL.txt", +]; + +/// Returns a list of Profile names +/// All the returned Profiles can be found relative to the game path +#[tauri::command] +pub fn fetch_profiles(game_install: GameInstall) -> Result, String> { + let mut profiles: Vec = Vec::new(); + + for content in MAY_CONTAIN { + let pattern = format!("{}/*/{}", game_install.game_path, content); + for e in glob::glob(&pattern).expect("Failed to read glob pattern") { + let path = e.unwrap(); + let mut ancestors = path.ancestors(); + + ancestors.next(); + + let profile_path = std::path::Path::new(ancestors.next().unwrap()); + let profile_name = profile_path + .file_name() + .unwrap() + .to_os_string() + .into_string() + .unwrap(); + + if !profiles.contains(&profile_name) { + profiles.push(profile_name); + } + } + } + + Ok(profiles) +} + +/// Validates if a given profile is actually a valid profile +#[tauri::command] +pub fn validate_profile(game_install: GameInstall, profile: String) -> bool { + // Game files are never a valid profile + // Prevent users with messed up installs from making it even worse + if SKIP_PATHS.contains(&profile.as_str()) { + return false; + } + + log::info!("Validating Profile {}", profile); + + let profile_path = format!("{}/{}", game_install.game_path, profile); + let profile_dir = std::path::Path::new(profile_path.as_str()); + + profile_dir.is_dir() +} diff --git a/src-vue/src/i18n/lang/en.json b/src-vue/src/i18n/lang/en.json index 238c6c41..1fa4e7ee 100644 --- a/src-vue/src/i18n/lang/en.json +++ b/src-vue/src/i18n/lang/en.json @@ -110,6 +110,10 @@ "show_deprecated_mods_desc1": "This allows you to see deprecated mods in the online mods collection.", "show_deprecated_mods_desc2": "Watch out, such mods are usually deprecated for a good reason.", + "profile": { + "active": "Active Profile" + }, + "repair": { "title": "Repair", "open_window": "Open repair window", @@ -150,6 +154,13 @@ } }, + "profile": { + "invalid": { + "title": "Invalid Profile", + "text": "The profile you tried to switch to is no longer valid." + } + }, + "flightcore_outdated": { "title": "FlightCore outdated!", "text": "Please update FlightCore.\nRunning outdated version {oldVersion}.\nNewest is {newVersion}!" diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index e18498a6..8f0c3fee 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -38,6 +38,7 @@ export interface FlightCoreStore { thunderstoreMods: ThunderstoreMod[], thunderstoreModsCategories: string[], installed_mods: NorthstarMod[], + available_profiles: string[], northstar_is_running: boolean, origin_is_running: boolean, @@ -62,6 +63,8 @@ export const store = createStore({ developer_mode: false, game_install: {} as unknown as GameInstall, + available_profiles: [], + flightcore_version: "", installed_northstar_version: "", @@ -284,6 +287,9 @@ export const store = createStore({ return; } + // Clear installed mod list first so we don't end up with leftovers + state.installed_mods = []; + // Call back-end for installed mods await invoke("get_installed_mods_and_properties", { gameInstall: state.game_install }) .then((message) => { @@ -312,6 +318,16 @@ export const store = createStore({ i18n.global.tc(`channels.names.${state.northstar_release_canal}`), i18n.global.tc('channels.release.switch.text', {canal: state.northstar_release_canal}), ); + }, + async fetchProfiles(state: FlightCoreStore) { + await invoke("fetch_profiles", { gameInstall: state.game_install }) + .then((message) => { + state.available_profiles = message as string[]; + }) + .catch((error) => { + console.error(error); + showErrorNotification(error); + }); } } }); @@ -415,6 +431,8 @@ async function _initializeApp(state: any) { await _get_northstar_version_number(state); } + store.commit('fetchProfiles'); + await invoke<[number, number]>("get_server_player_count") .then((message) => { state.player_count = message[0]; @@ -465,6 +483,8 @@ function _initializeListeners(state: any) { * state, for it to be displayed in UI. */ async function _get_northstar_version_number(state: any) { + state.installed_northstar_version = ""; + await invoke("get_northstar_version_number", { gameInstall: state.game_install }) .then((message) => { let northstar_version_number: string = message as string; diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue index c7ca2ded..c209da31 100644 --- a/src-vue/src/views/SettingsView.vue +++ b/src-vue/src/views/SettingsView.vue @@ -21,6 +21,21 @@ + +
+

{{ $t('settings.profile.active') }}

+ + + {{ $store.state.game_install.profile }} + + + +
+

{{ $t('settings.nb_ts_mods_per_page') }}

@@ -96,6 +111,7 @@ import { showErrorNotification, showNotification } from "../utils/ui"; import LanguageSelector from "../components/LanguageSelector.vue"; const persistentStore = new Store('flight-core-settings.json'); import { open } from '@tauri-apps/api/shell'; +import { i18n } from '../main'; export default defineComponent({ name: "SettingsView", @@ -144,6 +160,17 @@ export default defineComponent({ persistentStore.set('thunderstore-mods-per-page', { value }); await persistentStore.save(); // explicit save to disk } + }, + availableProfiles(): Object { + let profiles = this.$store.state.available_profiles + + // convert string array to object array so we can fill a table + let data = profiles.reduce( + (a: Object[], v: string) => [...a, {"name": v}], + [] + ); + + return data; } }, methods: { @@ -172,6 +199,39 @@ export default defineComponent({ async openGameInstallFolder() { // Opens the folder in default file explorer application await open(`${this.$store.state.game_install.game_path}`); + }, + async switchProfile(value: string) { + let store = this.$store; + let state = store.state; + + await invoke("validate_profile", { gameInstall: state.game_install, profile: value }) + .then(async (message) => { + if (!message) + { + // Profile is no longer valid, inform the user... + showErrorNotification( + i18n.global.tc('notification.profile.invalid.text'), + i18n.global.tc('notification.profile.invalid.title') + ); + + // ...and refresh + store.commit('fetchProfiles'); + return; + } + + state.game_install.profile = value; + + // Check for Northstar updates + store.commit('checkNorthstarUpdates'); + + // Save change in persistent store + await persistentStore.set('game-install', { value: state.game_install }); + await persistentStore.save(); // explicit save to disk + }) + .catch((error) => { + console.error(error); + showErrorNotification(error); + }); } }, mounted() { -- cgit v1.2.3 From eb1dabde7dacdd36fd7f2e5da6f343bc5ef7c6d4 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 9 Aug 2023 23:09:59 +0200 Subject: feat: Add dialog box with a table of all profiles (#501) Does not yet include buttons to modify profiles. This has been moved into separate PR to keep diff small. --- src-vue/src/i18n/lang/en.json | 7 ++++++- src-vue/src/views/ChangelogView.vue | 4 ++++ src-vue/src/views/SettingsView.vue | 12 ++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src-vue/src') diff --git a/src-vue/src/i18n/lang/en.json b/src-vue/src/i18n/lang/en.json index 1fa4e7ee..2b056655 100644 --- a/src-vue/src/i18n/lang/en.json +++ b/src-vue/src/i18n/lang/en.json @@ -111,7 +111,12 @@ "show_deprecated_mods_desc2": "Watch out, such mods are usually deprecated for a good reason.", "profile": { - "active": "Active Profile" + "active": "Active Profile", + "edit": "Edit Profiles", + + "dialog": { + "title": "Profiles" + } }, "repair": { diff --git a/src-vue/src/views/ChangelogView.vue b/src-vue/src/views/ChangelogView.vue index 7ab50903..f75d869c 100644 --- a/src-vue/src/views/ChangelogView.vue +++ b/src-vue/src/views/ChangelogView.vue @@ -63,6 +63,10 @@ export default defineComponent({ padding: 20px 30px; } +.el-table .el-scrollbar__view { + padding: 0; +} + .fc__changelog__container { padding: 20px 30px; } diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue index c209da31..b1a62c56 100644 --- a/src-vue/src/views/SettingsView.vue +++ b/src-vue/src/views/SettingsView.vue @@ -1,4 +1,14 @@