20 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
15 changed files with 1039 additions and 857 deletions

View File

@@ -63,14 +63,9 @@ jobs:
args: ${{ matrix.args }}
includeUpdaterJson: false
- name: fix JSON (Windows)
if: matrix.platform == 'windows-latest'
id: truncate_paths_win
run: echo "paths=$(echo '${{ steps.build.outputs.artifactPaths }}' | jq -r '.[0]')" >> $GITHUB_OUTPUT
- name: fix JSON (Linux, MacOS)
- name: fix JSON
if: matrix.platform != 'windows-latest'
id: truncate_paths_x
id: truncate_paths
run: echo "paths=$(echo '${{ steps.build.outputs.artifactPaths }}' | sed 's/^..//' | sed 's/..$//')" >> $GITHUB_OUTPUT
- name: upload macos artifacts (M1)
@@ -78,25 +73,27 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: macos-m1-artifacts
path: ${{ steps.truncate_paths_x.outputs.paths }}
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_x.outputs.paths }}
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_x.outputs.paths }}
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: ${{ steps.truncate_paths_win.outputs.paths }}
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

@@ -11,21 +11,21 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "2.1.1",
"@tauri-apps/api": "2.2.0",
"@tauri-apps/plugin-dialog": "2.2.0",
"@tauri-apps/plugin-fs": "~2",
"@tauri-apps/plugin-shell": "2.2.0",
"jquery": "^3.7.1"
"jquery": "^3.7.1",
"tauri-plugin-shellx-api": "^2.0.14"
},
"devDependencies": {
"@eslint/js": "^9.16.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.16.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.0",
"vite": "^6.0.3"
"eslint": "^9.20.1",
"typescript": "^5.7.3",
"typescript-eslint": "^8.24.1",
"vite": "^6.1.1"
},
"packageManager": "pnpm@9.15.0"
"packageManager": "pnpm@10.4.1"
}

813
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

849
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,19 +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.2.0"
tauri = { version = "2.2.5", features = [] }
tauri-plugin-dialog = "2.2.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde = { version = "1.0.218", features = ["derive"] }
serde_json = "1.0.139"
derive-getters = "0.5.0"
reqwest = { version = "0.12.9",features = ["blocking"] }
zip = "2.2.1"
tauri-plugin-fs = "2"
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

@@ -7,10 +7,9 @@
],
"permissions": [
"core:default",
"shell:allow-open",
"dialog:default",
"shell:allow-execute",
"shell:allow-spawn",
"fs:default"
"shellx:allow-open",
"shellx:allow-execute",
"shellx:allow-spawn"
]
}

View File

@@ -1,13 +1,12 @@
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;
pub static DEPOTDOWNLOADER_VERSION: &str = "2.7.4";
pub static DEPOTDOWNLOADER_VERSION: &str = "3.0.0";
/**
@@ -30,6 +29,7 @@ pub async fn download_file(url: &str, filename: &Path) -> io::Result<()> {
println!("DEBUG: Not downloading. File already exists.");
return Err(io::Error::from(AlreadyExists));
}
// Create any missing directories.
if let Some(p) = filename.parent() {
if !p.exists() {
@@ -49,15 +49,14 @@ 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,
Some(path) => working_dir.join(path),
None => continue,
};
@@ -81,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,57 +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::path::BaseDirectory;
use tauri::App;
use tauri::{AppHandle, Emitter, Manager};
use tauri_plugin_fs::FsExt;
use tauri_plugin_fs::FilePath;
use tauri_plugin_shell::ShellExt;
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 these variables once.
if TERMINAL.get().is_none() {
TERMINAL
.set(terminal::get_installed_terminals(true, app.shell()).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();
// set working directory
std::env::set_current_dir(app.path().app_cache_dir().unwrap()).unwrap();
).unwrap();
}
#[tauri::command]
async fn start_download(steam_download: steam::SteamDownload, app: AppHandle) {
let default_terminal = TERMINAL.get().unwrap();
let working_dir = app.path().app_cache_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:");
@@ -62,45 +56,35 @@ async fn start_download(steam_download: steam::SteamDownload, app: AppHandle) {
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, shell, working_dir.clone()));
println!("\t- Working directory: {}", working_dir.clone() .display());
// println!("\t- Working directory2: {}", std::env::current_exe().unwrap().display());
// println!("\t- Working directory2: {}", app.path().app_cache_dir().unwrap().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, shell, working_dir).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.
#[tauri::command]
async fn download_depotdownloader(app: AppHandle) {
async fn download_depotdownloader() {
let url = get_depotdownloader_url();
// Where we store the DepotDownloader zip.
let zip_filename = format!("DepotDownloader-v{}-{}.zip", DEPOTDOWNLOADER_VERSION, env::consts::OS);
let depotdownloader_zip = Path::join(app.path().app_cache_dir().unwrap().as_path(), 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, depotdownloader_zip.display());
match depotdownloader::download_file(url.as_str(), depotdownloader_zip.as_path()).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.as_path()).unwrap();
depotdownloader::unzip(depotdownloader_zip.as_path(), &WORKING_DIR.get().unwrap()).unwrap();
println!("Succesfully extracted DepotDownloader zip.");
}
@@ -149,17 +133,12 @@ fn main() {
}
println!();
tauri::Builder::default()
.plugin(tauri_plugin_fs::init())
.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,15 +1,14 @@
use serde::Serialize;
use tauri_plugin_shell::process::Command;
use std::{env, fs};
use std::path::{Path, PathBuf};
use tauri::Wry;
use tauri_plugin_shell::Shell;
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,
@@ -126,7 +125,7 @@ impl Terminal {
| Terminal (macOS) | We create a bash script and run that using `open`. |
*/
pub fn create_command(&self, steam_download: &SteamDownload, shell: &Shell<Wry>, working_dir: PathBuf) -> 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 {
@@ -207,15 +206,13 @@ impl Terminal {
}
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{}",working_dir.as_path().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();
#[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
}
@@ -309,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

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

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) {
@@ -176,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";