mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-25 09:27:43 +00:00
get/set/clear registry functions
This commit is contained in:
parent
860f88daf5
commit
07c331051b
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ bin/
|
||||
dist/
|
||||
ext/
|
||||
temp/
|
||||
tools/
|
||||
resources/js/neutralino.js
|
||||
resources/bg/official
|
||||
|
||||
|
@ -103,6 +103,32 @@ async function openGrasscutterFolder() {
|
||||
openInExplorer(folder)
|
||||
}
|
||||
|
||||
async function getRegistryLoginDetails() {
|
||||
const results = await Neutralino.os.execCommand('.\\tools\\mtools.exe show')
|
||||
const out = results.stdErr
|
||||
|
||||
if (!out) return {}
|
||||
|
||||
const parsed = JSON.parse(out)
|
||||
|
||||
return parsed.data
|
||||
}
|
||||
|
||||
async function clearRegistryLoginDetails() {
|
||||
createCmdWindow(`.\\tools\\mtools.exe set -a "" -u "" -t "" -d ""`)
|
||||
}
|
||||
|
||||
async function setRegistryLoginDetails(tokenOrAccount, loginUid) {
|
||||
const accList = await getRegistryLoginDetails()
|
||||
const cur = accList.find(a => a.is_login)
|
||||
|
||||
// Required fields: uid, token, account, deviceId
|
||||
|
||||
const { token, deviceId } = cur
|
||||
|
||||
createCmdWindow(`.\\tools\\mtools.exe set -a ${tokenOrAccount} -u ${loginUid} -t ${token} -d ${deviceId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimize the window
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user