Skip to content

Commit

Permalink
add/fix iplocation
Browse files Browse the repository at this point in the history
Signed-off-by: si458 <simonsmith5521@gmail.com>
  • Loading branch information
si458 committed May 21, 2024
1 parent 4cd7b40 commit 7e7361d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions meshagent.js
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
db.Get('iploc_' + obj.remoteaddr, function (err, iplocs) {
if ((iplocs != null) && (iplocs.length == 1)) {
// We have a location in the database for this remote IP
const iploc = nodes[0], x = {};
const iploc = iplocs[0], x = {};
if ((iploc != null) && (iploc.ip != null) && (iploc.loc != null)) {
x.publicip = iploc.ip;
x.iploc = iploc.loc + ',' + (Math.floor((new Date(iploc.date)) / 1000));
Expand All @@ -1067,10 +1067,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
} else {
// Check if we need to ask for the IP location
var doIpLocation = 0;
if (device.iploc == null) {
if (obj.iploc == null) {
doIpLocation = 1;
} else {
const loc = device.iploc.split(',');
const loc = obj.iploc.split(',');
if (loc.length < 3) {
doIpLocation = 2;
} else {
Expand Down
5 changes: 5 additions & 0 deletions meshcentral-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,11 @@
"default": false,
"description": "Enables the geo-location feature and device location map in the user interface, this feature is not being worked on."
},
"ipLocation": {
"type": "boolean",
"default": false,
"description": "When enabled, the remote agents will submit there approximate location to MeshCentral, Use in combination with \"geoLocation\"."
},
"novnc": {
"type": "boolean",
"default": true,
Expand Down
1 change: 1 addition & 0 deletions sample-config-advanced.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@
"_agentNoProxy": true,
"_lockAgentDownload": true,
"_geoLocation": true,
"_ipLocation": true,
"_novnc": false,
"_mstsc": true,
"_ssh": true,
Expand Down

0 comments on commit 7e7361d

Please sign in to comment.