mirror of
https://github.com/mmvanheusden/SteamDepotDownloaderGUI.git
synced 2026-02-04 13:41:18 +01:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2d47a9e52 | ||
|
|
9bee63241e | ||
|
|
91ff8060ca | ||
|
|
a96771685c | ||
|
|
e61c0ebf34 | ||
|
|
56843f07d2 | ||
|
|
e681aceb29 | ||
|
|
7891ed19e1 | ||
|
|
95c2d8efc4 | ||
|
|
3155054531 | ||
|
|
04e8498edb | ||
|
|
69ca8dbf97 | ||
|
|
b479f50005 | ||
|
|
2cb21bea17 | ||
|
|
63c421ae10 | ||
|
|
9fadf3a627 | ||
|
|
ba7c17513a | ||
|
|
8d227944cf | ||
|
|
a13d689b8c | ||
|
|
5f0b9781c6 | ||
|
|
02a36e997e | ||
|
|
9374b9d382 | ||
|
|
6ed3e71536 | ||
|
|
bbdf0955db | ||
|
|
a8cd68fce6 | ||
|
|
55a65a54dc | ||
|
|
90c1c10253 | ||
|
|
377a0fcb98 | ||
|
|
3f70e4ef91 | ||
|
|
17434ecaad | ||
|
|
a2daed0739 | ||
|
|
2406e0ddc8 | ||
|
|
5c6094c2f1 |
99
.github/workflows/build.yml
vendored
Normal file
99
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
name: 'build'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-tauri:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: 'macos-latest'
|
||||
arch: 'aarch64'
|
||||
args: '--target aarch64-apple-darwin --bundles dmg'
|
||||
- platform: 'macos-latest'
|
||||
arch: 'x86_64'
|
||||
args: '--target x86_64-apple-darwin --bundles dmg'
|
||||
- platform: 'ubuntu-22.04'
|
||||
args: '--bundles appimage'
|
||||
- platform: 'windows-latest'
|
||||
args: ''
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
||||
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: setup node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||
|
||||
- name: Rust cache
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src-tauri -> target'
|
||||
|
||||
- name: install frontend dependencies
|
||||
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
|
||||
run: pnpm install # change this to npm or pnpm depending on which one you use.
|
||||
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
id: build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
args: ${{ matrix.args }}
|
||||
includeUpdaterJson: false
|
||||
|
||||
- name: fix JSON
|
||||
if: matrix.platform != 'windows-latest'
|
||||
id: truncate_paths
|
||||
run: echo "paths=$(echo '${{ steps.build.outputs.artifactPaths }}' | sed 's/^..//' | sed 's/..$//')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: upload macos artifacts (M1)
|
||||
if: matrix.platform == 'macos-latest' && matrix.arch == 'aarch64'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-m1-artifacts
|
||||
path: ${{ steps.truncate_paths.outputs.paths }}
|
||||
|
||||
- name: upload macos artifacts (Intel)
|
||||
if: matrix.platform == 'macos-latest' && matrix.arch == 'x86_64'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-intel-artifacts
|
||||
path: ${{ steps.truncate_paths.outputs.paths }}
|
||||
|
||||
- name: upload linux artifacts
|
||||
if: matrix.platform == 'ubuntu-22.04'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-artifacts
|
||||
path: ${{ steps.truncate_paths.outputs.paths }}
|
||||
|
||||
- name: upload windows artifacts
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-artifacts
|
||||
path: "./src-tauri/target/release/bundle/*" # fck windows
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<h4>A graphical wrapper for DepotDownloader, designed to make downloading older versions of Steam games easy.</h4>
|
||||
|
||||
→ <a href="https://www.youtube.com/watch?v=H2COwT5OUOo" target="_blank"><b>Tutorial</b></a> ~
|
||||
<a href="https://depotdownloader.00pium.net/" target="_blank"><b>Website</b></a> ~
|
||||
<a href="https://depotdownloader.aphex.cc/" target="_blank"><b>Website</b></a> ~
|
||||
<a href="https://www.youtube.com/watch?v=ogiDAuH3VdY" target="_blank"><b>Example usage</b></a> ←
|
||||
</h4>
|
||||
|
||||
@@ -92,7 +92,7 @@ $ pnpm eslint --fix src/
|
||||
<a href="https://www.gnu.org/licenses/gpl-3.0" target="_blank">
|
||||
<img src="https://github.com/mmvanheusden/SteamDepotDownloaderGUI/assets/50550545/b5649b7f-ea49-45c4-b0cd-5f3788dcd6ca" height="40px">
|
||||
</a>
|
||||
<a href="https://00pium.net" target="_blank">
|
||||
<a href="https://aphex.cc" target="_blank">
|
||||
<img src="https://github.com/mmvanheusden/SteamDepotDownloaderGUI/assets/50550545/83f5f3b2-2bf9-41aa-ab87-880466f785fe" height="40px">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
25
package.json
25
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vectum",
|
||||
"private": true,
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"type": "module",
|
||||
"license": "GPL-3.0-only",
|
||||
"scripts": {
|
||||
@@ -11,20 +11,21 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.1.1",
|
||||
"@tauri-apps/plugin-dialog": "2.0.1",
|
||||
"@tauri-apps/plugin-shell": "2.0.1",
|
||||
"jquery": "^3.7.1"
|
||||
"@tauri-apps/api": "2.2.0",
|
||||
"@tauri-apps/plugin-dialog": "2.2.0",
|
||||
"@tauri-apps/plugin-shell": "2.2.0",
|
||||
"jquery": "^3.7.1",
|
||||
"tauri-plugin-shellx-api": "^2.0.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.15.0",
|
||||
"@tauri-apps/cli": "2.1.0",
|
||||
"@eslint/js": "^9.20.0",
|
||||
"@tauri-apps/cli": "2.2.7",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
"@types/jquery": "^3.5.32",
|
||||
"eslint": "^9.15.0",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-eslint": "^8.14.0",
|
||||
"vite": "^5.4.11"
|
||||
"eslint": "^9.20.1",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript-eslint": "^8.24.1",
|
||||
"vite": "^6.1.1"
|
||||
},
|
||||
"packageManager": "pnpm@9.13.2"
|
||||
"packageManager": "pnpm@10.4.1"
|
||||
}
|
||||
|
||||
939
pnpm-lock.yaml
generated
939
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
883
src-tauri/Cargo.lock
generated
883
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "vectum"
|
||||
version = "3.0.0"
|
||||
version = "3.0.1"
|
||||
description = "Download older versions of Steam games with DepotDownloader"
|
||||
authors = ["mmvanheusden"]
|
||||
edition = "2021"
|
||||
@@ -9,20 +9,35 @@ license = "GPL-3.0-only"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.0.3", features = [] }
|
||||
tauri-build = { version = "2.0.5", features = [] }
|
||||
|
||||
[dependencies]
|
||||
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs" }
|
||||
tauri = { version = "2.1.1", features = [] }
|
||||
tauri-plugin-shell = "2.0.2"
|
||||
tauri-plugin-dialog = "2.0.3"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tauri = { version = "2.2.5", features = [] }
|
||||
tauri-plugin-dialog = "2.2.0"
|
||||
serde = { version = "1.0.218", features = ["derive"] }
|
||||
serde_json = "1.0.139"
|
||||
derive-getters = "0.5.0"
|
||||
sha256 = "1.5.0"
|
||||
reqwest = { version = "0.12.9",features = ["blocking"] }
|
||||
zip = "2.2.0"
|
||||
async-process = "2.3.0"
|
||||
reqwest = { version = "0.12.12",features = ["blocking"] }
|
||||
zip = "2.2.2"
|
||||
tauri-plugin-shellx = "2.0.12"
|
||||
|
||||
|
||||
|
||||
# Bacon - https://dystroy.org/bacon/
|
||||
# Mold - https://github.com/rui314/mold#how-to-use
|
||||
# https://discord.com/channels/616186924390023171/731495028677148753/1254902668376150149
|
||||
[profile.dev]
|
||||
incremental = true
|
||||
opt-level = 1
|
||||
debug = 0
|
||||
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 2
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1 # Allows LLVM to perform better optimization.
|
||||
lto = true # Enables link-time-optimizations.
|
||||
opt-level = 3 # Prioritizes small binary size. Use `3` if you prefer speed.
|
||||
panic = "abort" # Higher performance by disabling panic handlers.
|
||||
strip = true # Ensures debug symbols are removed.
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"shell:allow-open",
|
||||
"dialog:default",
|
||||
"shell:default"
|
||||
"shellx:allow-open",
|
||||
"shellx:allow-execute",
|
||||
"shellx:allow-spawn"
|
||||
]
|
||||
}
|
||||
@@ -1,19 +1,13 @@
|
||||
use crate::get_os;
|
||||
use reqwest;
|
||||
use std::fs::File;
|
||||
use std::io::ErrorKind::AlreadyExists;
|
||||
use std::path::PathBuf;
|
||||
use std::{fs, io};
|
||||
use std::{io::Write, path::Path};
|
||||
|
||||
use crate::get_os;
|
||||
use reqwest;
|
||||
use sha256;
|
||||
pub static DEPOTDOWNLOADER_VERSION: &str = "3.0.0";
|
||||
|
||||
pub static DEPOTDOWNLOADER_VERSION: &str = "2.7.4";
|
||||
|
||||
pub fn calc_checksum(path: &Path) -> io::Result<String> {
|
||||
let bytes = fs::read(path)?;
|
||||
let hash = sha256::digest(&bytes);
|
||||
Ok(hash)
|
||||
}
|
||||
|
||||
/**
|
||||
See: [`test_get_depotdownloader_url()`]
|
||||
@@ -36,6 +30,13 @@ pub async fn download_file(url: &str, filename: &Path) -> io::Result<()> {
|
||||
return Err(io::Error::from(AlreadyExists));
|
||||
}
|
||||
|
||||
// Create any missing directories.
|
||||
if let Some(p) = filename.parent() {
|
||||
if !p.exists() {
|
||||
fs::create_dir_all(p)?;
|
||||
}
|
||||
}
|
||||
|
||||
let mut file = File::create(filename)?;
|
||||
let response = reqwest::get(url)
|
||||
.await
|
||||
@@ -48,16 +49,15 @@ pub async fn download_file(url: &str, filename: &Path) -> io::Result<()> {
|
||||
}
|
||||
|
||||
/// Unzips DepotDownloader zips
|
||||
pub fn unzip(zip_file: &Path) -> io::Result<()> {
|
||||
pub fn unzip(zip_file: &Path, working_dir: &PathBuf) -> io::Result<()> {
|
||||
let file = File::open(zip_file)?;
|
||||
let mut archive = zip::ZipArchive::new(file)?;
|
||||
|
||||
for i in 0..archive.len() {
|
||||
let mut file = archive.by_index(i)?;
|
||||
|
||||
let outpath = match file.enclosed_name() {
|
||||
Some(path) => path,
|
||||
None => continue
|
||||
Some(path) => working_dir.join(path),
|
||||
None => continue,
|
||||
};
|
||||
|
||||
println!("Extracted {} from archive.", outpath.display());
|
||||
@@ -70,9 +70,9 @@ pub fn unzip(zip_file: &Path) -> io::Result<()> {
|
||||
let mut outfile = File::create(&outpath)?;
|
||||
io::copy(&mut file, &mut outfile)?;
|
||||
|
||||
|
||||
// Copy over permissions from enclosed file to extracted file on Unix and macOS systems.
|
||||
if get_os() != "windows" {
|
||||
// Copy over permissions from enclosed file to extracted file on UNIX systems.
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
|
||||
// If the mode `file.unix_mode()` is something (not None), copy it over to the extracted file.
|
||||
@@ -80,9 +80,9 @@ pub fn unzip(zip_file: &Path) -> io::Result<()> {
|
||||
fs::set_permissions(&outpath, fs::Permissions::from_mode(mode))?;
|
||||
}
|
||||
|
||||
// Set DepotDownloader executable.
|
||||
if outpath.display().to_string() == "DepotDownloader" {
|
||||
fs::set_permissions(&outpath, fs::Permissions::from_mode(0o755))?; // WTF is an octal?
|
||||
// Set executable permission.
|
||||
if outpath.file_name().unwrap() == "DepotDownloader" {
|
||||
fs::set_permissions(&outpath, fs::Permissions::from_mode(0o755))?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +1,51 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use std::env;
|
||||
use std::io;
|
||||
use std::path::Path;
|
||||
use std::sync::OnceLock;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::depotdownloader::{get_depotdownloader_url, DEPOTDOWNLOADER_VERSION};
|
||||
use crate::terminal::Terminal;
|
||||
use tauri::{AppHandle, Emitter};
|
||||
|
||||
mod depotdownloader;
|
||||
mod steam;
|
||||
mod terminal;
|
||||
|
||||
use crate::depotdownloader::{get_depotdownloader_url, DEPOTDOWNLOADER_VERSION};
|
||||
use crate::terminal::Terminal;
|
||||
use std::env;
|
||||
use std::io::ErrorKind::AlreadyExists;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::OnceLock;
|
||||
use std::time::Duration;
|
||||
use tauri::{AppHandle, Emitter, Manager};
|
||||
use tauri_plugin_shellx::ShellExt;
|
||||
|
||||
|
||||
/// The first terminal found. Used as default terminal.
|
||||
static TERMINAL: OnceLock<Vec<Terminal>> = OnceLock::new(); // We create this variable now, and quickly populate it in preload_vectum(). we then later access the data in start_download()
|
||||
static WORKING_DIR: OnceLock<PathBuf> = OnceLock::new();
|
||||
|
||||
/// This function is called every time the app is reloaded/started. It quickly populates the [`TERMINAL`] variable with a working terminal.
|
||||
#[tauri::command]
|
||||
async fn preload_vectum(app: AppHandle) {
|
||||
// Only fill this variable once.
|
||||
// Only fill these variables once.
|
||||
if TERMINAL.get().is_none() {
|
||||
TERMINAL
|
||||
.set(terminal::get_installed_terminals(true).await)
|
||||
.expect("Failed to set available terminals")
|
||||
TERMINAL.set(terminal::get_installed_terminals(true, app.shell()).await).expect("Failed to set available terminals")
|
||||
}
|
||||
|
||||
if WORKING_DIR.get().is_none() {
|
||||
WORKING_DIR.set(Path::join(&app.path().local_data_dir().unwrap(), "SteamDepotDownloaderGUI")).expect("Failed to configure working directory")
|
||||
}
|
||||
|
||||
// Send the default terminal name to the frontend.
|
||||
app.emit(
|
||||
"default-terminal",
|
||||
Terminal::pretty_name(&TERMINAL.get().unwrap()[0]),
|
||||
)
|
||||
.unwrap();
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn start_download(steam_download: steam::SteamDownload) {
|
||||
async fn start_download(steam_download: steam::SteamDownload, app: AppHandle) {
|
||||
let default_terminal = TERMINAL.get().unwrap();
|
||||
let working_dir = env::current_dir().unwrap();
|
||||
|
||||
let shell = app.shell();
|
||||
let terminal_to_use = if steam_download.options().terminal().is_none() { default_terminal.first().unwrap() } else { &Terminal::from_index(&steam_download.options().terminal().unwrap()).unwrap() };
|
||||
// Also change working directory
|
||||
std::env::set_current_dir(&WORKING_DIR.get().unwrap()).unwrap();
|
||||
|
||||
println!("\n-------------------------DEBUG INFO------------------------");
|
||||
println!("received these values from frontend:");
|
||||
@@ -52,11 +56,11 @@ async fn start_download(steam_download: steam::SteamDownload) {
|
||||
println!("\t- Manifest ID: {}", steam_download.manifest_id());
|
||||
println!("\t- Output Path: {}", steam_download.output_path());
|
||||
println!("\t- Default terminal: {}", Terminal::pretty_name(&default_terminal[0]));
|
||||
println!("\t- Terminal command: {:?}", terminal_to_use.create_command(&steam_download));
|
||||
println!("\t- Working directory: {}", working_dir.display());
|
||||
println!("\t- Working directory: {}", &WORKING_DIR.get().unwrap().display());
|
||||
println!("\t- Terminal command: \n\t {:?}", terminal_to_use.create_command(&steam_download, shell, &WORKING_DIR.get().unwrap()));
|
||||
println!("----------------------------------------------------------\n");
|
||||
|
||||
terminal_to_use.create_command(&steam_download).spawn().ok();
|
||||
terminal_to_use.create_command(&steam_download, shell, &WORKING_DIR.get().unwrap()).spawn().ok();
|
||||
}
|
||||
|
||||
/// Downloads the DepotDownloader zip file from the internet based on the OS.
|
||||
@@ -66,26 +70,21 @@ async fn download_depotdownloader() {
|
||||
|
||||
// Where we store the DepotDownloader zip.
|
||||
let zip_filename = format!("DepotDownloader-v{}-{}.zip", DEPOTDOWNLOADER_VERSION, env::consts::OS);
|
||||
let depotdownloader_zip = Path::new(&zip_filename);
|
||||
let depotdownloader_zip = Path::join(&WORKING_DIR.get().unwrap(), Path::new(&zip_filename));
|
||||
|
||||
println!("Downloading DepotDownloader for {} to {}/{}", env::consts::OS, env::current_dir().unwrap().display(), depotdownloader_zip.display());
|
||||
|
||||
match depotdownloader::download_file(url.as_str(), depotdownloader_zip).await {
|
||||
Err(e) => {
|
||||
if e.kind() == io::ErrorKind::AlreadyExists {
|
||||
println!("DepotDownloader already exists. Skipping download.");
|
||||
return;
|
||||
}
|
||||
|
||||
if let Err(e) = depotdownloader::download_file(url.as_str(), depotdownloader_zip.as_path()).await {
|
||||
if e.kind() == AlreadyExists {
|
||||
println!("DepotDownloader already exists. Skipping download.");
|
||||
} else {
|
||||
println!("Failed to download DepotDownloader: {}", e);
|
||||
return;
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
println!("Downloaded DepotDownloader for {} to {}", env::consts::OS, depotdownloader_zip.display());
|
||||
}
|
||||
|
||||
println!("Succesfully downloaded DepotDownloader from {}", url);
|
||||
|
||||
depotdownloader::unzip(depotdownloader_zip).unwrap();
|
||||
depotdownloader::unzip(depotdownloader_zip.as_path(), &WORKING_DIR.get().unwrap()).unwrap();
|
||||
println!("Succesfully extracted DepotDownloader zip.");
|
||||
}
|
||||
|
||||
@@ -99,7 +98,7 @@ async fn internet_connection() -> bool {
|
||||
|
||||
#[tauri::command]
|
||||
async fn get_all_terminals(app: AppHandle) {
|
||||
let terminals = terminal::get_installed_terminals(false).await;
|
||||
let terminals = terminal::get_installed_terminals(false, app.shell()).await;
|
||||
|
||||
terminals.iter().for_each(|terminal| {
|
||||
println!("Terminal #{} ({}) is installed!", terminal.index().unwrap(), terminal.pretty_name());
|
||||
@@ -122,28 +121,24 @@ fn main() {
|
||||
// macOS: change dir to documents because upon opening, our current dir by default is "/".
|
||||
if get_os() == "macos" {
|
||||
let _ = fix_path_env::fix(); // todo: does this actually do something useful
|
||||
let documents_dir = format!(
|
||||
"{}/Documents/SteamDepotDownloaderGUI",
|
||||
std::env::var_os("HOME").unwrap().to_str().unwrap()
|
||||
);
|
||||
let documents_dir = Path::new(&documents_dir);
|
||||
// println!("{}", documents_dir.display());
|
||||
// let documents_dir = format!(
|
||||
// "{}/Documents/SteamDepotDownloaderGUI",
|
||||
// std::env::var_os("HOME").unwrap().to_str().unwrap()
|
||||
// );
|
||||
// let documents_dir = Path::new(&documents_dir);
|
||||
// // println!("{}", documents_dir.display());
|
||||
|
||||
std::fs::create_dir_all(documents_dir).unwrap();
|
||||
env::set_current_dir(documents_dir).unwrap();
|
||||
// std::fs::create_dir_all(documents_dir).unwrap();
|
||||
// env::set_current_dir(documents_dir).unwrap();
|
||||
}
|
||||
|
||||
println!();
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
|
||||
tauri::Builder::default().plugin(tauri_plugin_dialog::init()).plugin(tauri_plugin_shellx::init(true)).invoke_handler(tauri::generate_handler![
|
||||
start_download,
|
||||
download_depotdownloader,
|
||||
internet_connection,
|
||||
preload_vectum,
|
||||
get_all_terminals
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
]).run(tauri::generate_context!()).expect("error while running tauri application");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::path::PathBuf;
|
||||
use derive_getters::Getters;
|
||||
use serde::Deserialize;
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
||||
/// Represents the data required to download a Steam depot.
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
use crate::steam::SteamDownload;
|
||||
use async_process::Command;
|
||||
use serde::Serialize;
|
||||
use std::{env, fs};
|
||||
use std::fs::File;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use crate::get_os;
|
||||
use crate::steam::SteamDownload;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use tauri::Wry;
|
||||
use tauri_plugin_shellx::process::Command;
|
||||
use tauri_plugin_shellx::Shell;
|
||||
|
||||
/// Represents a terminal that can be used to run commands.
|
||||
/// **Should be in sync with the terminal dropdown in the frontend.**
|
||||
#[derive(Debug, Serialize, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Terminal {
|
||||
GNOMETerminal,
|
||||
Alacritty,
|
||||
@@ -17,11 +17,9 @@ pub enum Terminal {
|
||||
Xfce4Terminal,
|
||||
DeepinTerminal,
|
||||
Terminator,
|
||||
Terminology,
|
||||
Kitty,
|
||||
LXTerminal,
|
||||
Tilix,
|
||||
CoolRetroTerm,
|
||||
XTerm,
|
||||
CMD,
|
||||
Terminal
|
||||
@@ -34,7 +32,7 @@ impl Terminal {
|
||||
use self::Terminal::*;
|
||||
|
||||
vec![
|
||||
GNOMETerminal, Alacritty, Konsole, GNOMEConsole, Xfce4Terminal, DeepinTerminal, Terminator, Terminology, Kitty, LXTerminal, Tilix, CoolRetroTerm, XTerm, CMD, Terminal
|
||||
GNOMETerminal, Alacritty, Konsole, GNOMEConsole, Xfce4Terminal, DeepinTerminal, Terminator, Kitty, LXTerminal, Tilix, XTerm, CMD, Terminal
|
||||
].into_iter()
|
||||
}
|
||||
|
||||
@@ -52,7 +50,7 @@ impl Terminal {
|
||||
|
||||
/// Get total number of terminals **possible** depending on the OS
|
||||
pub fn total() -> u8 {
|
||||
if get_os() != "windows" || get_os() == "macos" {
|
||||
if get_os() == "windows" || get_os() == "macos" {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -67,13 +65,11 @@ impl Terminal {
|
||||
Terminal::Konsole => "Konsole",
|
||||
Terminal::Xfce4Terminal => "Xfce Terminal",
|
||||
Terminal::Terminator => "Terminator",
|
||||
Terminal::Terminology => "Terminology",
|
||||
Terminal::XTerm => "XTerm",
|
||||
Terminal::Kitty => "Kitty",
|
||||
Terminal::LXTerminal => "LXTerminal",
|
||||
Terminal::Tilix => "Tilix",
|
||||
Terminal::DeepinTerminal => "Deepin Terminal",
|
||||
Terminal::CoolRetroTerm => "cool-retro-term",
|
||||
Terminal::Alacritty => "Alacritty",
|
||||
Terminal::CMD => "cmd",
|
||||
Terminal::Terminal => "Terminal"
|
||||
@@ -84,62 +80,21 @@ impl Terminal {
|
||||
//region Probing a terminal
|
||||
/// Checks if a [`Terminal`] is installed.
|
||||
/// **See:** [`get_installed_terminals`]
|
||||
pub async fn installed(&self) -> bool {
|
||||
pub async fn installed(&self, shell: &Shell<Wry>) -> bool {
|
||||
match self {
|
||||
Terminal::CMD => { get_os() == "windows" }
|
||||
Terminal::GNOMETerminal => {
|
||||
let mut cmd = Command::new("gnome-terminal");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::GNOMEConsole => {
|
||||
let mut cmd = Command::new("kgx");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::Konsole => {
|
||||
let mut cmd = Command::new("konsole");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::Xfce4Terminal => {
|
||||
let mut cmd = Command::new("xfce4-terminal");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::Terminator => {
|
||||
let mut cmd = Command::new("terminator");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::Terminology => {
|
||||
let mut cmd = Command::new("terminology");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::XTerm => {
|
||||
let mut cmd = Command::new("xterm");
|
||||
cmd.arg("-v").output().await.is_ok()
|
||||
}
|
||||
Terminal::Kitty => {
|
||||
let mut cmd = Command::new("kitty");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::LXTerminal => {
|
||||
let mut cmd = Command::new("lxterminal");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::Tilix => {
|
||||
let mut cmd = Command::new("tilix");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::DeepinTerminal => {
|
||||
let mut cmd = Command::new("deepin-terminal");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::CoolRetroTerm => {
|
||||
let mut cmd = Command::new("cool-retro-term");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::Alacritty => {
|
||||
let mut cmd = Command::new("alacritty");
|
||||
cmd.arg("--version").output().await.is_ok()
|
||||
}
|
||||
Terminal::Terminal => { get_os() == "macos" }
|
||||
Terminal::CMD => get_os() == "windows",
|
||||
Terminal::GNOMETerminal => shell.command("gnome-terminal").arg("--version").status().await.is_ok(),
|
||||
Terminal::GNOMEConsole => shell.command("kgx").arg("--version").status().await.is_ok(),
|
||||
Terminal::Konsole => shell.command("konsole").arg("--version").status().await.is_ok(),
|
||||
Terminal::Xfce4Terminal => shell.command("xfce4-terminal").arg("--version").status().await.is_ok(),
|
||||
Terminal::Terminator => shell.command("terminator").arg("--version").status().await.is_ok(),
|
||||
Terminal::XTerm => shell.command("xterm").arg("-v").status().await.is_ok(),
|
||||
Terminal::Kitty => shell.command("kitty").arg("--version").status().await.is_ok(),
|
||||
Terminal::LXTerminal => shell.command("lxterminal").arg("--version").status().await.is_ok(),
|
||||
Terminal::Tilix => shell.command("tilix").arg("--version").status().await.is_ok(),
|
||||
Terminal::DeepinTerminal => shell.command("deepin-terminal").arg("--version").status().await.is_ok(),
|
||||
Terminal::Alacritty => shell.command("alacritty").arg("--version").status().await.is_ok(),
|
||||
Terminal::Terminal => get_os() == "macos",
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
@@ -161,168 +116,110 @@ impl Terminal {
|
||||
| Konsole | `konsole -e /usr/bin/env sh -c {command}` |
|
||||
| Xfce4Terminal | `xfce4-terminal -x /usr/bin/env sh -c {command}` |
|
||||
| Terminator | `terminator -T "Downloading depot..." -e {command}` |
|
||||
| Terminology | `terminology -e /usr/bin/env sh -c {command}` |
|
||||
| XTerm | `xterm -hold -T "Downloading depot..." -e /usr/bin/env sh -c {command}` |
|
||||
| Kitty | `kitty /usr/bin/env sh -c {command}` |
|
||||
| LXTerminal | `lxterminal -e /usr/bin/env sh -c {command}` |
|
||||
| Tilix | `tilix -e /usr/bin/env sh -c {command}` |
|
||||
| DeepinTerminal | `deepin-terminal -e /usr/bin/env sh -c {command}` |
|
||||
| CoolRetroTerm | `cool-retro-term -e /usr/bin/env sh -c {command}` |
|
||||
| Alacritty | `alacritty -e /usr/bin/env sh -c {command}` |
|
||||
| Terminal (macOS) | We create a bash script and run that using `open`. |
|
||||
|
||||
*/
|
||||
pub fn create_command(&self, steam_download: &SteamDownload) -> Command {
|
||||
pub fn create_command(&self, steam_download: &SteamDownload, shell: &Shell<Wry>, working_dir: &PathBuf) -> Command {
|
||||
let command = create_depotdownloader_command(steam_download);
|
||||
|
||||
match self {
|
||||
Terminal::CMD => {
|
||||
let mut cmd = Command::new("cmd.exe");
|
||||
return shell.command("cmd.exe").args(&["/c", "start", "PowerShell.exe", "-NoExit", "-Command"]).args(command);
|
||||
|
||||
/* let mut cmd = std::process::Command::new("cmd.exe");
|
||||
cmd.args(&["/c", "start", "PowerShell.exe", "-NoExit", "-Command"]).args(command);
|
||||
cmd
|
||||
|
||||
return cmd*/
|
||||
}
|
||||
Terminal::GNOMETerminal => {
|
||||
let mut cmd = Command::new("gnome-terminal");
|
||||
cmd.args([
|
||||
"--",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("gnome-terminal")
|
||||
.args(&["--", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::GNOMEConsole => {
|
||||
let mut cmd = Command::new("kgx");
|
||||
cmd.args([
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c"
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("kgx")
|
||||
.args(&["-e", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::Konsole => {
|
||||
let mut cmd = Command::new("konsole");
|
||||
cmd.args([
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("konsole")
|
||||
.args(&["-e", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::Xfce4Terminal => {
|
||||
let mut cmd = Command::new("xfce4-terminal");
|
||||
cmd.args([
|
||||
"-x",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("xfce4-terminal")
|
||||
.args(&["-x", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::Terminator => {
|
||||
let mut cmd = Command::new("terminator");
|
||||
cmd.args([
|
||||
"-T",
|
||||
"Downloading depot...",
|
||||
"-e",
|
||||
]).args(command);
|
||||
cmd
|
||||
}
|
||||
Terminal::Terminology => {
|
||||
let mut cmd = Command::new("terminology");
|
||||
cmd.args([
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("terminator")
|
||||
.args(&["-T", "Downloading depot...", "-e"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::XTerm => {
|
||||
let mut cmd = Command::new("xterm");
|
||||
cmd.args([
|
||||
"-hold",
|
||||
"-T",
|
||||
"Downloading depot...",
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("xterm")
|
||||
.args(&["-hold", "-T", "Downloading depot...", "-e", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::Kitty => {
|
||||
let mut cmd = Command::new("kitty");
|
||||
cmd.args([
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("kitty")
|
||||
.args(&["/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::LXTerminal => {
|
||||
let mut cmd = Command::new("lxterminal");
|
||||
cmd.args([
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("lxterminal")
|
||||
.args(&["-e", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::Tilix => {
|
||||
let mut cmd = Command::new("tilix");
|
||||
cmd.args([
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("tilix")
|
||||
.args(&["-e", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::DeepinTerminal => {
|
||||
let mut cmd = Command::new("deepin-terminal");
|
||||
cmd.args([
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
}
|
||||
Terminal::CoolRetroTerm => {
|
||||
let mut cmd = Command::new("cool-retro-term");
|
||||
cmd.args([
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("deepin-terminal")
|
||||
.args(&["-e", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
|
||||
Terminal::Alacritty => {
|
||||
let mut cmd = Command::new("alacritty");
|
||||
cmd.args([
|
||||
"-e",
|
||||
"/usr/bin/env",
|
||||
"sh",
|
||||
"-c",
|
||||
]).args(command);
|
||||
cmd
|
||||
shell.command("alacritty")
|
||||
.args(&["-e", "/usr/bin/env", "sh", "-c"])
|
||||
.args(command)
|
||||
.current_dir(working_dir.as_path())
|
||||
}
|
||||
Terminal::Terminal => {
|
||||
// Create a bash script and run that. Not very secure but it makes this easier.
|
||||
let download_script = format!("#!/bin/bash\ncd {}\n{}",env::current_dir().unwrap().display(), command[0]);
|
||||
// println!("{}", download_script);
|
||||
let download_script = format!("#!/bin/bash\ncd {}\n{}",working_dir.to_str().unwrap().replace(" ", "\\ "), command[0]);
|
||||
|
||||
fs::write("./script.sh", download_script).unwrap();
|
||||
fs::set_permissions("./script.sh", fs::Permissions::from_mode(0o755)).unwrap(); // Won't run without executable permission
|
||||
|
||||
let mut cmd = Command::new("/usr/bin/open");
|
||||
cmd.args(&["-a", "Terminal", "./script.sh"]);
|
||||
cmd
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
fs::set_permissions("./script.sh", fs::Permissions::from_mode(0o755)).unwrap(); // Won't run without executable permission
|
||||
}
|
||||
|
||||
shell.command("/usr/bin/open")
|
||||
.args(&["-a", "Terminal", "./script.sh"])
|
||||
.current_dir(working_dir.as_path())
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,17 +247,15 @@ A vector containing a list of terminals that should work.
|
||||
| Konsole | `konsole --version` |
|
||||
| Xfce4Terminal | `xfce4-terminal --version` |
|
||||
| Terminator | `terminator --version` |
|
||||
| Terminology | `terminology --version` |
|
||||
| XTerm | `xterm -v` |
|
||||
| Kitty | `kitty --version` |
|
||||
| LXTerminal | `lxterminal --version` |
|
||||
| Tilix | `tilix --version` |
|
||||
| DeepinTerminal | `deepin-terminal --version` |
|
||||
| CoolRetroTerm | `cool-retro-term --version` |
|
||||
| Alacritty | `alacritty --version` |
|
||||
|
||||
*/
|
||||
pub async fn get_installed_terminals(return_immediately: bool) -> Vec<Terminal> {
|
||||
pub async fn get_installed_terminals(return_immediately: bool, shell: &Shell<Wry>) -> Vec<Terminal> {
|
||||
match get_os() {
|
||||
"windows" => { return vec!(Terminal::CMD); }
|
||||
"macos" => { return vec!(Terminal::Terminal); }
|
||||
@@ -372,7 +267,7 @@ pub async fn get_installed_terminals(return_immediately: bool) -> Vec<Terminal>
|
||||
|
||||
for terminal in Terminal::iter() {
|
||||
// Probe terminal. If it doesn't raise an error, it is probably installed.
|
||||
if terminal.installed().await {
|
||||
if terminal.installed(shell).await {
|
||||
if return_immediately {
|
||||
return vec![terminal];
|
||||
}
|
||||
@@ -411,4 +306,4 @@ fn create_depotdownloader_command(steam_download: &SteamDownload) -> Vec<String>
|
||||
vec![format!(r#".\DepotDownloader.exe -username {} -password {} -app {} -depot {} -manifest {} -dir {}"#, steam_download.username().clone().unwrap(), steam_download.password().clone().unwrap(), steam_download.app_id(), steam_download.depot_id(), steam_download.manifest_id(), output_dir)]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"productName": "SteamDepotDownloaderGUI",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"identifier": "net.oopium.depotdownloader",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="form-group-header">
|
||||
<label for="username">Username</label>
|
||||
</div>
|
||||
<input class="form-control input-block" id="username" placeholder="Leave empty for anonymous download"
|
||||
<input spellcheck="false" class="form-control input-block" id="username" placeholder="Leave empty for anonymous download"
|
||||
type="text"/>
|
||||
</div>
|
||||
|
||||
@@ -174,6 +174,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div hidden id="nopathwarning">
|
||||
<div class="flash flash-warn mx-2 mt-2 color-shadow-medium" id="emptyalert">
|
||||
<svg class="octicon" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 100-2 1 1 0 000 2z"
|
||||
fill-rule="evenodd"></path>
|
||||
</svg>
|
||||
Please choose a download location.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flash mx-2 mt-2 color-shadow-medium" hidden id="downloadingnotice">
|
||||
<svg class="octicon" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
@@ -189,7 +201,7 @@
|
||||
<div class="settings-surrounding" id="settings-surrounding">
|
||||
<div class="settings-content mx-auto" id="settings-content">
|
||||
<label class="version-info" id="version-info">UNKNOWN</label>
|
||||
<button class="opium-button" id="opium-btn">00pium</button>
|
||||
<button class="opium-button" id="opium-btn">aphex</button>
|
||||
<h2><b>Settings</b></h2>
|
||||
<hr>
|
||||
<h4><b>Appearance</b></h4>
|
||||
@@ -251,11 +263,9 @@
|
||||
<option disabled>Xfce Terminal (not installed)</option>
|
||||
<option disabled>Deepin Terminal (not installed)</option>
|
||||
<option disabled>Terminator (not installed)</option>
|
||||
<option disabled>Terminology (not installed)</option>
|
||||
<option disabled>Kitty (not installed)</option>
|
||||
<option disabled>LXTerminal (not installed)</option>
|
||||
<option disabled>Tilix (not installed)</option>
|
||||
<option disabled>cool-retro-term (not installed)</option>
|
||||
<option disabled>XTerm (not installed)</option>
|
||||
<option disabled>CMD (not installed)</option>
|
||||
<option disabled>macOS Terminal (not installed)</option>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import $ from "jquery";
|
||||
import {invoke} from "@tauri-apps/api/core";
|
||||
import {open as openDialog} from "@tauri-apps/plugin-dialog";
|
||||
import {open as openShell} from "@tauri-apps/plugin-shell";
|
||||
import {open as openShell} from "tauri-plugin-shellx-api";
|
||||
import {listen} from "@tauri-apps/api/event";
|
||||
|
||||
function setLoader(state: boolean) {
|
||||
@@ -77,7 +77,7 @@ $(async () => {
|
||||
$("#pickpath").on("click", async () => {
|
||||
// Open a dialog
|
||||
downloadDirectory = await openDialog({
|
||||
title: "Choose where to download the game. You can specify the directory later.",
|
||||
title: "Choose where to save the game download.",
|
||||
multiple: false,
|
||||
directory: true,
|
||||
canCreateDirectories: true
|
||||
@@ -92,6 +92,9 @@ $(async () => {
|
||||
|
||||
$("#checkpath").prop("ariaDisabled", false);
|
||||
$("#checkpath").prop("disabled", false);
|
||||
$("#downloadbtn").prop("ariaDisabled", false);
|
||||
$("#nopathwarning").prop("hidden", true);
|
||||
|
||||
|
||||
console.log(downloadDirectory);
|
||||
});
|
||||
@@ -113,9 +116,15 @@ $(async () => {
|
||||
// Loop through invalid fields. If there are any, make those "errored" and block the download button.
|
||||
for (const id of invalidFields()) {
|
||||
document.getElementById(id)?.parentElement?.classList.toggle("errored", true);
|
||||
$("#emptywarning").prop("hidden", false);
|
||||
$("#downloadbtn").prop("ariaDisabled", true);
|
||||
}
|
||||
$("#emptywarning").prop("hidden", false);
|
||||
$("#downloadbtn").prop("ariaDisabled", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (downloadDirectory == null) {
|
||||
$("#nopathwarning").prop("hidden", false);
|
||||
$("#downloadbtn").prop("ariaDisabled", true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -126,10 +135,9 @@ $(async () => {
|
||||
const terminalChoice = (document.getElementById("terminal-dropdown") as HTMLSelectElement).selectedIndex;
|
||||
const directoryNameChoice = $("#folder-name-custom-input").val();
|
||||
|
||||
|
||||
// Output path w/ directories chosen is: {downloadDirectory}/{directoryNameChoice}
|
||||
const vectumOptions = {
|
||||
terminal: terminalChoice == 15 ? null : terminalChoice,
|
||||
terminal: terminalChoice == 13 ? null : terminalChoice,
|
||||
output_directory: downloadDirectory || null, // if not specified let backend choose a path.
|
||||
directory_name: directoryNameChoice || null,
|
||||
};
|
||||
@@ -168,7 +176,7 @@ $(async () => {
|
||||
});
|
||||
|
||||
$("#opium-btn").on("click", () => {
|
||||
openShell("https://00pium.net");
|
||||
openShell("https://aphex.cc");
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import {message} from "@tauri-apps/plugin-dialog";
|
||||
import {invoke} from "@tauri-apps/api/core";
|
||||
import {open} from "@tauri-apps/plugin-shell";
|
||||
import {fixPathEnv, open} from "tauri-plugin-shellx-api";
|
||||
import $ from "jquery";
|
||||
|
||||
|
||||
$(async () => {
|
||||
/* Fix stupid PATH shit */
|
||||
fixPathEnv();
|
||||
|
||||
/* eslint-disable indent */
|
||||
switch (await invoke("internet_connection")) {
|
||||
case false: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {getVersion} from "@tauri-apps/api/app";
|
||||
import {open} from "@tauri-apps/plugin-shell";
|
||||
import {open} from "tauri-plugin-shellx-api";
|
||||
import $ from "jquery";
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user