diff --git a/.gitignore b/.gitignore index 2ccb550..58e3c18 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ bin/ dist/ ext/ temp/ +tools/ resources/js/neutralino.js resources/bg/official diff --git a/resources/js/helpers.js b/resources/js/helpers.js index c8457d2..74b32f0 100644 --- a/resources/js/helpers.js +++ b/resources/js/helpers.js @@ -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 */