GrassClipper/resources/js/gcdownloader.js

24 lines
867 B
JavaScript
Raw Normal View History

2022-05-02 02:09:10 +00:00
async function clearGCInstallation() {
Neutralino.os.execCommand(`del /s /q "./gc"`)
}
async function downloadGC(branch) {
const config = await getCfg()
// If we are pulling from a new branch, delete the old installation
if (config.grasscutterBranch !== branch) await clearGCInstallation()
// Keystore for branch (since they can differ)
const keystoreUrl = `https://github.com/Grasscutters/Grasscutter/raw/${branch}/keystore.p12`
// External service that allows un-authed artifact downloading
const artiUrl = `https://nightly.link/Grasscutters/Grasscutter/workflows/build/${branch}/Grasscutter.zip`
// Run installer
createCmdWindow(`.\\scripts\\gcdownload.cmd ${artiUrl} ${keystoreUrl} ${branch}`)
// Set current installation in config
config.grasscutterBranch = branch
Neutralino.storage.setData('config', JSON.stringify(config))
}