aboutsummaryrefslogtreecommitdiff
path: root/src-vue
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2022-11-19 10:04:43 +0100
committerGitHub <noreply@github.com>2022-11-19 10:04:43 +0100
commit38e12489a517662157d85ec6efec00f225cccc9c (patch)
tree16d8218fffaba26f8e44d6dff56ef4e3e1f29233 /src-vue
parentd3c190bd4d3461fc4c310f64eb74a8e2425baaad (diff)
downloadFlightCore-38e12489a517662157d85ec6efec00f225cccc9c.tar.gz
FlightCore-38e12489a517662157d85ec6efec00f225cccc9c.zip
feat: Initial support for installing mods from TS (#32)
* feat: Initial support for installing mods from TS This is the basic code needed to install a mod from Thunderstore * refactor: Remove console log, show msg in notif Instead of console logging result message, show it in notification instead. * refactor: Rename function to indicate behaviour Function not only installs but also downloads mod first. Although it does remove downloaded zip post installation. * refactor: Move install logic to dedicated module `mod_management` module didn't exist when this PR was created * chore: Trim single leftover newline * fix: Update code for newer `libthermite` version * feat: Allow installing older versions of mods Installs the given version number instead of only allowing latest. * fix: Explicit error msg for installing NS as mod While it would fail during install anyway, having explicit error message is nicer * feat: Write TS mod string to mod.json Write Thunderstore mod string of installed mod to its `mod.json` This way we can later check whether a mod is outdated based on the Thunderstore mod string * fix: Early return on empty string Prevent trying to install the first mod that matches an early string. We should never pass an empty string in the first place but better safe then sorry. * build: Add dependency for recursive async Needed for recursive mod dependency install * feat: Recursively install mod dependencies * fix: Early catch installing R2modman as mod Just in case to prevent someone trying to install R2modman as a mod. * refactor: Remove debug prints * fix: Allow installing mods having NS as dependency They would previously error out as Northstar cannot be installed as dependency. We now catch that specific error and return Ok(()) * fix: Delete download folder after mod install Deletes download folder after mod install if non-empty. * fix: Do not early leave when dependency is NS Logic error, instead of skipping installing Northstar as dependency it would previously just return early with success. * chore: Remove leftover commented out code
Diffstat (limited to 'src-vue')
-rw-r--r--src-vue/src/views/DeveloperView.vue65
1 files changed, 65 insertions, 0 deletions
diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue
index 1e9c5e99..2fa5d89e 100644
--- a/src-vue/src/views/DeveloperView.vue
+++ b/src-vue/src/views/DeveloperView.vue
@@ -22,6 +22,15 @@
Toggle Release Candidate
</el-button>
+
+ <h3>Mod install:</h3>
+
+ <el-input v-model="mod_to_install_field_string" placeholder="Please input Thunderstore dependency string" clearable />
+
+ <el-button type="primary" @click="installMod">
+ Install mod
+ </el-button>
+
<h3>Repair:</h3>
<el-button type="primary" @click="disableAllModsButCore">
@@ -32,6 +41,10 @@
Get installed mods
</el-button>
+ <el-button type="primary" @click="cleanUpDownloadFolder">
+ Force delete temp download folder
+ </el-button>
+
</div>
</template>
@@ -46,6 +59,11 @@ const persistentStore = new Store('flight-core-settings.json');
export default defineComponent({
name: "DeveloperView",
+ data() {
+ return {
+ mod_to_install_field_string : "",
+ }
+ },
methods: {
disableDevMode() {
this.$store.commit('toggleDeveloperMode');
@@ -149,6 +167,53 @@ export default defineComponent({
position: 'bottom-right'
});
});
+ },
+ async installMod() {
+ let game_install = {
+ game_path: this.$store.state.game_path,
+ install_type: this.$store.state.install_type
+ } 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.
+ ElNotification({
+ title: `Installed ${mod_to_install}`,
+ message: message as string,
+ type: 'success',
+ position: 'bottom-right'
+ });
+ })
+ .catch((error) => {
+ ElNotification({
+ title: 'Error',
+ message: error,
+ type: 'error',
+ position: 'bottom-right'
+ });
+ });
+ },
+ async cleanUpDownloadFolder() {
+ let game_install = {
+ game_path: this.$store.state.game_path,
+ 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.
+ ElNotification({
+ title: `Done`,
+ message: `Done`,
+ type: 'success',
+ position: 'bottom-right'
+ });
+ })
+ .catch((error) => {
+ ElNotification({
+ title: 'Error',
+ message: error,
+ type: 'error',
+ position: 'bottom-right'
+ });
+ });
}
}
});