Database fixes for new MongoDB driver.
Ylian Saint-Hilaire committed
May 20, 2019 at 18:03 UTC
084a6bab5789beaab16c4c30fc5010b84e91843e
7 files changed
+56
-50
db.js
+13
-8
@@ -198,14 +198,19 @@ module.exports.CreateDB = function (parent, func) {
198
if (typeof obj.parent.args.dbexpire.statsevents == 'number') { expireServerStatsSeconds = obj.parent.args.dbexpire.statsevents; }
199
}
200
201
- if (obj.parent.args.xmongodb) {
201
+ if (obj.parent.args.mongodb) {
202
// Use MongoDB
203
obj.databaseType = 3;
204
- require('mongodb').MongoClient.connect(obj.parent.args.xmongodb, { useNewUrlParser: true }, function (err, client) {
204
+ require('mongodb').MongoClient.connect(obj.parent.args.mongodb, { useNewUrlParser: true }, function (err, client) {
205
if (err != null) { console.log("Unable to connect to database: " + err); process.exit(); return; }
206
-
206
Datastore = client;
208
- const dbname = (obj.parent.args.mongodbname) ? (obj.parent.args.mongodbname) : 'meshcentral';
207
+
208
+ // Get the database name and setup the database client
209
+ var dbNamefromUrl = null;
210
+ try { dbNamefromUrl = require('url').parse(obj.parent.args.mongodb).path.split('/')[1]; } catch (ex) { }
211
+ var dbname = 'meshcentral';
212
+ if (dbNamefromUrl) { dbname = dbNamefromUrl; }
213
+ if (obj.parent.args.mongodbname) { dbname = obj.parent.args.mongodbname; }
214
const dbcollectionname = (obj.parent.args.mongodbcol) ? (obj.parent.args.mongodbcol) : 'meshcentral';
215
const db = client.db(dbname);
216
@@ -311,11 +316,11 @@ module.exports.CreateDB = function (parent, func) {
316
317
setupFunctions(func); // Completed setup of MongoDB
318
});
314
- } else if (obj.parent.args.mongodb) {
315
- // Use MongoJS
319
+ } else if (obj.parent.args.xmongodb) {
320
+ // Use MongoJS, this is the old system.
321
obj.databaseType = 2;
322
Datastore = require('mongojs');
318
- var db = Datastore(obj.parent.args.mongodb);
323
+ var db = Datastore(obj.parent.args.xmongodb);
324
var dbcollection = 'meshcentral';
325
if (obj.parent.args.mongodbcol) { dbcollection = obj.parent.args.mongodbcol; }
326
@@ -504,7 +509,7 @@ module.exports.CreateDB = function (parent, func) {
509
obj.RemoveAll = function (func) { obj.file.deleteMany({}, { multi: true }, func); };
510
obj.RemoveAllOfType = function (type, func) { obj.file.deleteMany({ type: type }, { multi: true }, func); };
511
obj.InsertMany = function (data, func) { obj.file.insertMany(data, func); };
507
- obj.RemoveMeshDocuments = function (id) { obj.file.deleteMany({ meshid: id }, { multi: true }); obj.file.remove({ _id: 'nt' + id }); };
512
+ obj.RemoveMeshDocuments = function (id) { obj.file.deleteMany({ meshid: id }, { multi: true }); obj.file.deleteOne({ _id: 'nt' + id }); };
513
obj.MakeSiteAdmin = function (username, domain) { obj.Get('user/' + domain + '/' + username, function (err, docs) { if (docs.length == 1) { docs[0].siteadmin = 0xFFFFFFFF; obj.Set(docs[0]); } }); };
514
obj.DeleteDomain = function (domain, func) { obj.file.deleteMany({ domain: domain }, { multi: true }, func); };
515
obj.SetUser = function (user) { var u = Clone(user); if (u.subscriptions) { delete u.subscriptions; } obj.Set(u); };
meshagent.js
+9
-9
@@ -600,7 +600,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
600
var device;
601
602
// See if this node exists in the database
603
- if (nodes.length == 0) {
603
+ if ((nodes == null) || (nodes.length == 0)) {
604
// This device does not exist, use the meshid given by the device
605
606
// See if this mesh exists, if it does not we may want to create it.
@@ -798,7 +798,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
798
// Fetch the the real agent nodeid
799
db.Get('da' + obj.dbNodeKey, function (err, nodes, self)
800
{
801
- if (nodes.length == 1)
801
+ if ((nodes != null) && (nodes.length == 1))
802
{
803
self.realNodeKey = nodes[0].raid;
804
@@ -834,7 +834,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
834
835
// Fetch the the diagnostic agent nodeid
836
db.Get('ra' + obj.dbNodeKey, function (err, nodes) {
837
- if (nodes.length == 1) {
837
+ if ((nodes != null) && (nodes.length == 1)) {
838
obj.diagnosticNodeKey = nodes[0].daid;
839
obj.send(JSON.stringify({ action: 'diagnostic', value: { command: 'query', value: obj.diagnosticNodeKey } }));
840
}
@@ -849,7 +849,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
849
if (domain.iplocation == true) {
850
// Check if we already have IP location information for this node
851
db.Get('iploc_' + obj.remoteaddr, function (err, iplocs) {
852
- if (iplocs.length == 1) {
852
+ if ((iplocs != null) && (iplocs.length == 1)) {
853
// We have a location in the database for this remote IP
854
const iploc = nodes[0], x = {};
855
if ((iploc != null) && (iploc.ip != null) && (iploc.loc != null)) {
@@ -876,7 +876,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
876
// If we need to ask for IP location, see if we have the quota to do it.
877
if (doIpLocation > 0) {
878
db.getValueOfTheDay('ipLocationRequestLimitor', 10, function (ipLocationLimitor) {
879
- if (ipLocationLimitor.value > 0) {
879
+ if ((ipLocationLimitor != null) && (ipLocationLimitor.value > 0)) {
880
ipLocationLimitor.value--;
881
db.Set(ipLocationLimitor);
882
obj.send(JSON.stringify({ action: 'iplocation' }));
@@ -1103,7 +1103,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1103
if (command.oldnodeid.length != 64) break;
1104
const oldNodeKey = 'node//' + command.oldnodeid.toLowerCase();
1105
db.Get(oldNodeKey, function (err, nodes) {
1106
- if (nodes.length != 1) return;
1106
+ if ((nodes != null) && (nodes.length != 1)) return;
1107
const node = nodes[0];
1108
if (node.meshid == obj.dbMeshKey) {
1109
// Update the device name & host
@@ -1212,7 +1212,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1212
1213
// Get the node and change it if needed
1214
db.Get(obj.dbNodeKey, function (err, nodes) { // TODO: THIS IS A BIG RACE CONDITION HERE, WE NEED TO FIX THAT. If this call is made twice at the same time on the same device, data will be missed.
1215
- if (nodes.length != 1) return;
1215
+ if ((nodes == null) || (nodes.length != 1)) return;
1216
const device = nodes[0];
1217
if (device.agent) {
1218
var changes = [], change = 0, log = 0;
@@ -1280,7 +1280,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1280
1281
// Get the node and change it if needed
1282
db.Get(obj.dbNodeKey, function (err, nodes) {
1283
- if (nodes.length != 1) { return; }
1283
+ if ((nodes == null) || (nodes.length != 1)) { return; }
1284
const device = nodes[0];
1285
if (device.agent) {
1286
var changes = [], change = 0;
@@ -1318,7 +1318,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1318
if (tag.length == 0) { tag = null; }
1319
// Get the node and change it if needed
1320
db.Get(obj.dbNodeKey, function (err, nodes) {
1321
- if (nodes.length != 1) return;
1321
+ if ((nodes == null) || (nodes.length != 1)) return;
1322
const device = nodes[0];
1323
if (device.agent) {
1324
if (device.agent.tag != tag) {
meshcentral.js
+2
-2
@@ -1745,8 +1745,8 @@ function mainStart() {
1745
if (require('os').platform() == 'win32') { modules.push('node-windows'); if (sspi == true) { modules.push('node-sspi'); } } // Add Windows modules
1746
if (ldap == true) { modules.push('ldapauth-fork'); }
1747
if (config.letsencrypt != null) { modules.push('greenlock'); modules.push('le-store-certbot'); modules.push('le-challenge-fs'); modules.push('le-acme-core'); } // Add Greenlock Modules
1748
- if (config.settings.mongodb != null) { modules.push('mongojs'); } // Add MongoJS
1749
- else if (config.settings.xmongodb != null) { modules.push('mongodb'); } // Add MongoDB
1748
+ if (config.settings.mongodb != null) { modules.push('mongodb'); } // Add MongoDB, official driver.
1749
+ else if (config.settings.xmongodb != null) { modules.push('mongojs'); } // Add MongoJS, old driver.
1750
if (config.smtp != null) { modules.push('nodemailer'); } // Add SMTP support
1751
1752
// Get the current node version
meshuser.js
+22
-21
@@ -369,6 +369,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
369
370
// Request a list of all nodes
371
db.GetAllTypeNoTypeFieldMeshFiltered(links, domain.id, 'node', command.id, function (err, docs) {
372
+ if (docs == null) { docs = []; }
373
var r = {};
374
for (i in docs) {
375
// Remove any connectivity and power state information, that should not be in the database anyway.
@@ -415,7 +416,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
416
// The result is a compacted array: [ startPowerState, startTimeUTC, powerState ] + many[ deltaTime, powerState ]
417
if (common.validateString(command.nodeid, 0, 128) == false) return;
418
db.getPowerTimeline(command.nodeid, function (err, docs) {
418
- if (err == null && docs.length > 0) {
419
+ if ((err == null) && (docs != null) && (docs.length > 0)) {
420
var timeline = [], time = null, previousPower;
421
for (i in docs) {
422
var doc = docs[i];
@@ -826,7 +827,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
827
if (parent.users[req.session.userid].email != command.email) {
828
// Check if this email is already validated on a different account
829
db.GetUserWithVerifiedEmail(domain.id, command.email, function (err, docs) {
829
- if (docs.length > 0) {
830
+ if ((docs != null) && (docs.length > 0)) {
831
// Notify the duplicate email error
832
try { ws.send(JSON.stringify({ action: 'msg', type: 'notify', title: 'Account Settings', tag: 'ServerNotify', value: 'Failed to change email address, another account already using: <b>' + EscapeHtml(command.email) + '</b>.' })); } catch (ex) { }
833
} else {
@@ -1677,7 +1678,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1678
1679
// Get the device
1680
db.Get(nodeid, function (err, nodes) {
1680
- if (nodes.length != 1) return;
1681
+ if ((nodes == null) || (nodes.length != 1)) return;
1682
var node = nodes[0];
1683
1684
// Get the mesh for this device
@@ -1695,7 +1696,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1696
db.RemoveAllNodeEvents(node._id); // Remove all events for this node
1697
db.removeAllPowerEventsForNode(node._id); // Remove all power events for this node
1698
db.Get('ra' + obj.dbNodeKey, function (err, nodes) {
1698
- if (nodes.length == 1) { db.Remove('da' + nodes[0].daid); } // Remove diagnostic agent to real agent link
1699
+ if ((nodes != null) && (nodes.length == 1)) { db.Remove('da' + nodes[0].daid); } // Remove diagnostic agent to real agent link
1700
db.Remove('ra' + node._id); // Remove real agent to diagnostic agent link
1701
});
1702
@@ -1727,7 +1728,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1728
if ((nodeid.split('/').length == 3) && (nodeid.split('/')[1] == domain.id)) { // Validate the domain, operation only valid for current domain
1729
// Get the device
1730
db.Get(nodeid, function (err, nodes) {
1730
- if (nodes.length != 1) return;
1731
+ if ((nodes == null) || (nodes.length != 1)) return;
1732
var node = nodes[0];
1733
1734
// Get the mesh for this device
@@ -1739,7 +1740,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1740
1741
// Get the device interface information
1742
db.Get('if' + node._id, function (err, nodeifs) {
1742
- if (nodeifs.length == 1) {
1743
+ if ((nodeifs != null) && (nodeifs.length == 1)) {
1744
var nodeif = nodeifs[0];
1745
var macs = [];
1746
for (var i in nodeif.netif) { if (nodeif.netif[i].mac) { macs.push(nodeif.netif[i].mac); } }
@@ -1783,7 +1784,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1784
if ((nodeid.split('/').length == 3) && (nodeid.split('/')[1] == domain.id)) { // Validate the domain, operation only valid for current domain
1785
// Get the device
1786
db.Get(nodeid, function (err, nodes) {
1786
- if (nodes.length != 1) return;
1787
+ if ((nodes == null) || (nodes.length != 1)) return;
1788
var node = nodes[0];
1789
1790
// Get the mesh for this device
@@ -1821,7 +1822,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1822
if ((nodeid.split('/').length == 3) && (nodeid.split('/')[1] == domain.id)) { // Validate the domain, operation only valid for current domain
1823
// Get the device
1824
db.Get(nodeid, function (err, nodes) {
1824
- if (nodes.length != 1) return;
1825
+ if ((nodes == null) || (nodes.length != 1)) return;
1826
var node = nodes[0];
1827
1828
// Get the mesh for this device
@@ -1852,7 +1853,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1853
1854
// Get the device
1855
db.Get(command.nodeid, function (err, nodes) {
1855
- if (nodes.length != 1) { try { ws.send(JSON.stringify({ action: 'getnetworkinfo', nodeid: command.nodeid, netif: null })); } catch (ex) { } return; }
1856
+ if ((nodes == null) || (nodes.length != 1)) { try { ws.send(JSON.stringify({ action: 'getnetworkinfo', nodeid: command.nodeid, netif: null })); } catch (ex) { } return; }
1857
var node = nodes[0];
1858
1859
// Get the mesh for this device
@@ -1863,7 +1864,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1864
1865
// Get network information about this node
1866
db.Get('if' + command.nodeid, function (err, netinfos) {
1866
- if (netinfos.length != 1) { try { ws.send(JSON.stringify({ action: 'getnetworkinfo', nodeid: command.nodeid, netif: null })); } catch (ex) { } return; }
1867
+ if ((netinfos == null) || (netinfos.length != 1)) { try { ws.send(JSON.stringify({ action: 'getnetworkinfo', nodeid: command.nodeid, netif: null })); } catch (ex) { } return; }
1868
var netinfo = netinfos[0];
1869
try { ws.send(JSON.stringify({ action: 'getnetworkinfo', nodeid: command.nodeid, updateTime: netinfo.updateTime, netif: netinfo.netif })); } catch (ex) { }
1870
});
@@ -1880,7 +1881,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1881
1882
// Change the device
1883
db.Get(command.nodeid, function (err, nodes) {
1883
- if (nodes.length != 1) return;
1884
+ if ((nodes == null) || (nodes.length != 1)) return;
1885
var node = nodes[0];
1886
1887
// Get the mesh for this device
@@ -1947,7 +1948,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1948
1949
// Change the device
1950
db.Get(command.nodeid, function (err, nodes) {
1950
- if (nodes.length != 1) return;
1951
+ if ((nodes == null) || (nodes.length != 1)) return;
1952
var node = nodes[0];
1953
1954
// Get the mesh for this device
@@ -1988,7 +1989,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
1989
1990
// Change the device
1991
db.Get(command.nodeid, function (err, nodes) {
1991
- if (nodes.length != 1) return;
1992
+ if ((nodes == null) || (nodes.length != 1)) return;
1993
var node = nodes[0];
1994
1995
// Get the mesh for this device
@@ -2015,7 +2016,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2016
// Check if this user has rights on this nodeid
2017
if (common.validateString(command.nodeid, 1, 1024) == false) break; // Check nodeid
2018
db.Get(command.nodeid, function (err, nodes) { // TODO: Make a NodeRights(user) method that also does not do a db call if agent is connected (???)
2018
- if (nodes.length == 1) {
2019
+ if ((nodes == null) || (nodes.length == 1)) {
2020
meshlinks = user.links[nodes[0].meshid];
2021
if ((meshlinks) && (meshlinks.rights) && ((meshlinks.rights & MESHRIGHT_REMOTECONTROL) != 0)) {
2022
// Add a user authentication cookie to a url
@@ -2062,7 +2063,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2063
if (idtype == 'node') {
2064
// Check if this user has rights on this id to set notes
2065
db.Get(command.id, function (err, nodes) { // TODO: Make a NodeRights(user) method that also does not do a db call if agent is connected (???)
2065
- if (nodes.length == 1) {
2066
+ if ((nodes == null) || (nodes.length == 1)) {
2067
meshlinks = user.links[nodes[0].meshid];
2068
if ((meshlinks) && (meshlinks.rights) && (meshlinks.rights & parent.MESHRIGHT_SETNOTES != 0)) {
2069
// Set the id's notes
@@ -2340,7 +2341,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2341
2342
// Get the device
2343
db.Get(command.nodeid, function (err, nodes) {
2343
- if (nodes.length != 1) return;
2344
+ if ((nodes == null) || (nodes.length != 1)) return;
2345
var node = nodes[0];
2346
2347
// Get the mesh for this device
@@ -2362,7 +2363,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2363
2364
// Get the device
2365
db.Get(command.nodeid, function (err, nodes) {
2365
- if (nodes.length != 1) return;
2366
+ if ((nodes == null) || (nodes.length != 1)) return;
2367
var node = nodes[0];
2368
2369
// Get the mesh for this device
@@ -2396,7 +2397,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2397
if (idtype == 'node') {
2398
// Get the device
2399
db.Get(command.id, function (err, nodes) {
2399
- if (nodes.length != 1) return;
2400
+ if ((nodes == null) || (nodes.length != 1)) return;
2401
var node = nodes[0];
2402
2403
// Get the mesh for this device
@@ -2408,7 +2409,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2409
// Get the notes about this node
2410
db.Get('nt' + command.id, function (err, notes) {
2411
try {
2411
- if (notes.length != 1) { ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: null })); return; }
2412
+ if ((notes == null) || (notes.length != 1)) { ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: null })); return; }
2413
ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: notes[0].value }));
2414
} catch (ex) { }
2415
});
@@ -2424,7 +2425,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2425
// Get the notes about this node
2426
db.Get('nt' + command.id, function (err, notes) {
2427
try {
2427
- if (notes.length != 1) { ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: null })); return; }
2428
+ if ((notes == null) || (notes.length != 1)) { ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: null })); return; }
2429
ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: notes[0].value }));
2430
} catch (ex) { }
2431
});
@@ -2433,7 +2434,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2434
// Get the notes about this node
2435
db.Get('nt' + command.id, function (err, notes) {
2436
try {
2436
- if (notes.length != 1) { ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: null })); return; }
2437
+ if ((notes == null) || (notes.length != 1)) { ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: null })); return; }
2438
ws.send(JSON.stringify({ action: 'getNotes', id: command.id, notes: notes[0].value }));
2439
} catch (ex) { }
2440
});
mpsserver.js
+6
-6
@@ -198,10 +198,10 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
198
199
// Fetch the mesh
200
obj.db.Get(socket.tag.meshid, function (err, meshes) {
201
- if (meshes.length === 1) {
201
+ if ((meshes != null) && (meshes.length === 1)) {
202
var mesh = meshes[0];
203
obj.db.Get(socket.tag.nodeid, function (err, nodes) {
204
- if (nodes.length !== 1) {
204
+ if ((nodes == null) || (nodes.length !== 1)) {
205
if (mesh.mtype == 1) {
206
// Node is not in the database, add it. Credentials will be empty until added by the user.
207
var device = { type: 'node', mtype: 1, _id: socket.tag.nodeid, meshid: socket.tag.meshid, name: socket.tag.name, host: null, domain: domainid, intelamt: { user: '', pass: '', tls: 0, state: 2 } };
@@ -318,7 +318,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
318
socket.tag.connectTime = Date.now();
319
320
obj.db.Get(socket.tag.nodeid, function (err, nodes) {
321
- if (nodes.length !== 1) {
321
+ if ((nodes == null) || (nodes.length !== 1)) {
322
// Node is not in the database, add it. Credentials will be empty until added by the user.
323
var device = { type: 'node', mtype: 1, _id: socket.tag.nodeid, meshid: socket.tag.meshid, name: socket.tag.name, host: null, domain: mesh.domain, intelamt: { user: '', pass: '', tls: 0, state: 2 } };
324
obj.db.Set(device);
@@ -343,7 +343,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
343
} else if (mesh.mtype == 2) { // If this is a agent mesh, search the mesh for this device UUID
344
// Intel AMT GUID (socket.tag.SystemId) will be used to search the node
345
obj.db.getAmtUuidNode(mesh._id, socket.tag.SystemId, function (err, nodes) { // TODO: May need to optimize this request with indexes
346
- if (nodes.length !== 1) {
346
+ if ((nodes == null) || (nodes.length !== 1)) {
347
// New CIRA connection for unknown node, disconnect.
348
unknownNodeCount++;
349
console.log('CIRA connection for unknown node. groupid: ' + mesh._id + ', uuid: ' + socket.tag.SystemId);
@@ -748,7 +748,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
748
749
// Change the device
750
obj.db.Get(socket.tag.nodeid, function (err, nodes) {
751
- if (nodes.length !== 1) return;
751
+ if ((nodes == null) || (nodes.length !== 1)) return;
752
var node = nodes[0];
753
754
// See if any changes need to be made
@@ -756,7 +756,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
756
757
// Get the mesh for this device
758
obj.db.Get(node.meshid, function (err, meshes) {
759
- if (meshes.length !== 1) return;
759
+ if ((meshes == null) || (meshes.length !== 1)) return;
760
var mesh = meshes[0];
761
762
// Ready the node change event
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.3.4-v",
3
+ "version": "0.3.4-y",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
views/default.handlebars
+3
-3
@@ -468,7 +468,7 @@
468
<div id="DeskToolsProcesses" style=""></div>
469
</div>
470
</div>
471
- <div id=p11DeskConsoleMsg style="display:none;cursor:pointer;position:absolute;right:30px;bottom:30px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick=p11clearConsoleMsg()></div>
471
+ <div id=p11DeskConsoleMsg style="display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick=p11clearConsoleMsg()></div>
472
</div>
473
<div id=deskarea4 class="areaFoot">
474
<div class="toright2">
@@ -557,7 +557,7 @@
557
</td>
558
</tr>
559
</table>
560
- <div id=p12TermConsoleMsg style="display:none;cursor:pointer;position:absolute;right:30px;bottom:45px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick=p12clearConsoleMsg()></div>
560
+ <div id=p12TermConsoleMsg style="display:none;cursor:pointer;position:absolute;left:30px;top:45px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick=p12clearConsoleMsg()></div>
561
</div>
562
</div>
563
<div id=p13 style="display:none">
@@ -611,7 +611,7 @@
611
</td>
612
</tr>
613
</table>
614
- <div id=p13FilesConsoleMsg style="display:none;cursor:pointer;position:absolute;right:30px;bottom:55px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick=p13clearConsoleMsg()></div>
614
+ <div id=p13FilesConsoleMsg style="display:none;cursor:pointer;position:absolute;left:30px;top:165px;color:yellow;background-color:rgba(0,0,0,0.6);padding:10px;border-radius:5px" onclick=p13clearConsoleMsg()></div>
615
<div id="p13filetable" style="">
616
<div id="p13bigok" style="display:none"><b>✓</b></div>
617
<div id="p13bigfail" style="display:none"><b>✗</b></div>