mirror of
https://github.com/mmvanheusden/SteamDepotDownloaderGUI.git
synced 2026-02-04 05:31:19 +01:00
feat: finalize steam deck support
This commit is contained in:
@@ -33,7 +33,7 @@ function submitForm() {
|
||||
document.getElementById("dotnetwarning").hidden = true
|
||||
document.getElementById("dotnetwarning2").hidden = true
|
||||
document.getElementById("emptywarning").hidden = true
|
||||
console.info("dotnet found in PATH")
|
||||
console.info("dotnet is installed and the form is filled in. 🙌")
|
||||
// create variables for the form values
|
||||
const username = document.getElementById("username").value
|
||||
const password = document.getElementById("password").value
|
||||
@@ -127,19 +127,19 @@ function openRelevantPage(target) {
|
||||
}
|
||||
break
|
||||
case "issues":
|
||||
console.debug("Opened GitHub issues page")
|
||||
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")
|
||||
console.debug("Opened SteamDB instant search page 🔍")
|
||||
void electron.shell.openExternal("https://steamdb.info/instantsearch/")
|
||||
break
|
||||
case "donate":
|
||||
console.debug("Opened donation page")
|
||||
console.debug("Opened donation page 💰")
|
||||
void electron.shell.openExternal("https://liberapay.com/barbapapa/")
|
||||
break
|
||||
case "instructions":
|
||||
console.debug("Opened instructions page")
|
||||
console.debug("Opened instructions page 📚")
|
||||
void electron.shell.openExternal("https://github.com/mmvanheusden/SteamDepotDownloaderGUI/#how-to-use")
|
||||
break
|
||||
default:
|
||||
@@ -164,6 +164,7 @@ function fillDefaultValues() {
|
||||
// [0]: Windows, [1]: macOS [2]: Linux [3]: manual
|
||||
if (process.platform.toString().includes("linux")) {
|
||||
document.getElementById("default-os").innerText = "Linux"
|
||||
document.getElementById("down-dotnet").ariaDisabled = "false"
|
||||
} else if (process.platform.toString().includes("win")) {
|
||||
document.getElementById("default-os").innerText = "Windows"
|
||||
} else if (process.platform.toString().includes("darwin")) {
|
||||
@@ -259,7 +260,7 @@ ipcRenderer.on("ready", async () => {
|
||||
}
|
||||
|
||||
await findDotnet().then(() => {
|
||||
console.log("dotnet found in PATH!")
|
||||
console.log("dotnet found in PATH/local directory!")
|
||||
document.getElementById("dotnet-found").innerText = "Yes"
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
@@ -288,19 +289,22 @@ platformpath(): ${platformpath()}
|
||||
ready = false
|
||||
})
|
||||
|
||||
async function steamDeck() {
|
||||
async function downloadDotnetAuto() {
|
||||
document.getElementById("down-dotnet").ariaDisabled = "true"
|
||||
await download("https://download.visualstudio.microsoft.com/download/pr/5226a5fa-8c0b-474f-b79a-8984ad7c5beb/3113ccbf789c9fd29972835f0f334b7a/dotnet-sdk-8.0.100-linux-x64.tar.gz")
|
||||
console.log("finish download")
|
||||
console.log("Finished downloading dotnet tarball")
|
||||
await runCommand(`mkdir -p ${platformpath()}/dotnet`)
|
||||
await runCommand(`tar -xvf ${platformpath()}/dotnet-sdk-8.0.100-linux-x64.tar.gz -C dotnet`)
|
||||
console.log("extracted")
|
||||
await runCommand("./dotnet/dotnet --info")
|
||||
ipcRenderer.send("ready")
|
||||
console.log("Finished extracting dotnet tarball")
|
||||
await findDotnet() // to make it use the newly downloaded dotnet
|
||||
document.getElementById("down-dotnet").ariaDisabled = "false" // so the button can be pressed again for whatever reason
|
||||
}
|
||||
|
||||
// Add event listeners to the buttons
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
document.getElementById("down-dotnet").addEventListener("click", steamDeck)
|
||||
document.getElementById("down-dotnet").addEventListener("click", () => {
|
||||
if (document.getElementById("down-dotnet").ariaDisabled === "false") downloadDotnetAuto()
|
||||
})
|
||||
document.getElementById("dotnetalertbtn").addEventListener("click", () => openRelevantPage("dotnet"))
|
||||
document.getElementById("smbtn1").addEventListener("click", () => openRelevantPage("issues"))
|
||||
document.getElementById("smbtn2").addEventListener("click", () => openRelevantPage("steamdb"))
|
||||
|
||||
12
index.html
12
index.html
@@ -264,15 +264,17 @@
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<h4><b>Experimental settings</b></h4>
|
||||
<div class="form-group">
|
||||
<div class="form-group-header">
|
||||
<label for="os-dropdown">Steam Deck</label>
|
||||
<label for="os-dropdown">Automatically download dotnet binary</label><br>Linux only. Works for Steam Deck<br>system-wide dotnet has priority over local dotnet.
|
||||
</div>
|
||||
Found: <span class="Counter"><code id="dotnet-found" >none</code></span>
|
||||
<div class="form-group-body">
|
||||
<div class="btn" type="button" id="down-dotnet">
|
||||
Download .NET
|
||||
|
||||
<div class="form-group-body" >
|
||||
<div aria-disabled="true" class="btn" type="button" id="down-dotnet">
|
||||
Auto Download .NET
|
||||
</div>
|
||||
Found: <span class="Counter"><code id="dotnet-found" >none</code></span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
17
style.css
17
style.css
@@ -14,7 +14,7 @@
|
||||
|
||||
/* The grey part */
|
||||
.settings-surrounding {
|
||||
display: none;
|
||||
display: block;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
@@ -31,19 +31,28 @@
|
||||
overflow: auto;
|
||||
/*noinspection CssUnresolvedCustomProperty*/
|
||||
background-color: var(--bgColor-default, var(--color-canvas-default));
|
||||
margin: 5%;
|
||||
padding: 25px;
|
||||
margin-top: 5px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 13px 20px 13px;
|
||||
border: 1px solid #b4dede;
|
||||
width: 90vw; /* 90vw -> 90% */
|
||||
height: 90vh; /* 90vh -> 90% */
|
||||
height: 97vh; /* 90vh -> 90% */
|
||||
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 0 6px 20px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
/* Hide the stupid scrollbar */
|
||||
.settings-content::-webkit-scrollbar {
|
||||
display: none;
|
||||
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin-top: 6px;
|
||||
margin-bottom: 6px;
|
||||
border: 0;
|
||||
height: 1px;
|
||||
background: #0d1117 linear-gradient(to right, #0d1117, #ccc, #0d1117);
|
||||
|
||||
11
utils.js
11
utils.js
@@ -1,5 +1,3 @@
|
||||
const {exec} = require("child_process");
|
||||
const {existsSync} = require("fs");
|
||||
var defaultTerminal = ""
|
||||
let dotnetPath = ""
|
||||
|
||||
@@ -14,6 +12,7 @@ let dotnetPath = ""
|
||||
* `noDotnet` -> `dotnet` has not been found in the path.
|
||||
*/
|
||||
function preDownloadCheck() {
|
||||
const {exec} = require("child_process")
|
||||
return new Promise((resolve, reject) => {
|
||||
// Check if all fields are filled
|
||||
const formInputs = document.forms["theform"]
|
||||
@@ -368,6 +367,8 @@ const forceTerminals = async () => {
|
||||
|
||||
// checks if dotnet is found in either system path, or for linux in local path. (for steam deck)
|
||||
function findDotnet() {
|
||||
const {exec} = require("child_process")
|
||||
const {existsSync} = require("fs")
|
||||
return new Promise((resolve, reject) => {
|
||||
let command
|
||||
if (process.platform.toString().includes("win")) {
|
||||
@@ -375,18 +376,18 @@ function findDotnet() {
|
||||
} else {
|
||||
command = "dotnet"
|
||||
}
|
||||
console.log(`Command is ${command}`)
|
||||
exec(`${command} --version`, (error) => {
|
||||
console.log(error)
|
||||
if (error !== null) { // if there was an error
|
||||
console.log("Error, trying local dotnet installation")
|
||||
if (process.platform.toString().includes("linux")) console.log("Dotnet not found in system, trying to detect local dotnet installation..")
|
||||
if (process.platform.toString().includes("linux") && existsSync(`${platformpath()}/dotnet/dotnet`)) {
|
||||
console.log("Linux, trying local dotnet installation")
|
||||
exec(`${platformpath()}/dotnet/dotnet --version`, (error) => {
|
||||
if (error !== null) { // if there was an error
|
||||
console.log("no dotnet found at all 🙀")
|
||||
reject("noDotnet")
|
||||
} else { // if there was no error
|
||||
dotnetPath = `${platformpath()}/dotnet/dotnet`
|
||||
console.log("Local dotnet installation found. path: " + dotnetPath)
|
||||
resolve(true)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user