From 5f81ced09f95f9850fa7b7037fc13fc00059b07b Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sat, 7 May 2022 20:08:55 -0700 Subject: [PATCH] do button stuff --- resources/index.html | 9 +++++++++ resources/js/gcdownloader.js | 17 ++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/resources/index.html b/resources/index.html index 44e7f19..0e0c52a 100644 --- a/resources/index.html +++ b/resources/index.html @@ -182,6 +182,15 @@ Downloads Grasscutter resources into the currently set Grasscutter folder. This should be done unless you plan on getting resources externally. +
+
+ Download Data Files + +
+ + Downloads Grasscutter resources into the currently set Grasscutter folder. This should be done unless you plan on getting resources externally. + +
diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index 9ac3a67..13231f6 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -3,7 +3,6 @@ async function setDownloadButtonsToLoading() { const devBtn = document.querySelector('#devInstall') stableBtn.innerText = localeObj.gcScriptRunning || 'Running...' - devBtn.innerText = localeObj.gcScriptRunning || 'Running...' // Set btns to disabled @@ -32,6 +31,10 @@ async function resetDownloadButtons() { async function downloadDataFiles(branch) { const config = await getCfg() + if (!branch) branch = config.grasscutterBranch || 'development' + + setDownloadButtonsToLoading() + // For data files const dataFiles = await axios.get(`https://api.github.com/repos/Grasscutters/Grasscutter/contents/data?ref=${branch}`) const dataList = dataFiles.data @@ -65,7 +68,10 @@ async function downloadDataFiles(branch) { const folder = 'keys' const e = await Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) console.log(e) - } + } + + // Fix buttons + resetDownloadButtons() } async function downloadGC(branch) { @@ -82,8 +88,6 @@ async function downloadGC(branch) { Neutralino.storage.setData('config', JSON.stringify(config)) - setDownloadButtonsToLoading() - // Download data files downloadDataFiles(branch) @@ -97,14 +101,9 @@ async function downloadGC(branch) { // Keystore for branch (since they can differ) const keystoreUrl = `https://github.com/Grasscutters/Grasscutter/raw/${branch}/keystore.p12` - - // Run installer createCmdWindow(`.\\scripts\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`) - // Fix buttons - resetDownloadButtons() - // Display folder after saving config displayServerFolder() enableServerButton()