From 25e7e5aa55207ddcc485b013fdec42ef209dbcf3 Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Sun, 13 Sep 2020 03:05:08 -0400 Subject: [PATCH] Tweaks to Java discovery. Add AdoptOpenJDK directory to the file scan. Remove TLS reject unauthorized flag. Use async/await for the fs scan function. Code was originally wrote using fs and not fs-extra. --- app/assets/js/assetexec.js | 2 -- app/assets/js/assetguard.js | 59 ++++++++++++------------------------- 2 files changed, 19 insertions(+), 42 deletions(-) diff --git a/app/assets/js/assetexec.js b/app/assets/js/assetexec.js index 9d39449d53..4d8061a34d 100644 --- a/app/assets/js/assetexec.js +++ b/app/assets/js/assetexec.js @@ -6,8 +6,6 @@ if(target == null){ } let tracker = new target(...(process.argv.splice(3))) -process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' - //const tracker = new AssetGuard(process.argv[2], process.argv[3]) console.log('AssetExec Started') diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 0e8320cf62..d04c4b5740 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -709,51 +709,26 @@ class JavaGuard extends EventEmitter { * @returns {Promise.>} A promise which resolves to a set of the discovered * root JVM folders. */ - static _scanFileSystem(scanDir){ - return new Promise((resolve, reject) => { - - fs.exists(scanDir, (e) => { - - let res = new Set() - - if(e){ - fs.readdir(scanDir, (err, files) => { - if(err){ - resolve(res) - console.log(err) - } else { - let pathsDone = 0 + static async _scanFileSystem(scanDir){ - for(let i=0; i { + const files = await fs.readdir(scanDir) + for(let i=0; i