mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-16 04:45:34 +00:00
download script for gc
This commit is contained in:
parent
e152cc3e3c
commit
7c2f36109d
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ bin/
|
|||||||
dist/
|
dist/
|
||||||
ext/
|
ext/
|
||||||
temp/
|
temp/
|
||||||
|
gc*/
|
||||||
resources/js/neutralino.js
|
resources/js/neutralino.js
|
||||||
resources/bg/official
|
resources/bg/official
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<script src="js/hoverEvt.js"></script>
|
<script src="js/hoverEvt.js"></script>
|
||||||
<script src="js/helpers.js"></script>
|
<script src="js/helpers.js"></script>
|
||||||
<script src="js/index.js"></script>
|
<script src="js/index.js"></script>
|
||||||
|
<script src="js/gcdownloader.js"></script>
|
||||||
<script src="js/onLoad.js"></script>
|
<script src="js/onLoad.js"></script>
|
||||||
<script src="js/options.js"></script>
|
<script src="js/options.js"></script>
|
||||||
<script src="js/login.js"></script>
|
<script src="js/login.js"></script>
|
||||||
|
24
resources/js/gcdownloader.js
Normal file
24
resources/js/gcdownloader.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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))
|
||||||
|
}
|
@ -12,6 +12,7 @@
|
|||||||
serverLaunchPanel: false,
|
serverLaunchPanel: false,
|
||||||
language: 'en',
|
language: 'en',
|
||||||
useHttps: true,
|
useHttps: true,
|
||||||
|
grasscutterBranch: '',
|
||||||
}
|
}
|
||||||
const cfgStr = await Neutralino.storage.getData('config').catch(e => {
|
const cfgStr = await Neutralino.storage.getData('config').catch(e => {
|
||||||
// The data isn't set, so this is our first time opening
|
// The data isn't set, so this is our first time opening
|
||||||
|
34
scripts/gcdownload.cmd
Normal file
34
scripts/gcdownload.cmd
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set KEYSTORE_URL=%1
|
||||||
|
set ARTIFACT_URL=%2
|
||||||
|
set BRANCH=%3
|
||||||
|
set FOLDER_NAME=".\gc-%BRANCH%"
|
||||||
|
|
||||||
|
if not exist %FOLDER_NAME% mkdir %FOLDER_NAME%
|
||||||
|
if not exist ".\temp" mkdir ".\temp"
|
||||||
|
|
||||||
|
echo Downloading Grasscutter prebuilt jar...
|
||||||
|
|
||||||
|
:: Download the jar
|
||||||
|
powershell Invoke-WebRequest -Uri %KEYSTORE_URL% -OutFile "./temp/gcjar.zip"
|
||||||
|
|
||||||
|
echo Extracting...
|
||||||
|
|
||||||
|
powershell Expand-Archive -Path "./temp/gcjar.zip" -DestinationPath %FOLDER_NAME% -Force
|
||||||
|
|
||||||
|
:: Download the keystore.p12 file
|
||||||
|
|
||||||
|
echo Downloading keystore.p12...
|
||||||
|
|
||||||
|
powershell Invoke-WebRequest -Uri %ARTIFACT_URL% -OutFile "./%FOLDER_NAME%/keystore.p12"
|
||||||
|
|
||||||
|
:: Remove temp stuff
|
||||||
|
del /s /q "./temp"
|
||||||
|
|
||||||
|
echo Done, latest Grasscutter %BRANCH% now downloaded in %FOLDER_NAME%
|
||||||
|
|
||||||
|
pause
|
||||||
|
|
||||||
|
exit /b
|
||||||
|
|
Loading…
Reference in New Issue
Block a user