mirror of
https://github.com/dathere/qsv-easy-windows-installer.git
synced 2025-12-27 19:47:00 +00:00
Compare commits
No commits in common. "main" and "v1.0.0" have entirely different histories.
6 changed files with 15 additions and 30 deletions
13
.github/workflows/publish.yml
vendored
13
.github/workflows/publish.yml
vendored
|
|
@ -3,6 +3,8 @@ name: "Publish to Releases"
|
|||
on:
|
||||
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:
|
||||
publish-tauri:
|
||||
permissions:
|
||||
|
|
@ -23,11 +25,7 @@ jobs:
|
|||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.bun/install/cache
|
||||
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
||||
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
@ -39,11 +37,6 @@ jobs:
|
|||
# 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' || '' }}
|
||||
|
||||
- name: Cache cargo deps and target folder
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: "./src-tauri -> target"
|
||||
|
||||
- name: install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "qsv-easy-installer",
|
||||
"private": true,
|
||||
"version": "1.1.1",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
|
|
|||
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
|
|
@ -3058,7 +3058,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "qsv-easy-installer"
|
||||
version = "1.0.0"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"reqwest",
|
||||
"serde",
|
||||
|
|
|
|||
|
|
@ -1,35 +1,30 @@
|
|||
use std::io::Write;
|
||||
|
||||
use tauri::Manager;
|
||||
use tempfile::tempfile;
|
||||
use winreg::{enums::HKEY_CURRENT_USER, RegKey};
|
||||
|
||||
#[tauri::command]
|
||||
async fn run_path_update(app_handle: tauri::AppHandle) {
|
||||
fn run_path_update(app_handle: tauri::AppHandle) {
|
||||
// Get app local data dir path
|
||||
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
|
||||
// Get the version of qsv
|
||||
let latest_release_endpoint = "https://api.github.com/repos/dathere/qsv/releases/latest";
|
||||
let client = reqwest::Client::new();
|
||||
let client = reqwest::blocking::Client::new();
|
||||
let res = client
|
||||
.get(latest_release_endpoint)
|
||||
.header(reqwest::header::USER_AGENT, "qsv easy installer")
|
||||
.send()
|
||||
.await
|
||||
.unwrap()
|
||||
.json::<serde_json::Value>()
|
||||
.await
|
||||
.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)
|
||||
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 zip_bytes = reqwest::get(zip_download_url)
|
||||
.await
|
||||
reqwest::blocking::get(zip_download_url)
|
||||
.unwrap()
|
||||
.bytes().await.unwrap();
|
||||
temp_zip_file.write_all(&zip_bytes).unwrap();
|
||||
.copy_to(&mut temp_zip_file)
|
||||
.unwrap();
|
||||
let mut zip = zip::ZipArchive::new(temp_zip_file).unwrap();
|
||||
let mut qsvp = zip.by_name("qsvp.exe").unwrap();
|
||||
// Create a bin folder in app_local_data_dir if it doesn't exist
|
||||
|
|
@ -40,7 +35,6 @@ async fn run_path_update(app_handle: tauri::AppHandle) {
|
|||
// Write qsvp.exe to bin/qsv.exe
|
||||
let mut qsv_file = std::fs::File::create(bin_dir.join("qsv.exe")).unwrap();
|
||||
std::io::copy(&mut qsvp, &mut qsv_file).unwrap();
|
||||
drop(qsv_file);
|
||||
// Add the bin dir to PATH
|
||||
let bin_dir_str = bin_dir.to_str().unwrap();
|
||||
// Get the current PATH
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "qsv-easy-installer",
|
||||
"version": "../package.json",
|
||||
"version": "1.0.0",
|
||||
"identifier": "com.qsv-easy-installer.app",
|
||||
"build": {
|
||||
"beforeDevCommand": "bun run dev",
|
||||
|
|
|
|||
10
src/App.tsx
10
src/App.tsx
|
|
@ -22,11 +22,9 @@ function App() {
|
|||
disabled={loading}
|
||||
onClick={() => {
|
||||
setLoading(true);
|
||||
invoke("run_path_update")
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
alert("Successfully installed qsv. Try opening a new terminal and run a qsv command!");
|
||||
});
|
||||
invoke("run_path_update").finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}}
|
||||
className="mx-auto w-full flex justify-center bg-blue-400"
|
||||
>
|
||||
|
|
@ -38,7 +36,7 @@ function App() {
|
|||
</button>
|
||||
{loading && (
|
||||
<p className="mt-4 text-center">
|
||||
Downloading and installing qsv to PATH. This may take a few seconds...
|
||||
Downloading and installing to PATH. This may take a few seconds...
|
||||
</p>
|
||||
)}
|
||||
</main>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue