mirror of
https://github.com/dathere/qsv-easy-windows-installer.git
synced 2025-12-27 19:47:00 +00:00
Compare commits
9 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9d7651956 | ||
|
|
01629d5de4 | ||
|
|
c25b53c45a | ||
|
|
60f9e106f9 | ||
|
|
683534797b | ||
|
|
d9543dd49b | ||
|
|
1463a3675b | ||
|
|
f776d7f293 | ||
|
|
ca5bc328fc |
6 changed files with 30 additions and 15 deletions
13
.github/workflows/publish.yml
vendored
13
.github/workflows/publish.yml
vendored
|
|
@ -3,8 +3,6 @@ name: "Publish to Releases"
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release.
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-tauri:
|
publish-tauri:
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -25,7 +23,11 @@ jobs:
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.bun/install/cache
|
||||||
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
||||||
- name: setup node
|
- name: setup node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -37,6 +39,11 @@ jobs:
|
||||||
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
|
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
|
||||||
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||||
|
|
||||||
|
- name: Cache cargo deps and target folder
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: "./src-tauri -> target"
|
||||||
|
|
||||||
- name: install dependencies (ubuntu only)
|
- name: install dependencies (ubuntu only)
|
||||||
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
|
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "qsv-easy-installer",
|
"name": "qsv-easy-installer",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0",
|
"version": "1.1.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|
|
||||||
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
|
|
@ -3058,7 +3058,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "qsv-easy-installer"
|
name = "qsv-easy-installer"
|
||||||
version = "0.1.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,35 @@
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
use tauri::Manager;
|
use tauri::Manager;
|
||||||
use tempfile::tempfile;
|
use tempfile::tempfile;
|
||||||
use winreg::{enums::HKEY_CURRENT_USER, RegKey};
|
use winreg::{enums::HKEY_CURRENT_USER, RegKey};
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn run_path_update(app_handle: tauri::AppHandle) {
|
async fn run_path_update(app_handle: tauri::AppHandle) {
|
||||||
// Get app local data dir path
|
// Get app local data dir path
|
||||||
let app_local_data_dir = app_handle.path().app_local_data_dir().unwrap();
|
let app_local_data_dir = app_handle.path().app_local_data_dir().unwrap();
|
||||||
// Download qsv to bin dir if it doesn't exist and overwrite any existing qsv
|
// Download qsv to bin dir if it doesn't exist and overwrite any existing qsv
|
||||||
// Get the version of qsv
|
// Get the version of qsv
|
||||||
let latest_release_endpoint = "https://api.github.com/repos/dathere/qsv/releases/latest";
|
let latest_release_endpoint = "https://api.github.com/repos/dathere/qsv/releases/latest";
|
||||||
let client = reqwest::blocking::Client::new();
|
let client = reqwest::Client::new();
|
||||||
let res = client
|
let res = client
|
||||||
.get(latest_release_endpoint)
|
.get(latest_release_endpoint)
|
||||||
.header(reqwest::header::USER_AGENT, "qsv easy installer")
|
.header(reqwest::header::USER_AGENT, "qsv easy installer")
|
||||||
.send()
|
.send()
|
||||||
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.json::<serde_json::Value>()
|
.json::<serde_json::Value>()
|
||||||
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let release_version = res.get("name").unwrap().as_str().unwrap();
|
let release_version = res.get("name").unwrap().as_str().unwrap();
|
||||||
// Download the zip file temporarily then extract the relevant qsvp file (we use qsvp instead of qsv for the broadest compatibility)
|
// Download the zip file temporarily then extract the relevant qsvp file (we use qsvp instead of qsv for the broadest compatibility)
|
||||||
let zip_download_url = format!("https://github.com/dathere/qsv/releases/download/{release_version}/qsv-{release_version}-x86_64-pc-windows-msvc.zip");
|
let zip_download_url = format!("https://github.com/dathere/qsv/releases/download/{release_version}/qsv-{release_version}-x86_64-pc-windows-msvc.zip");
|
||||||
let mut temp_zip_file = tempfile().unwrap();
|
let mut temp_zip_file = tempfile().unwrap();
|
||||||
reqwest::blocking::get(zip_download_url)
|
let zip_bytes = reqwest::get(zip_download_url)
|
||||||
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.copy_to(&mut temp_zip_file)
|
.bytes().await.unwrap();
|
||||||
.unwrap();
|
temp_zip_file.write_all(&zip_bytes).unwrap();
|
||||||
let mut zip = zip::ZipArchive::new(temp_zip_file).unwrap();
|
let mut zip = zip::ZipArchive::new(temp_zip_file).unwrap();
|
||||||
let mut qsvp = zip.by_name("qsvp.exe").unwrap();
|
let mut qsvp = zip.by_name("qsvp.exe").unwrap();
|
||||||
// Create a bin folder in app_local_data_dir if it doesn't exist
|
// Create a bin folder in app_local_data_dir if it doesn't exist
|
||||||
|
|
@ -35,6 +40,7 @@ fn run_path_update(app_handle: tauri::AppHandle) {
|
||||||
// Write qsvp.exe to bin/qsv.exe
|
// Write qsvp.exe to bin/qsv.exe
|
||||||
let mut qsv_file = std::fs::File::create(bin_dir.join("qsv.exe")).unwrap();
|
let mut qsv_file = std::fs::File::create(bin_dir.join("qsv.exe")).unwrap();
|
||||||
std::io::copy(&mut qsvp, &mut qsv_file).unwrap();
|
std::io::copy(&mut qsvp, &mut qsv_file).unwrap();
|
||||||
|
drop(qsv_file);
|
||||||
// Add the bin dir to PATH
|
// Add the bin dir to PATH
|
||||||
let bin_dir_str = bin_dir.to_str().unwrap();
|
let bin_dir_str = bin_dir.to_str().unwrap();
|
||||||
// Get the current PATH
|
// Get the current PATH
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "qsv-easy-installer",
|
"productName": "qsv-easy-installer",
|
||||||
"version": "1.0.0",
|
"version": "../package.json",
|
||||||
"identifier": "com.qsv-easy-installer.app",
|
"identifier": "com.qsv-easy-installer.app",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "bun run dev",
|
"beforeDevCommand": "bun run dev",
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,10 @@ function App() {
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
invoke("run_path_update").finally(() => {
|
invoke("run_path_update")
|
||||||
|
.finally(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
alert("Successfully installed qsv. Try opening a new terminal and run a qsv command!");
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className="mx-auto w-full flex justify-center bg-blue-400"
|
className="mx-auto w-full flex justify-center bg-blue-400"
|
||||||
|
|
@ -36,7 +38,7 @@ function App() {
|
||||||
</button>
|
</button>
|
||||||
{loading && (
|
{loading && (
|
||||||
<p className="mt-4 text-center">
|
<p className="mt-4 text-center">
|
||||||
Downloading and installing to PATH. This may take a few seconds...
|
Downloading and installing qsv to PATH. This may take a few seconds...
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue