mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-16 04:45:34 +00:00
download data and key files
This commit is contained in:
parent
8f86d5c283
commit
f2f4179813
@ -8,15 +8,6 @@ async function downloadGC(branch) {
|
|||||||
// If we are pulling from a new branch, delete the old installation
|
// If we are pulling from a new branch, delete the old installation
|
||||||
if (config.grasscutterBranch !== branch) await clearGCInstallation()
|
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\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`)
|
|
||||||
|
|
||||||
// Set current installation in config
|
// Set current installation in config
|
||||||
config.grasscutterBranch = branch
|
config.grasscutterBranch = branch
|
||||||
|
|
||||||
@ -24,6 +15,44 @@ async function downloadGC(branch) {
|
|||||||
config.serverFolder = `${NL_CWD}/gc-${branch}/grasscutter.jar`
|
config.serverFolder = `${NL_CWD}/gc-${branch}/grasscutter.jar`
|
||||||
|
|
||||||
Neutralino.storage.setData('config', JSON.stringify(config))
|
Neutralino.storage.setData('config', JSON.stringify(config))
|
||||||
|
|
||||||
|
// 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`
|
||||||
|
|
||||||
|
// For data files
|
||||||
|
const dataFiles = await axios.get(`https://api.github.com/repos/Grasscutters/Grasscutter/contents/data?ref=${branch}`)
|
||||||
|
const dataList = dataFiles.data
|
||||||
|
.map(file => ({ path: file.path, filename: file.name }))
|
||||||
|
.map(o => ({ url: `https://raw.githubusercontent.com/Grasscutters/Grasscutter/${branch}/${o.path}`, filename: o.filename }))
|
||||||
|
|
||||||
|
// For key files
|
||||||
|
const keyFiles = await axios.get(`https://api.github.com/repos/Grasscutters/Grasscutter/contents/keys?ref=${branch}`)
|
||||||
|
const keyList = keyFiles.data
|
||||||
|
.map(file => ({ path: file.path, filename: file.name }))
|
||||||
|
.map(o => ({ url: `https://raw.githubusercontent.com/Grasscutters/Grasscutter/${branch}/${o.path}`, filename: o.filename }))
|
||||||
|
|
||||||
|
const serverFolderFixed = config.serverFolder.match(/.*\\|.*\//g, '')[0].replace(/\//g, '\\')
|
||||||
|
|
||||||
|
// Download data files
|
||||||
|
for (const o of dataList) {
|
||||||
|
const folder = 'data'
|
||||||
|
Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Download each file
|
||||||
|
for (const o of keyList) {
|
||||||
|
const folder = 'keys'
|
||||||
|
Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Run installer
|
||||||
|
createCmdWindow(`.\\scripts\\gc_download.cmd ${artiUrl} ${keystoreUrl} ${branch}`)
|
||||||
|
|
||||||
|
|
||||||
// Display folder after saving config
|
// Display folder after saving config
|
||||||
displayServerFolder()
|
displayServerFolder()
|
||||||
|
@ -98,7 +98,7 @@ async function openGameFolder() {
|
|||||||
|
|
||||||
async function openGrasscutterFolder() {
|
async function openGrasscutterFolder() {
|
||||||
const config = await getCfg()
|
const config = await getCfg()
|
||||||
const folder = config.serverFolder.match(/.*\\/g, '')[0]
|
const folder = config.serverFolder.match(/.*\\|.*\//g, '')[0]
|
||||||
|
|
||||||
openInExplorer(folder)
|
openInExplorer(folder)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user