add/fix iplocation

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2024-05-21 20:01:45 +01:00
parent 4cd7b408fa
commit 7e7361de9b
3 changed files with 9 additions and 3 deletions

View File

@ -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));
@ -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 {

View File

@ -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,

View File

@ -316,6 +316,7 @@
"_agentNoProxy": true,
"_lockAgentDownload": true,
"_geoLocation": true,
"_ipLocation": true,
"_novnc": false,
"_mstsc": true,
"_ssh": true,