aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src
diff options
context:
space:
mode:
Diffstat (limited to 'src-vue/src')
-rw-r--r--src-vue/src/components/PullRequestsSelector.vue10
-rw-r--r--src-vue/src/plugins/modules/pull_requests.ts21
2 files changed, 28 insertions, 3 deletions
diff --git a/src-vue/src/components/PullRequestsSelector.vue b/src-vue/src/components/PullRequestsSelector.vue
index 58a355f4..9ddefc7e 100644
--- a/src-vue/src/components/PullRequestsSelector.vue
+++ b/src-vue/src/components/PullRequestsSelector.vue
@@ -15,6 +15,7 @@
<el-card v-else shadow="hover" v-for="pull_request in pull_requests_launcher"
v-bind:key="pull_request.url">
<el-button type="primary" @click="installLauncherPR(pull_request)">Install</el-button>
+ <el-button type="primary" @click="downloadLauncherPR(pull_request)">Download</el-button>
<a target="_blank" :href="pull_request.html_url">
{{ pull_request.number }}: {{ pull_request.title }}
</a>
@@ -41,6 +42,7 @@
</p>
<el-card v-else shadow="hover" v-for="pull_request in pull_requests_mods" v-bind:key="pull_request.url">
<el-button type="primary" @click="installModsPR(pull_request)">Install</el-button>
+ <el-button type="primary" @click="downloadModsPR(pull_request)">Download</el-button>
<a target="_blank" :href="pull_request.html_url">
{{ pull_request.number }}: {{ pull_request.title }}
</a>
@@ -54,8 +56,6 @@
import { defineComponent } from 'vue'
import { PullRequestType } from '../../../src-tauri/bindings/PullRequestType';
import { PullsApiResponseElement } from '../../../src-tauri/bindings/PullsApiResponseElement';
-import { invoke } from "@tauri-apps/api";
-import { ElNotification } from "element-plus";
export default defineComponent({
name: 'PullRequestsSelector',
@@ -80,6 +80,12 @@ export default defineComponent({
async getPullRequests(pull_request_type: PullRequestType) {
this.$store.commit('getPullRequests', pull_request_type);
},
+ async downloadLauncherPR(pull_request: PullsApiResponseElement) {
+ this.$store.commit('downloadLauncherPR', pull_request);
+ },
+ async downloadModsPR(pull_request: PullsApiResponseElement) {
+ this.$store.commit('downloadModsPR', pull_request);
+ },
async installLauncherPR(pull_request: PullsApiResponseElement) {
this.$store.commit('installLauncherPR', pull_request);
},
diff --git a/src-vue/src/plugins/modules/pull_requests.ts b/src-vue/src/plugins/modules/pull_requests.ts
index 573856ad..64c85b77 100644
--- a/src-vue/src/plugins/modules/pull_requests.ts
+++ b/src-vue/src/plugins/modules/pull_requests.ts
@@ -1,5 +1,5 @@
import { ElNotification } from "element-plus";
-import { invoke } from "@tauri-apps/api";
+import { invoke, shell } from "@tauri-apps/api";
import { PullsApiResponseElement } from "../../../../src-tauri/bindings/PullsApiResponseElement";
import { PullRequestType } from '../../../../src-tauri/bindings/PullRequestType';
import { store } from "../store";
@@ -41,6 +41,25 @@ export const pullRequestModule = {
});
});
},
+ async downloadLauncherPR(state: PullRequestStoreState, pull_request: PullsApiResponseElement) {
+ await invoke<string>("get_launcher_download_link", { pullRequest: pull_request })
+ .then((url) => {
+ // Open URL in default HTTPS handler (i.e. default browser)
+ shell.open(url);
+ })
+ .catch((error) => {
+ ElNotification({
+ title: 'Error',
+ message: error,
+ type: 'error',
+ position: 'bottom-right'
+ });
+ });
+ },
+ async downloadModsPR(state: PullRequestStoreState, pull_request: PullsApiResponseElement) {
+ let url = `https://github.com/${pull_request.head.repo.full_name}/archive/refs/heads/${pull_request.head.ref}.zip`
+ shell.open(url);
+ },
async installLauncherPR(state: PullRequestStoreState, pull_request: PullsApiResponseElement) {
// Send notification telling the user to wait for the process to finish
const notification = ElNotification({