diff --git a/Hubot-Sans.woff2 b/Hubot-Sans.woff2 new file mode 100644 index 00000000..c8281213 Binary files /dev/null and b/Hubot-Sans.woff2 differ diff --git a/README.md b/README.md index 55e4f241..dfc66776 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ If you haven't already, install [.NET SDK 6.0](https://dotnet.microsoft.com/en-u From then, download the appropriate build from [here](https://github.com/mmvanheusden/SteamDepotDownloaderGUI/releases/latest). -> **Note** +> **Note:** > No support will be provided for binaries downloaded from unofficial mirrors like softpedia. @@ -51,10 +51,11 @@ Enter everything you normally would in the DepotDownloader console and select yo This software makes use of the following projects: - [**DepotDownloader**](https://github.com/SteamRE/DepotDownloader/) -- [Electron](http://electron.atom.io/) +- [Electron](https://www.electronjs.org/) - [Node.js](https://nodejs.org/) - [Primer CSS](https://primer.style/css/) - [follow-redirects](https://github.com/follow-redirects/follow-redirects) +- [Hubut Sans](https://github.com/github/hubot-sans) under [license](https://github.com/github/hubot-sans/blob/05d5ea150c20e6434485db8ffd2277ed18a9e911/LICENSE) ## Support diff --git a/contributing.md b/contributing.md index 4bd5e811..0699acb1 100644 --- a/contributing.md +++ b/contributing.md @@ -2,8 +2,8 @@ SteamDepotDownloaderGUI is a graphical user interface for DepotDownloader. -It is written in Node.js and uses the [electron](https://electronjs.org/) framework. -The CSS framework is [Primer](https://primer.style). +It is written in Node.js and uses the [Electron](https://electronjs.org/) framework. +The CSS framework being used is [Primer](https://primer.style), by GitHub. ## Setup development environment @@ -38,7 +38,7 @@ npm start npm run build ``` -* If you are using macOS, you may build using the following command: +* If you are using macOS, you can build using the following command: ```bash npm run buildall diff --git a/downloader.js b/downloader.js index bab59360..deeada96 100644 --- a/downloader.js +++ b/downloader.js @@ -1,6 +1,6 @@ // Uses a prebuild binary of https://github.com/SteamRE/DepotDownloader // License can be found at https://github.com/SteamRE/DepotDownloader/blob/master/LICENSE - +const { ipcRenderer, shell} = require("electron") const { preDownloadCheck, download, @@ -48,50 +48,55 @@ function submitForm() { }) } -function submitDotnet() { +// Combines all buttons that are supposed to open an external URL into one big function. +function openRelevantPage(target) { const electron = require("electron") const os = process.platform.toString() - document.getElementById("dotnetwarning").hidden = true - if (os.includes("win")) { - console.debug("Opened .NET download page for " + os.charAt(0).toUpperCase() + os.slice(1)) - void electron.shell.openExternal("https://aka.ms/dotnet/6.0/dotnet-sdk-win-x64.exe") - } - if (os.includes("linux")) { - console.debug("Opened .NET download page for " + os.charAt(0).toUpperCase() + os.slice(1)) - void electron.shell.openExternal("https://docs.microsoft.com/en-us/dotnet/core/install/linux") - } - if (os.includes("darwin")) { - console.debug("Opened .NET download page for" + os) - //TODO: Apple Silicon(ARM64) URL - void electron.shell.openExternal("https://aka.ms/dotnet/6.0/dotnet-sdk-osx-x64.pkg") + switch (target) { + // why are you not indenting nicely eslint? + /* eslint-disable indent */ + case "dotnet": + document.getElementById("dotnetwarning").hidden = true + if (os.includes("win")) { + console.debug("Opened .NET download page for " + os.charAt(0).toUpperCase() + os.slice(1)) + void electron.shell.openExternal("https://aka.ms/dotnet/6.0/dotnet-sdk-win-x64.exe") + } + if (os.includes("linux")) { + const electron = require("electron") + console.debug("Opened .NET download page for " + os.charAt(0).toUpperCase() + os.slice(1)) + void electron.shell.openExternal("https://docs.microsoft.com/en-us/dotnet/core/install/linux") + } + if (os.includes("darwin")) { + console.debug("Opened .NET download page for" + os) + //TODO: Apple Silicon(ARM64) URL + void electron.shell.openExternal("https://aka.ms/dotnet/6.0/dotnet-sdk-osx-x64.pkg") + } + break + case "issues": + console.debug("Opened GitHub issues page") + void electron.shell.openExternal("https://github.com/mmvanheusden/SteamDepotDownloaderGUI/issues/new") + break + case "steamdb": + console.debug("Opened SteamDB instant search page") + void electron.shell.openExternal("https://steamdb.info/instantsearch/") + break + case "donate": + console.debug("Opened donation page") + void electron.shell.openExternal("https://liberapay.com/barbapapa/") + break + default: + return } + /* eslint-enable indent */ } -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/") -} - -function openDonate() { - const electron = require("electron") - console.debug("Opened donation page") - void electron.shell.openExternal("https://liberapay.com/barbapapa/") -} - +// Opens the chosen location where the game will be downloaded to function checkPath() { - // Opens the chosen location where the game will be downloaded to shell.openPath(exportedFile) } +// If Linux is selected in the dropdown menu, enable the second dropdown so the user can choose their terminal emulator. function checkSelection() { - // If Linux is selected in the dropdown menu, enable the second dropdown so the user can choose their terminal emulator. /* [0] - Windows [1] - macOS @@ -100,26 +105,33 @@ function checkSelection() { */ let docu = document.getElementById("osdropdown") let docu2 = document.getElementById("osdropdown2") + // if the choice = 2, enable the terminal selection dropdown. docu2.disabled = docu.selectedIndex !== 2; docu2.selectedIndex = 0 } -/* Everything beyond this line runs when the page is loaded */ - -const { ipcRenderer, shell} = require("electron") +// This changes the dropdown selection, based on the platform being used. +ipcRenderer.on("update-value", (e, msg) => { + const osdropdown = document.getElementById("osdropdown") + if (msg === "linux") { + osdropdown.selectedIndex = 2 + } else if (msg === "win") { + osdropdown.selectedIndex = 0 + } else if (msg === "darwin") { + osdropdown.selectedIndex = 1 + } + checkSelection() // force check the selection so the terminal dropdown can be unhidden. +}) // Add event listeners to the buttons window.addEventListener("DOMContentLoaded", () => { - document.getElementById("dotnetalertbtn").addEventListener("click", submitDotnet) - document.getElementById("downloadbtn").addEventListener("click", submitForm) - document.getElementById("smbtn1").addEventListener("click", openGitHubIssues) - document.getElementById("smbtn2").addEventListener("click", openSteamDB) - document.getElementById("smbtn3").addEventListener("click", openDonate) - document.getElementById("smbtn3").addEventListener("click", openDonate) - document.getElementById("pickpath").addEventListener("click", () => { - ipcRenderer.send("selectpath") - }) + document.getElementById("dotnetalertbtn").addEventListener("click", () => openRelevantPage("dotnet")) + document.getElementById("smbtn1").addEventListener("click", () => openRelevantPage("issues")) + document.getElementById("smbtn2").addEventListener("click", () => openRelevantPage("steamdb")) + document.getElementById("smbtn3").addEventListener("click", () => openRelevantPage("donate")) + document.getElementById("pickpath").addEventListener("click", () => ipcRenderer.send("selectpath")) document.getElementById("checkpath").addEventListener("click", checkPath) - document.getElementById("osdropdown").addEventListener("change", checkSelection) + document.getElementById("osdropdown").addEventListener("input", checkSelection) + document.getElementById("downloadbtn").addEventListener("click", submitForm) }) ipcRenderer.on("file", (event, file) => { diff --git a/index.html b/index.html index b6884b17..b47572f7 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,7 @@ +