diff --git a/meshuser.js b/meshuser.js index aae33469..faa759eb 100644 --- a/meshuser.js +++ b/meshuser.js @@ -5910,7 +5910,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (type == 'csv') { try { // Create the CSV file - output = 'id,name,rname,host,icon,ip,osdesc,groupname,cpu,osbuild,biosDate,biosVendor,biosVersion,boardName,boardVendor,boardVersion,productUuid,agentOpenSSL,agentCommitDate,agentCommitHash,agentCompileTime,netIfCount,macs,addresses\r\n'; + output = 'id,name,rname,host,icon,ip,osdesc,groupname,av,update,firewall,cpu,osbuild,biosDate,biosVendor,biosVersion,boardName,boardVendor,boardVersion,productUuid,agentOpenSSL,agentCommitDate,agentCommitHash,agentCompileTime,netIfCount,macs,addresses\r\n'; for (var i = 0; i < results.length; i++) { const nodeinfo = results[i]; @@ -5918,8 +5918,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (nodeinfo.node != null) { const n = nodeinfo.node; output += csvClean(n._id) + ',' + csvClean(n.name) + ',' + csvClean(n.rname ? n.rname : '') + ',' + csvClean(n.host ? n.host : '') + ',' + (n.icon ? n.icon : 1) + ',' + (n.ip ? n.ip : '') + ',' + (n.osdesc ? csvClean(n.osdesc) : '') + ',' + csvClean(parent.meshes[n.meshid].name); + if (typeof n.wsc == 'object') { + output += ',' + csvClean(n.wsc.antiVirus ? n.wsc.antiVirus : '') + ',' + csvClean(n.wsc.autoUpdate ? n.wsc.autoUpdate : '') + ',' + csvClean(n.wsc.firewall ? n.wsc.firewall : '') + } else { + output += ',,,'; + } } else { - output += ',,,,,,,'; + output += ',,,,,,,,,,'; } // System infomation diff --git a/views/default.handlebars b/views/default.handlebars index 2687efba..d9dd7c03 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -5128,16 +5128,23 @@ setDialogMode(2, "Device Information Export", 1, null, x); } + function csvClean(v) { + if (v == null) return ''; + return v.split(',').join(''); + } + function p2downloadDeviceInfoCSV() { var chkNodeIds = getCheckedDevices(); if (Q('d2DevInfoDetailsCheck').checked) { meshserver.send({ action: 'getDeviceDetails', nodeids: chkNodeIds, type: 'csv' }); // With details } else { // Without details - var csv = "id, name, rname, host, icon, ip, osdesc, state, groupname, conn, pwr" + '\r\n', r = []; + var csv = "id, name, rname, host, icon, ip, osdesc, state, groupname, conn, pwr, av, update, firewall" + '\r\n', r = []; for (var i in chkNodeIds) { var n = getNodeFromId(chkNodeIds[i]); - csv += '"' + n._id.split(',').join('') + '","' + n.name.split(',').join('') + '","' + (n.rname?(n.rname.split(',').join('')):'') + '","' + (n.host?(n.host.split(',').join('')):'') + '","' + n.icon + '","' + (n.ip?n.ip:'') + '","' + (n.osdesc?(n.osdesc.split(',').join('')):'') + '","' + n.state + '","' + meshes[n.meshid].name.split(',').join('') + '","' + (n.conn?n.conn:'') + '","' + (n.pwr?n.pwr:'') + '"\r\n'; + csv += '"' + n._id.split(',').join('') + '","' + n.name.split(',').join('') + '","' + (n.rname?(n.rname.split(',').join('')):'') + '","' + (n.host?(n.host.split(',').join('')):'') + '","' + n.icon + '","' + (n.ip?n.ip:'') + '","' + (n.osdesc?(n.osdesc.split(',').join('')):'') + '","' + n.state + '","' + meshes[n.meshid].name.split(',').join('') + '","' + (n.conn?n.conn:'') + '","' + (n.pwr?n.pwr:'') + '"'; + if (typeof n.wsc == 'object') { csv += ',"' + csvClean(n.wsc.antiVirus) + '","' + csvClean(n.wsc.autoUpdate) + '","' + csvClean(n.wsc.firewall) + '"'; } else { csv += ',,,'; } + csv += '\r\n'; } saveAs(new Blob([csv], { type: 'application/octet-stream' }), "devicelist.csv"); }