Added device MeshCentral Router link filtering.

This commit is contained in:
Ylian Saint-Hilaire 2021-02-25 12:31:03 -08:00
parent 852fadeaf5
commit 069656f632
3 changed files with 11 additions and 3 deletions

View File

@ -246,6 +246,11 @@
"port": {
"description": "The port on the remote device.",
"type": "number"
},
"filter": {
"description": "Array of node/domain/id or mesh/domain/id strings. When set, the link will only show up for the specified devices or device groups.",
"type": "array",
"items": { "type": "string" }
}
}
}

View File

@ -157,7 +157,8 @@
{
"name": "HTTP",
"protocol": "http",
"port": 80
"port": 80,
"_filter": [ "mesh//xxxx", "node//xxxx" ]
},
{
"name": "HTTPS",

View File

@ -6115,8 +6115,10 @@
if ((serverinfo.devicemeshrouterlinks != null) && (Array.isArray(serverinfo.devicemeshrouterlinks.extralinks))) {
for (var i in serverinfo.devicemeshrouterlinks.extralinks) {
var r = serverinfo.devicemeshrouterlinks.extralinks[i], p = 0;
if (typeof r.protocol == 'number') { p = r.protocol; } else if (r.protocol == 'http') { p = 1; } else if (r.protocol == 'https') { p = 2; } else if (r.protocol == 'rdp') { p = 3; } else if (r.protocol == 'ssh') { p = 4; } else if (r.protocol == 'scp') { p = 5; }
x += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + ') title="' + "Requires installation of MeshCentral Router." + '">' + r.name + '</a>&nbsp;';
if ((r.filter == null) || (Array.isArray(r.filter) && ((r.filter.indexOf(mesh._id) >= 0) || (r.filter.indexOf(node._id) >= 0)))) {
if (typeof r.protocol == 'number') { p = r.protocol; } else if (r.protocol == 'http') { p = 1; } else if (r.protocol == 'https') { p = 2; } else if (r.protocol == 'rdp') { p = 3; } else if (r.protocol == 'ssh') { p = 4; } else if (r.protocol == 'scp') { p = 5; }
x += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + ') title="' + "Requires installation of MeshCentral Router." + '">' + r.name + '</a>&nbsp;';
}
}
}
}