aboutsummaryrefslogtreecommitdiff
path: root/src-vue
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2023-07-23 17:23:51 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2023-07-23 17:23:51 +0200
commite42f0db4cc81549e25f9e663e307606eff75ce53 (patch)
tree91e0d6faf6e02b6d982e9948730b45e2e86acd90 /src-vue
parent031ced476c38d08f7bec5312c16d1343a24e2469 (diff)
downloadFlightCore-e42f0db4cc81549e25f9e663e307606eff75ce53.tar.gz
FlightCore-e42f0db4cc81549e25f9e663e307606eff75ce53.zip
feat: Add button to DevView to calculate checksums
of files in game install location
Diffstat (limited to 'src-vue')
-rw-r--r--src-vue/src/views/DeveloperView.vue59
1 files changed, 59 insertions, 0 deletions
diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue
index 28ab3892..ce91af8c 100644
--- a/src-vue/src/views/DeveloperView.vue
+++ b/src-vue/src/views/DeveloperView.vue
@@ -50,6 +50,24 @@
<br />
<br />
+ <el-button type="primary" @click="computeChecksumsGameInstallFolder">
+ Compute checksums
+ </el-button>
+ <el-button type="primary" @click="copyToClipboard">
+ Copy to clipboard
+ </el-button>
+
+
+ <el-input
+ v-model="checksum_results"
+ type="textarea"
+ :rows="1"
+ placeholder="Output"
+ />
+
+ <br />
+ <br />
+
<el-button type="primary" @click="getAvailableNorthstarVersions">
Get available versions
</el-button>
@@ -130,6 +148,7 @@
</template>
<script lang="ts">
+import { Checksum } from "../../../src-tauri/bindings/Checksum";
import { defineComponent } from "vue";
import { invoke } from "@tauri-apps/api";
import { GameInstall } from "../utils/GameInstall";
@@ -148,6 +167,7 @@ export default defineComponent({
return {
mod_to_install_field_string: "",
release_notes_text: "",
+ checksum_results: "",
first_tag: { label: '', value: { name: '' } },
second_tag: { label: '', value: { name: '' } },
ns_release_tags: [] as TagWrapper[],
@@ -336,6 +356,45 @@ export default defineComponent({
.then((message) => { showNotification(`NSProton Version`, message as string); })
.catch((error) => { showNotification(`Error`, error, "error"); })
},
+ async computeChecksumsGameInstallFolder() {
+ let game_install = {
+ game_path: this.$store.state.game_path,
+ install_type: this.$store.state.install_type
+ } as GameInstall;
+
+ // Send notification telling the user to wait for the process to finish
+ const notification = showNotification(
+ "Calculating checksums",
+ "Please wait",
+ 'info',
+ 0
+ );
+
+ let checksum_calc_result = invoke<string>("calculate_checksums_gameinstall", { gameInstall: game_install });
+ await checksum_calc_result
+ .then((message) => {
+ // Send notification
+ this.checksum_results = message;
+ showNotification("Done calculating checksums");
+ })
+ .catch((error) => {
+ showErrorNotification(error);
+ console.error(error);
+ })
+ .finally(() => {
+ // Clear old notification
+ notification.close();
+ });
+ },
+ async copyToClipboard() {
+ navigator.clipboard.writeText(this.checksum_results)
+ .then(() => {
+ showNotification("Copied to clipboard");
+ })
+ .catch(() => {
+ showErrorNotification("Failed copying to clipboard");
+ });
+ }
}
});
</script>