File tab now reconnects to the previous remote device path.

This commit is contained in:
Ylian Saint-Hilaire 2021-10-20 14:04:10 -07:00
parent d0d85feb45
commit 1f20d45b66
6 changed files with 92 additions and 378 deletions

View File

@ -1665,6 +1665,7 @@ function getDirectoryInfo(reqpath) {
var results = null, xpath = obj.path.join(reqpath, '*');
//if (process.platform == "win32") { xpath = xpath.split('/').join('\\'); }
try { results = fs.readdirSync(xpath); } catch (e) { }
if ((results != null) && (results.length == 0) && (fs.existsSync(reqpath) == false)) { results = null; }
if (results != null) {
for (var i = 0; i < results.length; ++i) {
if ((results[i] != '.') && (results[i] != '..')) {
@ -1680,6 +1681,8 @@ function getDirectoryInfo(reqpath) {
}
}
}
} else {
response.dir = null;
}
}
return response;
@ -2554,7 +2557,7 @@ function onTunnelData(data) {
// Send the folder content to the browser
var response = getDirectoryInfo(cmd.path);
if (cmd.reqid != undefined) { response.reqid = cmd.reqid; }
response.reqid = cmd.reqid;
this.write(Buffer.from(JSON.stringify(response)));
/*

343
audit.txt
View File

@ -1,343 +0,0 @@
# npm audit report
braces <=2.3.2
Severity: high
Regular Expression Denial of Service in braces - https://github.com/advisories/GHSA-g95f-p29q-9xw4
Depends on vulnerable versions of snapdragon
fix available via `npm audit fix`
node_modules/braces
node_modules/readdirp/node_modules/braces
micromatch 0.2.0 - 3.1.10
Depends on vulnerable versions of braces
Depends on vulnerable versions of parse-glob
Depends on vulnerable versions of snapdragon
node_modules/micromatch
node_modules/readdirp/node_modules/micromatch
anymatch 1.2.0 - 1.3.2
Depends on vulnerable versions of micromatch
node_modules/anymatch
chokidar 1.0.0-rc1 - 2.1.8
Depends on vulnerable versions of anymatch
Depends on vulnerable versions of glob-parent
node_modules/chokidar
babel-cli *
Depends on vulnerable versions of chokidar
node_modules/babel-cli
minify-js *
Depends on vulnerable versions of babel-cli
Depends on vulnerable versions of utils-igor
node_modules/dir_cache/node_modules/minify-js
node_modules/minify-js
node_modules/utils-igor/node_modules/minify-js
dir_cache >=1.0.2
Depends on vulnerable versions of minify-js
node_modules/dir_cache
utils-igor >=2.0.0
Depends on vulnerable versions of minify-js
node_modules/dir_cache/node_modules/minify-js/node_modules/utils-igor
node_modules/utils-igor
readdirp 2.2.0 - 2.2.1
Depends on vulnerable versions of micromatch
node_modules/readdirp
deep-extend <0.5.1
Severity: critical
Prototype Pollution in deep-extend - https://github.com/advisories/GHSA-hr2v-3952-633q
fix available via `npm audit fix`
node_modules/deep-extend
column-layout >=1.3.0
Depends on vulnerable versions of command-line-args
Depends on vulnerable versions of deep-extend
node_modules/column-layout
command-line-usage 2.0.0 - 3.0.8
Depends on vulnerable versions of column-layout
Depends on vulnerable versions of table-layout
node_modules/column-layout/node_modules/command-line-usage
node_modules/command-line-usage
node_modules/jsdoc-parse/node_modules/command-line-usage
cli-commands <=0.1.0
Depends on vulnerable versions of command-line-usage
node_modules/cli-commands
usage-stats 0.8.0 - 0.8.6
Depends on vulnerable versions of cli-commands
node_modules/usage-stats
app-usage-stats 0.4.0 - 0.5.0
Depends on vulnerable versions of usage-stats
node_modules/app-usage-stats
jsdoc2md-stats 1.0.6 - 2.0.0
Depends on vulnerable versions of app-usage-stats
node_modules/jsdoc2md-stats
command-line-args 2.1.0 - 2.1.6
Depends on vulnerable versions of command-line-usage
node_modules/column-layout/node_modules/command-line-args
node_modules/jsdoc-parse/node_modules/command-line-args
jsdoc-parse 0.2.5 - 2.0.0
Depends on vulnerable versions of command-line-args
Depends on vulnerable versions of file-set
Depends on vulnerable versions of jsdoc-api
node_modules/jsdoc-parse
jsdoc-to-markdown 0.6.0 - 0.6.4 || 1.3.1 - 2.0.0-alpha.23
Depends on vulnerable versions of command-line-usage
Depends on vulnerable versions of dmd
Depends on vulnerable versions of jsdoc-parse
node_modules/jsdoc-to-markdown
grunt-jsdoc-to-markdown 0.5.0 - 0.5.1 || 1.2.0 - 1.2.1
Depends on vulnerable versions of jsdoc-to-markdown
node_modules/grunt-jsdoc-to-markdown
command-line-tool 0.3.0 - 0.6.4
Depends on vulnerable versions of command-line-usage
node_modules/command-line-tool
dmd 0.3.23 - 2.0.1
Depends on vulnerable versions of command-line-tool
Depends on vulnerable versions of ddata
Depends on vulnerable versions of stream-handlebars
node_modules/dmd
table-layout <=0.4.0
Depends on vulnerable versions of deep-extend
node_modules/table-layout
glob-parent <5.1.2
Severity: high
Regular expression denial of service - https://github.com/advisories/GHSA-ww39-953v-wcq6
fix available via `npm audit fix`
node_modules/glob-parent
chokidar 1.0.0-rc1 - 2.1.8
Depends on vulnerable versions of anymatch
Depends on vulnerable versions of glob-parent
node_modules/chokidar
babel-cli *
Depends on vulnerable versions of chokidar
node_modules/babel-cli
minify-js *
Depends on vulnerable versions of babel-cli
Depends on vulnerable versions of utils-igor
node_modules/dir_cache/node_modules/minify-js
node_modules/minify-js
node_modules/utils-igor/node_modules/minify-js
dir_cache >=1.0.2
Depends on vulnerable versions of minify-js
node_modules/dir_cache
utils-igor >=2.0.0
Depends on vulnerable versions of minify-js
node_modules/dir_cache/node_modules/minify-js/node_modules/utils-igor
node_modules/utils-igor
glob-base *
Depends on vulnerable versions of glob-parent
node_modules/glob-base
parse-glob >=2.1.0
Depends on vulnerable versions of glob-base
node_modules/parse-glob
micromatch 0.2.0 - 3.1.10
Depends on vulnerable versions of braces
Depends on vulnerable versions of parse-glob
Depends on vulnerable versions of snapdragon
node_modules/micromatch
node_modules/readdirp/node_modules/micromatch
anymatch 1.2.0 - 1.3.2
Depends on vulnerable versions of micromatch
node_modules/anymatch
readdirp 2.2.0 - 2.2.1
Depends on vulnerable versions of micromatch
node_modules/readdirp
handlebars <=4.7.6
Severity: critical
Remote code execution in handlebars when compiling templates - https://github.com/advisories/GHSA-f2jv-r9rf-7988
Prototype Pollution in handlebars - https://github.com/advisories/GHSA-w457-6q6x-cgp9
Cross-Site Scripting in handlebars - https://github.com/advisories/GHSA-9prh-257w-9277
Depends on vulnerable versions of optimist
fix available via `npm audit fix`
node_modules/ddata/node_modules/handlebars
node_modules/stream-handlebars/node_modules/handlebars
ddata >=0.1.18
Depends on vulnerable versions of handlebars
node_modules/ddata
dmd 0.3.23 - 2.0.1
Depends on vulnerable versions of command-line-tool
Depends on vulnerable versions of ddata
Depends on vulnerable versions of stream-handlebars
node_modules/dmd
jsdoc-to-markdown 0.6.0 - 0.6.4 || 1.3.1 - 2.0.0-alpha.23
Depends on vulnerable versions of command-line-usage
Depends on vulnerable versions of dmd
Depends on vulnerable versions of jsdoc-parse
node_modules/jsdoc-to-markdown
grunt-jsdoc-to-markdown 0.5.0 - 0.5.1 || 1.2.0 - 1.2.1
Depends on vulnerable versions of jsdoc-to-markdown
node_modules/grunt-jsdoc-to-markdown
stream-handlebars <=0.1.6
Depends on vulnerable versions of handlebars
node_modules/stream-handlebars
minimatch <3.0.2
Severity: high
Regular Expression Denial of Service in minimatch - https://github.com/advisories/GHSA-hxm2-r34f-qmc5
fix available via `npm audit fix`
node_modules/jsdoc-parse/node_modules/minimatch
glob 3.0.0 - 5.0.14
Depends on vulnerable versions of minimatch
node_modules/jsdoc-parse/node_modules/glob
file-set <=0.2.8
Depends on vulnerable versions of glob
node_modules/jsdoc-parse/node_modules/file-set
jsdoc-parse 0.2.5 - 2.0.0
Depends on vulnerable versions of command-line-args
Depends on vulnerable versions of file-set
Depends on vulnerable versions of jsdoc-api
node_modules/jsdoc-parse
jsdoc-to-markdown 0.6.0 - 0.6.4 || 1.3.1 - 2.0.0-alpha.23
Depends on vulnerable versions of command-line-usage
Depends on vulnerable versions of dmd
Depends on vulnerable versions of jsdoc-parse
node_modules/jsdoc-to-markdown
grunt-jsdoc-to-markdown 0.5.0 - 0.5.1 || 1.2.0 - 1.2.1
Depends on vulnerable versions of jsdoc-to-markdown
node_modules/grunt-jsdoc-to-markdown
minimist <0.2.1
Severity: moderate
Prototype Pollution in minimist - https://github.com/advisories/GHSA-vh95-rmgr-6w4m
fix available via `npm audit fix`
node_modules/optimist/node_modules/minimist
optimist >=0.6.0
Depends on vulnerable versions of minimist
node_modules/optimist
handlebars <=4.7.6
Depends on vulnerable versions of optimist
node_modules/ddata/node_modules/handlebars
node_modules/stream-handlebars/node_modules/handlebars
ddata >=0.1.18
Depends on vulnerable versions of handlebars
node_modules/ddata
dmd 0.3.23 - 2.0.1
Depends on vulnerable versions of command-line-tool
Depends on vulnerable versions of ddata
Depends on vulnerable versions of stream-handlebars
node_modules/dmd
jsdoc-to-markdown 0.6.0 - 0.6.4 || 1.3.1 - 2.0.0-alpha.23
Depends on vulnerable versions of command-line-usage
Depends on vulnerable versions of dmd
Depends on vulnerable versions of jsdoc-parse
node_modules/jsdoc-to-markdown
grunt-jsdoc-to-markdown 0.5.0 - 0.5.1 || 1.2.0 - 1.2.1
Depends on vulnerable versions of jsdoc-to-markdown
node_modules/grunt-jsdoc-to-markdown
stream-handlebars <=0.1.6
Depends on vulnerable versions of handlebars
node_modules/stream-handlebars
node-windows >=0.1.5
Depends on vulnerable versions of optimist
node_modules/node-windows
nedb *
Severity: high
Prototype Pollution - https://github.com/advisories/GHSA-339j-hqgx-qrrx
Depends on vulnerable versions of binary-search-tree
Depends on vulnerable versions of underscore
No fix available
node_modules/nedb
set-value <4.0.1
Severity: high
Prototype Pollution in set-value - https://github.com/advisories/GHSA-4jqc-8m5r-9rpr
fix available via `npm audit fix`
node_modules/set-value
cache-base >=0.7.0
Depends on vulnerable versions of set-value
Depends on vulnerable versions of union-value
node_modules/cache-base
base >=0.7.0
Depends on vulnerable versions of cache-base
node_modules/base
snapdragon 0.6.0 - 0.10.1
Depends on vulnerable versions of base
node_modules/snapdragon
braces <=2.3.2
Depends on vulnerable versions of snapdragon
node_modules/braces
node_modules/readdirp/node_modules/braces
micromatch 0.2.0 - 3.1.10
Depends on vulnerable versions of braces
Depends on vulnerable versions of parse-glob
Depends on vulnerable versions of snapdragon
node_modules/micromatch
node_modules/readdirp/node_modules/micromatch
anymatch 1.2.0 - 1.3.2
Depends on vulnerable versions of micromatch
node_modules/anymatch
chokidar 1.0.0-rc1 - 2.1.8
Depends on vulnerable versions of anymatch
Depends on vulnerable versions of glob-parent
node_modules/chokidar
babel-cli *
Depends on vulnerable versions of chokidar
node_modules/babel-cli
minify-js *
Depends on vulnerable versions of babel-cli
Depends on vulnerable versions of utils-igor
node_modules/dir_cache/node_modules/minify-js
node_modules/minify-js
node_modules/utils-igor/node_modules/minify-js
dir_cache >=1.0.2
Depends on vulnerable versions of minify-js
node_modules/dir_cache
utils-igor >=2.0.0
Depends on vulnerable versions of minify-js
node_modules/dir_cache/node_modules/minify-js/node_modules/utils-igor
node_modules/utils-igor
readdirp 2.2.0 - 2.2.1
Depends on vulnerable versions of micromatch
node_modules/readdirp
expand-brackets 1.0.0 - 2.1.4
Depends on vulnerable versions of snapdragon
node_modules/readdirp/node_modules/expand-brackets
extglob 1.0.0 - 2.0.4
Depends on vulnerable versions of snapdragon
node_modules/readdirp/node_modules/extglob
nanomatch >=0.1.1
Depends on vulnerable versions of snapdragon
node_modules/nanomatch
union-value *
Depends on vulnerable versions of set-value
node_modules/union-value
underscore 1.3.2 - 1.12.0
Severity: high
Arbitrary Code Execution in underscore - https://github.com/advisories/GHSA-cf4h-3jhx-xvhq
No fix available
node_modules/jsdoc-75lb/node_modules/underscore
node_modules/underscore
binary-search-tree *
Depends on vulnerable versions of underscore
node_modules/binary-search-tree
nedb *
Depends on vulnerable versions of binary-search-tree
Depends on vulnerable versions of underscore
node_modules/nedb
jsdoc-75lb *
Depends on vulnerable versions of underscore
node_modules/jsdoc-75lb
jsdoc-api 0.1.0 - 3.0.0
Depends on vulnerable versions of jsdoc-75lb
node_modules/jsdoc-api
jsdoc-parse 0.2.5 - 2.0.0
Depends on vulnerable versions of command-line-args
Depends on vulnerable versions of file-set
Depends on vulnerable versions of jsdoc-api
node_modules/jsdoc-parse
jsdoc-to-markdown 0.6.0 - 0.6.4 || 1.3.1 - 2.0.0-alpha.23
Depends on vulnerable versions of command-line-usage
Depends on vulnerable versions of dmd
Depends on vulnerable versions of jsdoc-parse
node_modules/jsdoc-to-markdown
grunt-jsdoc-to-markdown 0.5.0 - 0.5.1 || 1.2.0 - 1.2.1
Depends on vulnerable versions of jsdoc-to-markdown
node_modules/grunt-jsdoc-to-markdown
48 vulnerabilities (1 low, 3 moderate, 27 high, 17 critical)
To address issues that do not require attention, run:
npm audit fix
Some issues need review, and may require choosing
a different dependency.

File diff suppressed because one or more lines are too long

View File

@ -542,7 +542,10 @@ function AmtStackCreateService(wsmanStack) {
if (eventSensorType == 6) return "Authentication failed " + (eventDataField[1] + (eventDataField[2] << 8)) + " times. The system may be under attack.";
if (eventSensorType == 30) return "No bootable media";
if (eventSensorType == 32) return "Operating system lockup or power interrupt";
if (eventSensorType == 35) return "System boot failure";
if (eventSensorType == 35) {
if (eventDataField[0] == 64) return "BIOS POST (Power On Self-Test) Watchdog Timeout."; // 64,2,252,84,89,0,0,0
return "System boot failure";
}
if (eventSensorType == 37) return "System firmware started (at least one CPU is properly executing).";
return "Unknown Sensor Type #" + eventSensorType;
}

View File

@ -4908,8 +4908,16 @@
if (uploadFile != null) { p13uploadFileTransferDone(); uploadFile = null; }
break;
case 3:
p13filetreelocation = [];
p13targetpath = '';
files.sendText({ action: 'ls', reqid: 1, path: '' });
if (files) {
var filepaths = [];
try { filepaths = JSON.parse(getstore('_devFilePaths', '[]')); } catch (ex) { }
for (var i = 0; i < filepaths.length; i++) { if (filepaths[i].n == currentNode._id) { p13targetpath = filepaths[i].p; } }
p13filetreelocation = p13targetpath.split('/');
files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
//if (files.serverIsRecording == true) { QV('filesRecordIcon', true); }
}
break;
default:
//console.log('Unknown onFilesStateChange state', state);
@ -4996,6 +5004,9 @@
if ((data.action != null) && (data.action.startsWith('upload'))) { p13gotUploadData(data); return; }
if (data.path != null) {
if (data.dir == null) {
if (p13targetpath != '') { p13folderup(); }
} else {
data.path = data.path.replace(/\//g, '\\');
if ((p13filetree != null) && (data.path == p13filetree.path)) {
// This is an update to the same folder
@ -5015,6 +5026,7 @@
}
}
}
}
function p13sshConnectEx(b) {
if (b == 0) {
@ -5089,14 +5101,32 @@
function p13folderset(x) {
p13targetpath = joinPaths(p13filetree.path, p13filetree.dir[x].n).split('\\').join('/');
if (files) {
p13storeCurrentPath(p13targetpath);
files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
}
}
function p13folderup(x) {
if (x == null) { p13filetreelocation.pop(); } else { while (p13filetreelocation.length > x) { p13filetreelocation.pop(); } }
p13targetpath = p13filetreelocation.join('/');
if (files) {
p13storeCurrentPath(p13targetpath);
files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
}
}
// Store the current path for a given node as browser state.
// This is so, when reconnecting to a device, you go back to the same path.
function p13storeCurrentPath(path) {
var filepaths = [], j = -1;
try { filepaths = JSON.parse(getstore('_devFilePaths', '[]')); } catch (ex) { }
for (var i = 0; i < filepaths.length; i++) { if (filepaths[i].n == currentNode._id) { j = i; } }
if (j >= 0) { filepaths.splice(j, 1); }
filepaths.push({ n: currentNode._id, p: path });
while (filepaths.length > 40) { filepaths.shift(); } // Keep only 40 devices worth of paths.
putstore('_devFilePaths', JSON.stringify(filepaths));
}
var p13sortorder;
function p13sort_filename(a, b) { if (a.ln > b.ln) return (1 * p13sortorder); if (a.ln < b.ln) return (-1 * p13sortorder); return 0; }

View File

@ -9480,9 +9480,14 @@
if (uploadFile != null) { p13uploadFileTransferDone(); uploadFile = null; }
break;
case 3:
p13filetreelocation = [];
p13targetpath = '';
if (files) {
files.sendText({ action: 'ls', reqid: 1, path: '' });
var filepaths = [];
try { filepaths = JSON.parse(getstore('_devFilePaths', '[]')); } catch (ex) {}
for (var i = 0; i < filepaths.length; i++) { if (filepaths[i].n == currentNode._id) { p13targetpath = filepaths[i].p; } }
p13filetreelocation = p13targetpath.split('/');
files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
if (files.serverIsRecording == true) { QV('filesRecordIcon', true); }
}
break;
@ -9606,6 +9611,9 @@
if (data.action == 'refresh') { p13folderup(9999); return; }
if (data.path != null) {
if (data.dir == null) {
if (p13targetpath != '') { p13folderup(); }
} else {
data.path = data.path.replace(/\//g, '\\');
if ((p13filetree != null) && (data.path == p13filetree.path)) {
// This is an update to the same folder
@ -9625,6 +9633,7 @@
}
}
}
}
function p13sshConnectEx(b) {
if (b == 0) {
@ -9717,16 +9726,28 @@
function p13folderset(x) {
p13targetpath = joinPaths(p13filetree.path, p13filetree.dir[x].n).split('\\').join('/');
files.sendText({ action: 'ls', reqid: 1, path: p13targetpath });
if (files) { p13storeCurrentPath(p13targetpath); files.sendText({ action: 'ls', reqid: 1, path: p13targetpath }); }
}
function p13folderup(x) {
if (x == null) { p13filetreelocation.pop(); } else { while (p13filetreelocation.length > x) { p13filetreelocation.pop(); } }
p13targetpath = p13filetreelocation.join('/');
if (files) { files.sendText({ action: 'ls', reqid: 1, path: p13targetpath }); }
if (files) { p13storeCurrentPath(p13targetpath); files.sendText({ action: 'ls', reqid: 1, path: p13targetpath }); }
return false;
}
// Store the current path for a given node as browser state.
// This is so, when reconnecting to a device, you go back to the same path.
function p13storeCurrentPath(path) {
var filepaths = [], j = -1;
try { filepaths = JSON.parse(getstore('_devFilePaths', '[]')); } catch (ex) {}
for (var i = 0; i < filepaths.length; i++) { if (filepaths[i].n == currentNode._id) { j = i; } }
if (j >= 0) { filepaths.splice(j, 1); }
filepaths.push({ n: currentNode._id, p: path });
while (filepaths.length > 40) { filepaths.shift(); } // Keep only 40 devices worth of paths.
putstore('_devFilePaths', JSON.stringify(filepaths));
}
function p13findfile() {
if (xxdialogMode) return;
var x = addHtmlValue("Filter", '<input id=d2findFilter style="width:230px" onkeyup=p13findfileValidate() onkeydown=p13findfileDown(event) placeholder="*.txt"></input>');