add/fix iplocation
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
May 21, 2024 at 20:01 UTC
7e7361de9bc9056dcaee56464ec9d99c52cac83a
3 files changed
+9
-3
meshagent.js
+3
-3
@@ -1058,7 +1058,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1058
db.Get('iploc_' + obj.remoteaddr, function (err, iplocs) {
1059
if ((iplocs != null) && (iplocs.length == 1)) {
1060
// We have a location in the database for this remote IP
1061
- const iploc = nodes[0], x = {};
1061
+ const iploc = iplocs[0], x = {};
1062
if ((iploc != null) && (iploc.ip != null) && (iploc.loc != null)) {
1063
x.publicip = iploc.ip;
1064
x.iploc = iploc.loc + ',' + (Math.floor((new Date(iploc.date)) / 1000));
@@ -1067,10 +1067,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
1067
} else {
1068
// Check if we need to ask for the IP location
1069
var doIpLocation = 0;
1070
- if (device.iploc == null) {
1070
+ if (obj.iploc == null) {
1071
doIpLocation = 1;
1072
} else {
1073
- const loc = device.iploc.split(',');
1073
+ const loc = obj.iploc.split(',');
1074
if (loc.length < 3) {
1075
doIpLocation = 2;
1076
} else {
meshcentral-config-schema.json
+5
@@ -1742,6 +1742,11 @@
1742
"default": false,
1743
"description": "Enables the geo-location feature and device location map in the user interface, this feature is not being worked on."
1744
},
1745
+ "ipLocation": {
1746
+ "type": "boolean",
1747
+ "default": false,
1748
+ "description": "When enabled, the remote agents will submit there approximate location to MeshCentral, Use in combination with \"geoLocation\"."
1749
+ },
1750
"novnc": {
1751
"type": "boolean",
1752
"default": true,
sample-config-advanced.json
+1
@@ -316,6 +316,7 @@
316
"_agentNoProxy": true,
317
"_lockAgentDownload": true,
318
"_geoLocation": true,
319
+ "_ipLocation": true,
320
"_novnc": false,
321
"_mstsc": true,
322
"_ssh": true,