33 Commits

Author SHA1 Message Date
Maarten van Heusden
c2d47a9e52 feat: use shellx tauri-shell plugin fork to bypass permission enforcement 2025-02-21 14:12:29 +01:00
Maarten van Heusden
9bee63241e chore(deps): update to DepotDownloader v3.0.0 2025-02-21 14:09:34 +01:00
Maarten van Heusden
91ff8060ca fix: sync pnpm-lock.json with package.json 2025-02-21 13:17:53 +01:00
Maarten van Heusden
a96771685c chore(deps): upgrade dependencies 2025-02-21 12:47:46 +01:00
dependabot[bot]
e61c0ebf34 chore(deps-dev): bump vite in the npm_and_yarn group across 1 directory (#271)
Bumps the npm_and_yarn group with 1 update in the / directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite).


Updates `vite` from 6.0.11 to 6.1.1
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/create-vite@6.1.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-21 12:38:03 +01:00
dependabot[bot]
56843f07d2 chore(deps): bump the npm-deps group across 1 directory with 7 updates (#268)
Bumps the npm-deps group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@tauri-apps/api](https://github.com/tauri-apps/tauri) | `2.1.1` | `2.2.0` |
| [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) | `9.17.0` | `9.19.0` |
| [@tauri-apps/cli](https://github.com/tauri-apps/tauri) | `2.1.0` | `2.2.7` |
| [eslint](https://github.com/eslint/eslint) | `9.17.0` | `9.19.0` |
| [typescript](https://github.com/microsoft/TypeScript) | `5.7.2` | `5.7.3` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.18.1` | `8.22.0` |
| [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `6.0.5` | `6.0.11` |



Updates `@tauri-apps/api` from 2.1.1 to 2.2.0
- [Release notes](https://github.com/tauri-apps/tauri/releases)
- [Commits](https://github.com/tauri-apps/tauri/compare/@tauri-apps/api-v2.1.1...@tauri-apps/api-v2.2.0)

Updates `@eslint/js` from 9.17.0 to 9.19.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.19.0/packages/js)

Updates `@tauri-apps/cli` from 2.1.0 to 2.2.7
- [Release notes](https://github.com/tauri-apps/tauri/releases)
- [Commits](https://github.com/tauri-apps/tauri/compare/@tauri-apps/cli-v2.1.0...@tauri-apps/cli-v2.2.7)

Updates `eslint` from 9.17.0 to 9.19.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.17.0...v9.19.0)

Updates `typescript` from 5.7.2 to 5.7.3
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.2...v5.7.3)

Updates `typescript-eslint` from 8.18.1 to 8.22.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.22.0/packages/typescript-eslint)

Updates `vite` from 6.0.5 to 6.0.11
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.0.11/packages/vite)

---
updated-dependencies:
- dependency-name: "@tauri-apps/api"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-deps
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-deps
- dependency-name: "@tauri-apps/cli"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-deps
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-deps
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-deps
- dependency-name: typescript-eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-deps
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-21 12:36:19 +01:00
dependabot[bot]
e681aceb29 chore(deps): bump the cargo-deps group across 1 directory with 3 updates (#269)
Bumps the cargo-deps group with 3 updates in the /src-tauri directory: [serde](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json) and [reqwest](https://github.com/seanmonstar/reqwest).


Updates `serde` from 1.0.216 to 1.0.217
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.216...v1.0.217)

Updates `serde_json` from 1.0.134 to 1.0.138
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.134...v1.0.138)

Updates `reqwest` from 0.12.9 to 0.12.12
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.9...v0.12.12)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-21 12:36:07 +01:00
dependabot[bot]
7891ed19e1 chore(deps): bump openssl in /src-tauri in the cargo group (#270)
Bumps the cargo group in /src-tauri with 1 update: [openssl](https://github.com/sfackler/rust-openssl).


Updates `openssl` from 0.10.68 to 0.10.70
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.68...openssl-v0.10.70)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-21 12:35:53 +01:00
Maarten van Heusden
95c2d8efc4 chore(deps): update dependencies & remove unused dependency 2024-12-22 20:50:34 +01:00
Maarten van Heusden
3155054531 fix: macOS 2024-12-22 20:42:52 +01:00
Maarten van Heusden
04e8498edb refactor: disable username field spellcheck 2024-12-22 20:00:12 +01:00
Maarten van Heusden
69ca8dbf97 feat: use localappdata dir instead of temp dir 2024-12-22 19:23:59 +01:00
Maarten van Heusden
b479f50005 perf: further improve Cargo performance 2024-12-19 21:01:04 +01:00
Maarten van Heusden
2cb21bea17 fix: windows workflow glob typo 2024-12-12 22:08:19 +01:00
Maarten van Heusden
63c421ae10 fix: windows action workflow 2024-12-12 21:49:27 +01:00
Maarten van Heusden
9fadf3a627 chore: update branding 2024-12-12 20:40:37 +01:00
dependabot[bot]
ba7c17513a chore(deps): bump rustls in /src-tauri in the cargo group (#254)
Bumps the cargo group in /src-tauri with 1 update: [rustls](https://github.com/rustls/rustls).


Updates `rustls` from 0.23.16 to 0.23.18
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.23.16...v/0.23.18)

---
updated-dependencies:
- dependency-name: rustls
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-12 21:34:12 +01:00
dependabot[bot]
8d227944cf chore(deps): bump nanoid from 3.3.7 to 3.3.8 in the npm_and_yarn group (#258)
Bumps the npm_and_yarn group with 1 update: [nanoid](https://github.com/ai/nanoid).


Updates `nanoid` from 3.3.7 to 3.3.8
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-12 21:33:56 +01:00
dependabot[bot]
a13d689b8c chore(deps): bump @tauri-apps/plugin-fs (#259)
Bumps the npm-deps group with 1 update in the / directory: [@tauri-apps/plugin-fs](https://github.com/tauri-apps/plugins-workspace).


Updates `@tauri-apps/plugin-fs` from 2.0.2 to 2.2.0
- [Release notes](https://github.com/tauri-apps/plugins-workspace/releases)
- [Commits](https://github.com/tauri-apps/plugins-workspace/compare/fs-v2.0.2...os-v2.2.0)

---
updated-dependencies:
- dependency-name: "@tauri-apps/plugin-fs"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-12 21:33:31 +01:00
dependabot[bot]
5f0b9781c6 chore(deps): bump the cargo-deps group across 1 directory with 2 updates (#260)
Bumps the cargo-deps group with 2 updates in the /src-tauri directory: [serde](https://github.com/serde-rs/serde) and [serde_json](https://github.com/serde-rs/json).


Updates `serde` from 1.0.215 to 1.0.216
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.215...v1.0.216)

Updates `serde_json` from 1.0.132 to 1.0.133
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.132...v1.0.133)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-12 21:32:56 +01:00
Maarten van Heusden
02a36e997e fix(action): pnpm find version 2024-12-12 20:08:19 +01:00
Maarten van Heusden
9374b9d382 fix: action 2024-12-12 20:05:53 +01:00
Maarten van Heusden
6ed3e71536 chore: update dependencies 2024-12-12 19:48:53 +01:00
Maarten van Heusden
bbdf0955db fix: use temp dir 2024-11-17 20:59:48 +01:00
Maarten van Heusden
a8cd68fce6 fix: spawning, remove shit terminals 2024-11-17 13:31:13 +01:00
Maarten van Heusden
55a65a54dc fix: windows 2024-11-17 12:24:40 +01:00
Maarten van Heusden
90c1c10253 fix(workflow): seperate artifacts 2024-11-17 12:13:01 +01:00
Maarten van Heusden
377a0fcb98 fix(workflow): truncate path 2024-11-17 12:04:41 +01:00
Maarten van Heusden
3f70e4ef91 fix: artifact path 2024-11-17 09:40:34 +01:00
Maarten van Heusden
17434ecaad fix: workflow 2024-11-17 09:33:12 +01:00
Maarten
a2daed0739 chore: update pnpm setup action 2024-11-16 21:50:33 +01:00
Maarten
2406e0ddc8 fix: action 2024-11-16 21:44:58 +01:00
Maarten
5c6094c2f1 feat: tauri build action 2024-11-16 21:38:15 +01:00
16 changed files with 1345 additions and 1124 deletions

99
.github/workflows/build.yml vendored Normal file
View 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

View File

@@ -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>

View File

@@ -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

File diff suppressed because it is too large Load Diff

883
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -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.

View File

@@ -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"
]
}

View File

@@ -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))?;
}
}
}

View File

@@ -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");
}

View File

@@ -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.

View File

@@ -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)]
}
}
}
}

View File

@@ -1,6 +1,6 @@
{
"productName": "SteamDepotDownloaderGUI",
"version": "3.0.0",
"version": "3.0.1",
"identifier": "net.oopium.depotdownloader",
"build": {
"beforeDevCommand": "pnpm dev",

View File

@@ -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>

View File

@@ -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");
});

View File

@@ -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: {

View File

@@ -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";