mirror of
https://github.com/mmvanheusden/SteamDepotDownloaderGUI.git
synced 2026-02-05 06:01:17 +01:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0139b499e | ||
|
|
2d409f98f2 | ||
|
|
f62c5e03bb | ||
|
|
f96581e87a | ||
|
|
4fb43dac1a | ||
|
|
f3b33eb5af | ||
|
|
35b8c476db | ||
|
|
d7260d8976 | ||
|
|
a7ce59fcd4 | ||
|
|
cc781b33d2 | ||
|
|
54a5027f8a | ||
|
|
1053c7b114 | ||
|
|
510d80c58a | ||
|
|
894197e75e | ||
|
|
eca48e2495 | ||
|
|
2bd8dc7c41 | ||
|
|
b8eb915788 | ||
|
|
5c0fe6fc9a |
@@ -5,7 +5,7 @@
|
||||
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/mmvanheusden/SteamDepotDownloaderGUI/total?color=orange&label=downloads">
|
||||
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/mmvanheusden/SteamDepotDownloaderGUI?color=crimson">
|
||||
<img alt="Visitor Count" src="https://visitor-badge.glitch.me/badge?page_id=mmvanheusden.SteamDepotDownloaderGUI">
|
||||
<a href="https://www.codefactor.io/repository/github/mmvanheusden/steamdepotdownloadergui/overview/rewrite"><img src="https://www.codefactor.io/repository/github/mmvanheusden/steamdepotdownloadergui/badge/rewrite" alt="CodeFactor" /></a>
|
||||
<a href="https://www.codefactor.io/repository/github/mmvanheusden/steamdepotdownloadergui/overview/rewrite"><img src="https://www.codefactor.io/repository/github/mmvanheusden/steamdepotdownloadergui/badge/master" alt="CodeFactor" /></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<img alt="Screenshot" src="screenshot.png" />
|
||||
@@ -23,7 +23,7 @@ from [GitHub](https://github.com/mmvanheusden/SteamDepotDownloaderGUI/releases/l
|
||||
|
||||
Enter everything you normally would in the SteamDepotDownloader console.
|
||||
|
||||
There is a video tutorial available [here](https://www.youtube.com/watch?v=dQw4w9WgXcQ).
|
||||
There is a video tutorial available [here](https://www.youtube.com/watch?v=dQw4w9WgXcQ). (not done yet)
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -34,4 +34,4 @@ Pull requests are welcome. For major changes, please open an issue first to disc
|
||||
|
||||
Please make sure to keep code consistent and cross-platform compatible.
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
const {checkDotnet, download, createCommand, runCommand, removeDir, removeFile, unzip} = require("./utils")
|
||||
const {
|
||||
checkDotnet,
|
||||
download,
|
||||
createCommand,
|
||||
runCommand,
|
||||
removeDir,
|
||||
removeFile,
|
||||
unzip
|
||||
} = require("./utils")
|
||||
|
||||
function submitForm() {
|
||||
checkDotnet().then(async function (result) {
|
||||
@@ -6,6 +14,7 @@ function submitForm() {
|
||||
console.error("dotnet not found in PATH")
|
||||
document.getElementById("dotnetwarning").hidden = false
|
||||
} else {
|
||||
|
||||
console.info("dotnet found in PATH")
|
||||
|
||||
// Remove the old depotdownloader directory
|
||||
@@ -41,14 +50,26 @@ function submitDotnet() {
|
||||
}
|
||||
if (os.includes("darwin")) {
|
||||
console.debug("Opened .NET download page for" + os)
|
||||
//TODO: apple silicon(ARM64) URL
|
||||
//TODO: Apple Silicon(ARM64) URL
|
||||
void electron.shell.openExternal("https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.301-macos-x64-installer")
|
||||
}
|
||||
}
|
||||
|
||||
function openGitHubIssues() {
|
||||
const electron = require("electron")
|
||||
console.debug("Opened GitHub issues page")
|
||||
void electron.shell.openExternal("https://github.com/mmvanheusden/SteamDepotDownloaderGUI/issues/new")
|
||||
}
|
||||
|
||||
function openSteamDB() {
|
||||
const electron = require("electron")
|
||||
console.debug("Opened SteamDB instant search page")
|
||||
void electron.shell.openExternal("https://steamdb.info/instantsearch/")
|
||||
}
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
document.getElementById("alertbtn").addEventListener("click", submitDotnet)
|
||||
document.getElementById("downloadbtn").addEventListener("click", submitForm)
|
||||
})
|
||||
|
||||
document.getElementById("smbtn1").addEventListener("click", openGitHubIssues)
|
||||
document.getElementById("smbtn2").addEventListener("click", openSteamDB)
|
||||
})
|
||||
45
index.html
45
index.html
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="width=device-width, initial-scale=1" name="viewport"/>
|
||||
<link href="https://unpkg.com/@primer/css@20.2.4/dist/primer.css" rel="stylesheet"/>
|
||||
<link href="https://unpkg.com/@primer/css@20.4.1/dist/primer.css" rel="stylesheet"/>
|
||||
<title>SteamDepotDownloaderGUI</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="form-group-header">
|
||||
<label for="username">Username</label>
|
||||
</div>
|
||||
<div class="form-group-body">
|
||||
<div aria-label="Enter your username here." class="form-group-body tooltipped tooltipped-n">
|
||||
<input class="form-control input-block" id="username" type="text"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,7 +42,7 @@
|
||||
<div class="form-group-header">
|
||||
<label for="password">Password</label>
|
||||
</div>
|
||||
<div class="form-group-body">
|
||||
<div aria-label="Enter your password here." class="form-group-body tooltipped tooltipped-n">
|
||||
<input class="form-control input-block" id="password" type="password"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="form-group-header">
|
||||
<label for="appid">App ID</label>
|
||||
</div>
|
||||
<div class="form-group-body">
|
||||
<div aria-label="Enter the App ID here." class="form-group-body tooltipped tooltipped-n">
|
||||
<input class="form-control input-block" id="appid" type="number"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@
|
||||
<div class="form-group-header">
|
||||
<label for="depotid">Depot ID</label>
|
||||
</div>
|
||||
<div class="form-group-body">
|
||||
<div aria-label="Enter the Depot ID here." class="form-group-body tooltipped tooltipped-n">
|
||||
<input class="form-control input-block" id="depotid" type="number"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,17 +69,17 @@
|
||||
<div class="form-group-header">
|
||||
<label for="manifestid">Manifest ID</label>
|
||||
</div>
|
||||
<div class="form-group-body">
|
||||
<div aria-label="Enter the Manifest ID here." class="form-group-body tooltipped tooltipped-n">
|
||||
<input class="form-control input-block" id="manifestid" type="number"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mx-3 mt-1">
|
||||
<div class="form-group-header">
|
||||
<div class="form-group-header ">
|
||||
<label for="osdropdown">Operating system</label>
|
||||
</div>
|
||||
<div class="form-group-body">
|
||||
<select aria-label="Preference" class="form-select" id="osdropdown">
|
||||
<div aria-label="Select your OS/terminal here." class="form-group-body tooltipped tooltipped-n">
|
||||
<select aria-label="Preference" class="form-select width-full" id="osdropdown">
|
||||
<option disabled>Choose your OS</option>
|
||||
<option>Windows</option>
|
||||
<option disabled>macOS (NOT YET IMPLEMENTED)</option>
|
||||
@@ -94,8 +94,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="form-group mx-3">
|
||||
<button class="btn btn-block btn-primary" id="downloadbtn">Download</button>
|
||||
<div aria-label="Start the download process." class="form-group mt-3 ml-3 mr-3 tooltipped tooltipped-n">
|
||||
<button class="btn btn-block btn-primary" id="downloadbtn">
|
||||
<svg class="octicon" height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M7.47 10.78a.75.75 0 001.06 0l3.75-3.75a.75.75 0 00-1.06-1.06L8.75 8.44V1.75a.75.75 0 00-1.5 0v6.69L4.78 5.97a.75.75 0 00-1.06 1.06l3.75 3.75zM3.75 13a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5z"
|
||||
fill-rule="evenodd"></path>
|
||||
</svg>
|
||||
Download
|
||||
</button>
|
||||
</div>
|
||||
<div aria-label="Visit the GitHub issues website." class="btn btn-sm ml-3 tooltipped tooltipped-ne" id="smbtn1">
|
||||
<svg fill="#8B949E" height="16" style="display: inline-block; vertical-align: text-bottom;" 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 8zm9 3a1 1 0 11-2 0 1 1 0 012 0zM6.92 6.085c.081-.16.19-.299.34-.398.145-.097.371-.187.74-.187.28 0 .553.087.738.225A.613.613 0 019 6.25c0 .177-.04.264-.077.318a.956.956 0 01-.277.245c-.076.051-.158.1-.258.161l-.007.004a7.728 7.728 0 00-.313.195 2.416 2.416 0 00-.692.661.75.75 0 001.248.832.956.956 0 01.276-.245 6.3 6.3 0 01.26-.16l.006-.004c.093-.057.204-.123.313-.195.222-.149.487-.355.692-.662.214-.32.329-.702.329-1.15 0-.76-.36-1.348-.863-1.725A2.76 2.76 0 008 4c-.631 0-1.155.16-1.572.438-.413.276-.68.638-.849.977a.75.75 0 101.342.67z"
|
||||
fill-rule="evenodd"></path>
|
||||
</svg>
|
||||
Support
|
||||
</div>
|
||||
<div aria-label="Visit the SteamDB instant search website." class="btn btn-sm ml-1 tooltipped tooltipped-n"
|
||||
id="smbtn2">
|
||||
<svg aria-hidden="true" class="octicon" height="14" viewBox="0 0 128 128" width="14"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M63.9 0C30.5 0 3.1 11.9.1 27.1l35.6 6.7c2.9-.9 6.2-1.3 9.6-1.3l16.7-10c-.2-2.5 1.3-5.1 4.7-7.2 4.8-3.1 12.3-4.8 19.9-4.8 5.2-.1 10.5.7 15 2.2 11.2 3.8 13.7 11.1 5.7 16.3-5.1 3.3-13.3 5-21.4 4.8l-22 7.9c-.2 1.6-1.3 3.1-3.4 4.5-5.9 3.8-17.4 4.7-25.6 1.9-3.6-1.2-6-3-7-4.8L2.5 38.4c2.3 3.6 6 6.9 10.8 9.8C5 53 0 59 0 65.5c0 6.4 4.8 12.3 12.9 17.1C4.8 87.3 0 93.2 0 99.6 0 115.3 28.6 128 64 128c35.3 0 64-12.7 64-28.4 0-6.4-4.8-12.3-12.9-17 8.1-4.8 12.9-10.7 12.9-17.1 0-6.5-5-12.6-13.4-17.4 8.3-5.1 13.3-11.4 13.3-18.2 0-16.5-28.7-29.9-64-29.9zm22.8 14.2c-5.2.1-10.2 1.2-13.4 3.3-5.5 3.6-3.8 8.5 3.8 11.1 7.6 2.6 18.1 1.8 23.6-1.8s3.8-8.5-3.8-11c-3.1-1-6.7-1.5-10.2-1.5zm.3 1.7c7.4 0 13.3 2.8 13.3 6.2 0 3.4-5.9 6.2-13.3 6.2s-13.3-2.8-13.3-6.2c0-3.4 5.9-6.2 13.3-6.2zM45.3 34.4c-1.6.1-3.1.2-4.6.4l9.1 1.7a10.8 5 0 1 1-8.1 9.3l-8.9-1.7c1 .9 2.4 1.7 4.3 2.4 6.4 2.2 15.4 1.5 20-1.5s3.2-7.2-3.2-9.3c-2.6-.9-5.7-1.3-8.6-1.3zM109 51v9.3c0 11-20.2 19.9-45 19.9-24.9 0-45-8.9-45-19.9v-9.2c11.5 5.3 27.4 8.6 44.9 8.6 17.6 0 33.6-3.3 45.2-8.7zm0 34.6v8.8c0 11-20.2 19.9-45 19.9-24.9 0-45-8.9-45-19.9v-8.8c11.6 5.1 27.4 8.2 45 8.2s33.5-3.1 45-8.2z"
|
||||
fill-rule="evenodd"></path>
|
||||
</svg>
|
||||
SteamDB
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
4
main.js
4
main.js
@@ -5,8 +5,8 @@ const createWindow = () => {
|
||||
const mainWindow = new BrowserWindow({
|
||||
autoHideMenuBar: true,
|
||||
resizable: false,
|
||||
width: 425,
|
||||
height: 575,
|
||||
width: 430,
|
||||
height: 590,
|
||||
maximizable: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
|
||||
1298
package-lock.json
generated
1298
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,16 @@
|
||||
{
|
||||
"name": "steamdepotdownloadergui",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.4",
|
||||
"description": "DepotDownloader Electron frontend",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "electron .",
|
||||
"build": "electron-builder -c electron-builder.yml -wl -p never",
|
||||
"buildall": "electron-builder -c electron-builder.yml -mwl -p never"
|
||||
"buildall": "electron-builder -c electron-builder.yml -mwl -p never",
|
||||
"buildlinux": "electron-builder -c electron-builder.yml -l -p never",
|
||||
"buildwin": "electron-builder -c electron-builder.yml -w -p never",
|
||||
"buildmacos": "electron-builder -c electron-builder.yml -m -p never"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -29,8 +32,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/mmvanheusden/SteamDepotDownloaderGUI#readme",
|
||||
"devDependencies": {
|
||||
"electron": "^20.0.1",
|
||||
"electron-builder": "^23.1.0",
|
||||
"electron": "^19.0.6",
|
||||
"eslint": "^8.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 45 KiB |
130
utils.js
130
utils.js
@@ -32,19 +32,24 @@ function checkDotnet() {
|
||||
/**
|
||||
* Download a file from a url, saving it to the current directory (__dirname)
|
||||
* @param url The url to download from
|
||||
* @returns {Promise<unknown>} A promise that resolves when the download is finished
|
||||
* @returns {Promise<unknown>} A promise that resolves when the download is finished, or rejects if something fails
|
||||
*/
|
||||
function download(url) {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const {https} = require("follow-redirects")
|
||||
const fs = require("fs")
|
||||
const file = fs.createWriteStream(url.split("/").pop().toString())
|
||||
const path = require("path")
|
||||
const file = fs.createWriteStream(platformpath() + path.sep + url.split("/").pop())
|
||||
https.get(url, function (response) {
|
||||
response.pipe(file)
|
||||
file.on("finish", function () {
|
||||
file.close()
|
||||
resolve()
|
||||
})
|
||||
file.on("error", function (error) {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -52,16 +57,17 @@ function download(url) {
|
||||
/**
|
||||
* Removes a file from the current directory
|
||||
* @param file The filename to remove
|
||||
* @returns {Promise<unknown>} A promise that resolves when the file is removed (or fails)
|
||||
* @returns {Promise<unknown>} A promise that resolves when the file is removed, or rejects if something fails
|
||||
*/
|
||||
function removeFile(file) {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const fs = require("fs")
|
||||
fs.unlink(file, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
}
|
||||
resolve()
|
||||
const path = require("path")
|
||||
fs.unlink(platformpath() + path.sep + file, function (error) {
|
||||
if (error) {
|
||||
reject(error)
|
||||
console.error(error)
|
||||
} else resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -69,16 +75,17 @@ function removeFile(file) {
|
||||
/**
|
||||
* Removes a directory from the current directory
|
||||
* @param dir The directory to remove
|
||||
* @returns {Promise<unknown>} A promise that resolves when the directory is removed (or fails)
|
||||
* @returns {Promise<unknown>} A promise that resolves when the directory is removed, or rejects if something fails
|
||||
*/
|
||||
function removeDir(dir) {
|
||||
return new Promise((resolve) => {
|
||||
function removeDir(dir,) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const fs = require("fs")
|
||||
fs.rm(dir, {recursive: true, force: true}, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
}
|
||||
resolve()
|
||||
const path = require("path")
|
||||
fs.rm(platformpath() + path.sep + dir, {recursive: true, force: true}, function (error) {
|
||||
if (error) {
|
||||
reject(error)
|
||||
console.error(error)
|
||||
} else resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -87,45 +94,41 @@ function removeDir(dir) {
|
||||
* Unzip a file to the current directory
|
||||
* @param file The file to unzip, preferably a .zip file
|
||||
* @param target The target directory to unzip to
|
||||
* @returns {Promise<unknown>} A promise that resolves when the unzip is complete (or fails)
|
||||
* @returns {Promise<unknown>} A promise that resolves when the unzip is complete, or rejects if something fails
|
||||
*/
|
||||
function unzip(file, target) {
|
||||
const {exec} = require("child_process")
|
||||
return new Promise((resolve) => {
|
||||
const path = require("path")
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (process.platform.toString().includes("win")) {
|
||||
const command = "powershell.exe -Command Expand-Archive -Path " + __dirname + "/" + file + " -Destination " + target
|
||||
exec(command, function (error, stdout, stderr) {
|
||||
const command = "powershell.exe -Command Expand-Archive -Path " + platformpath() + path.sep + file + " -Destination " + platformpath() + path.sep + target
|
||||
exec(command, function (error) {
|
||||
if (error) {
|
||||
console.error("Unzipping failed with error: " + error)
|
||||
}
|
||||
console.debug(stdout)
|
||||
if (stderr) {
|
||||
console.error(stderr)
|
||||
}
|
||||
resolve()
|
||||
reject(error)
|
||||
console.error(error)
|
||||
} else resolve()
|
||||
})
|
||||
} else {
|
||||
const command = "unzip -o " + file + " -d ./" + target + "/"
|
||||
exec(command, function (error, stdout, stderr) {
|
||||
exec(command, function (error) {
|
||||
if (error) {
|
||||
console.error("Unzipping failed with error: " + error)
|
||||
}
|
||||
console.debug(stdout)
|
||||
if (stderr) {
|
||||
console.error(stderr)
|
||||
}
|
||||
resolve()
|
||||
reject(error)
|
||||
console.error(error)
|
||||
} else resolve()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a command based on the operating system/terminal being selected and the form values
|
||||
* @returns {string} The final command to run
|
||||
*/
|
||||
const createCommand = () => {
|
||||
// Import path so \ can be put in a string
|
||||
const path = require("path")
|
||||
|
||||
// The values inputted by the user in the form
|
||||
let username = document.forms["theform"]["username"].value
|
||||
let password = document.forms["theform"]["password"].value
|
||||
@@ -134,21 +137,23 @@ const createCommand = () => {
|
||||
let manifestid = document.forms["theform"]["manifestid"].value
|
||||
let osdropdown = document.getElementById("osdropdown")
|
||||
|
||||
const finalPath = platformpath() + path.sep + "games" + path.sep + appid
|
||||
|
||||
// The final command to run, returned by this function
|
||||
if (osdropdown.options[osdropdown.selectedIndex].text.includes("Gnome")) {
|
||||
return `gnome-terminal -e 'bash -c "dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ./games/${appid}/ -max-servers 50 -max-downloads 16";bash'`
|
||||
return `gnome-terminal -e 'bash -c "dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath}/ -max-servers 50 -max-downloads 16";bash'`
|
||||
} else if (osdropdown.options[osdropdown.selectedIndex].text.includes("Windows")) {
|
||||
return `start cmd.exe /k dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ./games/${appid}/ -max-servers 50 -max-downloads 16`
|
||||
return `start cmd.exe /k dotnet ${platformpath()}${path.sep}depotdownloader${path.sep}DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath}/ -max-servers 50 -max-downloads 16`
|
||||
} else if (osdropdown.options[osdropdown.selectedIndex].text.includes("macOS")) {
|
||||
return `osascript -c 'tell application "Terminal" to do script 'dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ./games/${appid}/ -max-servers 50 -max-downloads 16'`
|
||||
return `osascript -c 'tell application "Terminal" to do script 'dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath}/ -max-servers 50 -max-downloads 16'`
|
||||
} else if (osdropdown.options[osdropdown.selectedIndex].text.includes("Konsole")) {
|
||||
return `konsole --hold -e "dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ./games/${appid}/ -max-servers 50 -max-downloads 16"`
|
||||
return `konsole --hold -e "dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath}/ -max-servers 50 -max-downloads 16"`
|
||||
} else if (osdropdown.options[osdropdown.selectedIndex].text.includes("Xfce")) {
|
||||
return `xfce4-terminal -H -e "dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ./games/${appid}/ -max-servers 50 -max-downloads 16"`
|
||||
return `xfce4-terminal -H -e "dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath}/ -max-servers 50 -max-downloads 16"`
|
||||
} else if (osdropdown.options[osdropdown.selectedIndex].text.includes("Terminator")) {
|
||||
return `terminator -e 'bash -c "dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ./games/${appid}/ -max-servers 50 -max-downloads 16";bash'`
|
||||
return `terminator -e 'bash -c "dotnet ./depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath}/ -max-servers 50 -max-downloads 16";bash'`
|
||||
} else if (osdropdown.options[osdropdown.selectedIndex].text.includes("Print command")) {
|
||||
console.log(`COPY-PASTE THE FOLLOWING INTO YOUR TERMINAL OF CHOICE:\n\ndotnet ${__dirname}/depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ./games/${appid}/ -max-servers 50 -max-downloads 16`)
|
||||
console.log(`COPY-PASTE THE FOLLOWING INTO YOUR TERMINAL OF CHOICE:\n\ndotnet ${platformpath()}/depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath}/ -max-servers 50 -max-downloads 16`)
|
||||
return "echo hello"
|
||||
}
|
||||
}
|
||||
@@ -156,21 +161,36 @@ const createCommand = () => {
|
||||
/**
|
||||
* Runs a command in a separate process, printing errors and debugging info to the console
|
||||
* @param command The command to run
|
||||
* @returns {Promise<unknown>} A promise that resolves when the command is complete (or fails)
|
||||
* @returns {Promise<unknown>} A promise that resolves when the command is complete or rejects if something fails
|
||||
*/
|
||||
function runCommand(command) {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const {exec} = require("child_process")
|
||||
exec(command, function (error, stdout, stderr) {
|
||||
exec(command, function (error) {
|
||||
if (error) {
|
||||
console.debug("Command failed with error: " + error)
|
||||
}
|
||||
if (stderr) {
|
||||
console.error(stderr)
|
||||
}
|
||||
resolve()
|
||||
const msg = "Running command failed with error:\n" + error
|
||||
reject(msg)
|
||||
} else resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {checkDotnet, download, createCommand, runCommand, removeDir, removeFile, unzip}
|
||||
/**
|
||||
* Returns the path where the actual program is being run from, depending on the operating system.
|
||||
* Because __dirname is inconsistent across operating systems, this function is used to get the correct path
|
||||
* @returns {string} The absolute path
|
||||
*/
|
||||
const platformpath = () => {
|
||||
if ((__dirname.includes("AppData") || __dirname.includes("Temp")) && process.platform.toString().includes("win")) {
|
||||
// Windows portable exe
|
||||
return process.env.PORTABLE_EXECUTABLE_DIR
|
||||
} else if (__dirname.includes("/tmp/") && process.platform.toString().includes("linux")) {
|
||||
// Linux AppImage
|
||||
return process.cwd()
|
||||
} else {
|
||||
// .zip binary
|
||||
return __dirname
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {checkDotnet, download, createCommand, runCommand, removeDir, removeFile, unzip, platformpath}
|
||||
Reference in New Issue
Block a user