mirror of
https://github.com/mmvanheusden/SteamDepotDownloaderGUI.git
synced 2026-02-04 05:31:19 +01:00
Add anonymous login support and update Primer CSS
This commit is contained in:
@@ -35,7 +35,7 @@ function submitForm() {
|
||||
document.getElementById("emptywarning").hidden = true
|
||||
document.getElementById("dotnetwarning").hidden = false
|
||||
} else if (error === "emptyField") {
|
||||
console.error("Fill in all the fields")
|
||||
console.error("Fill in all required fields")
|
||||
document.getElementById("dotnetwarning").hidden = true
|
||||
document.getElementById("emptywarning").hidden = false
|
||||
}
|
||||
|
||||
@@ -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.4.6/dist/primer.css" rel="stylesheet"/>
|
||||
<link href="https://unpkg.com/@primer/css@20.4.7/dist/primer.css" rel="stylesheet"/>
|
||||
<title>SteamDepotDownloaderGUI</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -33,7 +33,7 @@
|
||||
<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 fill in all fields.
|
||||
</svg>Please fill in all required fields.
|
||||
</div>
|
||||
</div>
|
||||
<div class="f0-light text-center">Steam Depot Downloader</div>
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="form-group-header">
|
||||
<label for="username">Username</label>
|
||||
</div>
|
||||
<div aria-label="Enter your username here." class="form-group-body tooltipped tooltipped-n">
|
||||
<div aria-label="Enter your username here. (leave empty for anonymous login)" class="form-group-body tooltipped tooltipped-n">
|
||||
<input class="form-control input-block" id="username" type="text"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -52,7 +52,7 @@
|
||||
<div class="form-group-header">
|
||||
<label for="password">Password</label>
|
||||
</div>
|
||||
<div aria-label="Enter your password here." class="form-group-body tooltipped tooltipped-n">
|
||||
<div aria-label="Enter your password here. (leave empty for anonymous login)" class="form-group-body tooltipped tooltipped-n">
|
||||
<input class="form-control input-block" id="password" type="password"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
24
utils.js
24
utils.js
@@ -4,14 +4,12 @@
|
||||
*/
|
||||
function preDownloadCheck() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let username = document.forms["theform"]["username"].value
|
||||
let password = document.forms["theform"]["password"].value
|
||||
let appid = document.forms["theform"]["appid"].value
|
||||
let depotid = document.forms["theform"]["depotid"].value
|
||||
let manifestid = document.forms["theform"]["manifestid"].value
|
||||
|
||||
// Check if all fields are filled
|
||||
if (username === "" || password === "" || appid === "" || depotid === "" || manifestid === "") {
|
||||
if (appid === "" || depotid === "" || manifestid === "") {
|
||||
// Reject before even checking if dotnet is installed
|
||||
reject("emptyField")
|
||||
return
|
||||
@@ -152,23 +150,29 @@ const createCommand = () => {
|
||||
let manifestid = document.forms["theform"]["manifestid"].value
|
||||
let osdropdown = document.getElementById("osdropdown")
|
||||
|
||||
// if either the username or password fields are empty, anonymous login is used
|
||||
let anonymous = username === "" || password === ""
|
||||
|
||||
// build the username and password flags into one string, allowing for anonymous login
|
||||
let userpass = anonymous ? "" : `-username ${username} -password ${password}`
|
||||
|
||||
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 ${finalPath}/ -max-servers 50 -max-downloads 16";bash'`
|
||||
return `gnome-terminal -e 'bash -c "dotnet ./depotdownloader/DepotDownloader.dll ${userpass} -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 ${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`
|
||||
return `start cmd.exe /k dotnet ${platformpath()}${path.sep}depotdownloader${path.sep}DepotDownloader.dll -${userpass} -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 ${finalPath}/ -max-servers 50 -max-downloads 16'`
|
||||
return `osascript -c 'tell application "Terminal" to do script 'dotnet ./depotdownloader/DepotDownloader.dll ${userpass} -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 ${finalPath}/ -max-servers 50 -max-downloads 16"`
|
||||
return `konsole --hold -e "dotnet ./depotdownloader/DepotDownloader.dll ${userpass} -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 ${finalPath}/ -max-servers 50 -max-downloads 16"`
|
||||
return `xfce4-terminal -H -e "dotnet ./depotdownloader/DepotDownloader.dll ${userpass} -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 ${finalPath}/ -max-servers 50 -max-downloads 16";bash'`
|
||||
return `terminator -e 'bash -c "dotnet ./depotdownloader/DepotDownloader.dll ${userpass} -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 ${platformpath()}/depotdownloader/DepotDownloader.dll -username ${username} -password ${password} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath} -max-servers 50 -max-downloads 16`)
|
||||
console.log(`COPY-PASTE THE FOLLOWING INTO YOUR TERMINAL OF CHOICE:\n\ndotnet ${platformpath()}/depotdownloader/DepotDownloader.dll ${userpass} -app ${appid} -depot ${depotid} -manifest ${manifestid} -dir ${finalPath} -max-servers 50 -max-downloads 16`)
|
||||
return "echo hello"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user