diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2023-03-21 18:28:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 17:28:18 +0000 |
commit | a22486193ef49113851fab6f277d50f796ecc636 (patch) | |
tree | ae527a566c5a0e99032e16195a40b550fdeb328f /src-vue/src/plugins | |
parent | 36fdc302bef162d213d6a026c99614673b24a069 (diff) | |
download | FlightCore-a22486193ef49113851fab6f277d50f796ecc636.tar.gz FlightCore-a22486193ef49113851fab6f277d50f796ecc636.zip |
Add buttons to download PRs (#203)
* feat: Add button to download Mods PR
Simply opens the browser on the repo download link
* feat: Add button to download Launcher PR
Uses existing function to fetch nightly.link link and opens it in
browser
* refactor: Open Mods PR download link via TS
as opposed to having a link directly
This way it acts the same way as the Launcher PR download button.
Reason behind this change being consistent UI style.
* chore: Revert introduced formatting changes
Those were added by accident, whoops
* fix: Remove introduced unused dependency
* fix: Remove unused dependencies
Diffstat (limited to 'src-vue/src/plugins')
-rw-r--r-- | src-vue/src/plugins/modules/pull_requests.ts | 21 |
1 files changed, 20 insertions, 1 deletions
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({ |