From d0737562aa55a3e7e05b741b1d6fdb1da9fb87d8 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 29 Jul 2019 18:21:52 -0700 Subject: [PATCH] Fixed MongoDB connection string --- db.js | 3 --- meshuser.js | 4 ++-- package.json | 2 +- sample-config.json | 3 ++- views/default-min.handlebars | 2 +- views/default.handlebars | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/db.js b/db.js index 2ecb4282..bea2ddd1 100644 --- a/db.js +++ b/db.js @@ -211,10 +211,7 @@ module.exports.CreateDB = function (parent, func) { Datastore = client; // Get the database name and setup the database client - var dbNamefromUrl = null; - try { dbNamefromUrl = require('url').parse(parent.args.mongodb).path.split('/')[1]; } catch (ex) { } var dbname = 'meshcentral'; - if (dbNamefromUrl) { dbname = dbNamefromUrl; } if (parent.args.mongodbname) { dbname = parent.args.mongodbname; } const dbcollectionname = (parent.args.mongodbcol) ? (parent.args.mongodbcol) : 'meshcentral'; const db = client.db(dbname); diff --git a/meshuser.js b/meshuser.js index 17ffe301..fd2b9734 100644 --- a/meshuser.js +++ b/meshuser.js @@ -1562,7 +1562,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use parent.parent.DispatchEvent(targets, obj, event); // Event the device group creation - var event = { etype: 'mesh', userid: user._id, username: user.name, meshid: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, action: 'createmesh', links: links, msg: 'Mesh created: ' + command.meshname, domain: domain.id }; + var event = { etype: 'mesh', userid: user._id, username: user.name, meshid: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, action: 'createmesh', links: links, msg: 'Device group created: ' + command.meshname, domain: domain.id }; parent.parent.DispatchEvent(['*', meshid, user._id], obj, event); // Even if DB change stream is active, this event must be acted upon. try { ws.send(JSON.stringify({ action: 'createmesh', responseid: command.responseid, result: 'ok', meshid: meshid })); } catch (ex) { } @@ -1594,7 +1594,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (err != null) { if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'deletemesh', responseid: command.responseid, result: err })); } catch (ex) { } } return; } // Fire the removal event first, because after this, the event will not route - var event = { etype: 'mesh', userid: user._id, username: user.name, meshid: command.meshid, name: command.meshname, action: 'deletemesh', msg: 'Mesh deleted: ' + command.meshname, domain: domain.id }; + var event = { etype: 'mesh', userid: user._id, username: user.name, meshid: command.meshid, name: command.meshname, action: 'deletemesh', msg: 'Device group deleted: ' + command.meshname, domain: domain.id }; parent.parent.DispatchEvent(['*', command.meshid], obj, event); // Even if DB change stream is active, this event need to be acted on. // Remove all user links to this mesh diff --git a/package.json b/package.json index 11fa96c7..e41bf323 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.3.8-t", + "version": "0.3.8-u", "keywords": [ "Remote Management", "Intel AMT", diff --git a/sample-config.json b/sample-config.json index ec06803a..e436f8b6 100644 --- a/sample-config.json +++ b/sample-config.json @@ -2,7 +2,8 @@ "__comment__" : "This is a sample configuration file, edit a section and remove the _ in front of the name. Refer to the user's guide for details.", "settings": { "_Cert": "myserver.mydomain.com", - "_MongoDb": "mongodb://127.0.0.1:27017/meshcentral", + "_MongoDb": "mongodb://127.0.0.1:27017", + "_MongoDbName": "meshcentral", "_MongoDbChangeStream": true, "_WANonly": true, "_LANonly": true, diff --git a/views/default-min.handlebars b/views/default-min.handlebars index cf724add..26512207 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index b65428e0..46251784 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2096,7 +2096,7 @@ break; } default: - console.log('Unknown message.action', message.action); + //console.log('Unknown message.action', message.action); break; } }