fix windows arm64 agent detection
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Dec 27, 2025 at 21:22 UTC
9b5c772803051067ab36164c2d0fc1b5b07e7aa8
4 files changed
+17
-16
meshuser.js
+1
-1
@@ -3098,7 +3098,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
3098
// Check if this agent is correct for this command type
3099
// command.type 1 = Windows Command, 2 = Windows PowerShell, 3 = Linux/BSD/macOS
3100
var commandsOk = false;
3101
- if ((node.agent.id > 0) && (node.agent.id < 5)) {
3101
+ if ((node.agent.id > 0) && (node.agent.id < 5) || (node.agent.id > 41 && node.agent.id < 44)) {
3102
// Windows Agent
3103
if ((command.type == 1) || (command.type == 2)) { commandsOk = true; }
3104
else if (command.type === 0) { command.type = 1; commandsOk = true; } // Set the default type of this agent
views/default-mobile.handlebars
+4
-3
@@ -4244,7 +4244,7 @@
4244
for (var i in options.nodeids) {
4245
var n = getNodeFromId(options.nodeids[i]);
4246
if (n.agent) { if ((GetNodeRights(n) & 24) == 24) { agenttype = true; }
4247
- if ((n.agent.id > 0) && (n.agent.id < 5)) { wintype = true; } else { linuxtype = true; } }
4247
+ if (isWindowsNode(n)) { wintype = true; } else { linuxtype = true; } }
4248
}
4249
if ((wintype == true) || (linuxtype == true) || (agenttype == true)) {
4250
// Fetch run options
@@ -5904,7 +5904,7 @@
5904
QE('p13PasteButton', false);
5905
} else {
5906
var cc = p13getFileSelCount(), tc = p13getFileCount(), sfc = p13getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders)
5907
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14) || (currentNode.agent.id == 34);
5907
+ var winAgent = isWindowsNode(currentNode);
5908
QE('p13DeleteFileButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
5909
QE('p13NewFolderButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
5910
QE('p13UploadButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
@@ -6100,7 +6100,7 @@
6100
if (xxdialogMode) return;
6101
6102
// Check if we are going to overwrite any files
6103
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14) || (currentNode.agent.id == 34);
6103
+ var winAgent = isWindowsNode(currentNode);
6104
var targetFiles = [], overWriteCount = 0;
6105
for (var i in p13filetree.dir) { if (winAgent) { targetFiles.push(p13filetree.dir[i].n.toLowerCase()); } else { targetFiles.push(p13filetree.dir[i].n); } }
6106
for (var i = 0; i < files.length; i++) {
@@ -7762,6 +7762,7 @@
7762
function isPrivateIP(a) { return (a.startsWith('10.') || a.startsWith('172.16.') || a.startsWith('192.168.')); }
7763
function encodeURIComponentEx(txt) { return encodeURIComponent(txt).replace(/'/g, '%27'); };
7764
function safeNewWindow(url, target) { var newWindow = window.open(url, target, 'noopener,noreferrer'); if (newWindow) { newWindow.opener = null; } }
7765
+ function isWindowsNode(node) { if ((node.mtype != 2) || (node.agent == null) || (node.agent.id == null)) return false; return ([1,2,3,4,21,22,34,42,43].indexOf(node.agent.id) >= 0); }
7766
7767
</script>
7768
</body>
views/default.handlebars
+6
-6
@@ -6026,7 +6026,7 @@
6026
} else if (op == 109) {
6027
// Upload files
6028
var wintype = false, linuxtype = false, chkNodeIds = getCheckedDevices();
6029
- for (var i in chkNodeIds) { var n = getNodeFromId(chkNodeIds[i]); if (n.agent) { if (((n.agent.id > 0) && (n.agent.id < 5)) || (n.agent.id == 34)) { wintype = true; } else { linuxtype = true; } } }
6029
+ for (var i in chkNodeIds) { var n = getNodeFromId(chkNodeIds[i]); if (n.agent) { if (isWindowsNode(n)) { wintype = true; } else { linuxtype = true; } } }
6030
var x = "Upload selected files to all selected devices" + '<br /><br />';
6031
x += '<form method=post enctype=multipart/form-data action=uploadfilebatch.ashx target=fileUploadFrame>';
6032
x += '<input type=hidden name=authCookie value=' + authCookie + ' /><input type=hidden name=nodeIds value=' + chkNodeIds.join(',') + ' /><input type=submit id=d2batchUploadSubmit style=display:none />';
@@ -6196,7 +6196,7 @@
6196
for (var i in options.nodeids) {
6197
var n = getNodeFromId(options.nodeids[i]);
6198
if (n.agent) { if ((GetNodeRights(n) & 24) == 24) { agenttype = true; }
6199
- if ((n.agent.id > 0) && (n.agent.id < 5)) { wintype = true; } else { linuxtype = true; } }
6199
+ if (isWindowsNode(n)) { wintype = true; } else { linuxtype = true; } }
6200
}
6201
if ((wintype == true) || (linuxtype == true) || (agenttype == true)) {
6202
// Fetch run options
@@ -8662,7 +8662,7 @@
8662
} else if (op == 106) {
8663
// Run commands
8664
var wintype = false, linuxtype = false;
8665
- if (currentNode.agent) { if ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) { wintype = true; } else { linuxtype = true; } }
8665
+ if (currentNode.agent) { if (isWindowsNode(currentNode)) { wintype = true; } else { linuxtype = true; } }
8666
if ((wintype == true) || (linuxtype == true)) {
8667
var x = "Run commands on selected devices." + '<br />';
8668
if (wintype == true) {
@@ -11499,7 +11499,7 @@
11499
11500
function p13findfileEx(b, t) {
11501
if (Q('d2findFilter').value.length == 0) return;
11502
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14)|| (currentNode.agent.id == 34);
11502
+ var winAgent = isWindowsNode(currentNode);
11503
var slash = winAgent ? '\\' : '/';
11504
var path = p13filetreelocation.join(slash) + slash;
11505
if (!winAgent) { path = slash + path; }
@@ -11548,7 +11548,7 @@
11548
QE('p13OpenButton', false);
11549
} else {
11550
var cc = p13getFileSelCount(), tc = p13getFileCount(), sfc = p13getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders)
11551
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14)|| (currentNode.agent.id == 34);
11551
+ var winAgent = isWindowsNode(currentNode);
11552
QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
11553
QE('p13NewFolderButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
11554
QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false) || (currentNode.agent.id == 14)));
@@ -11845,7 +11845,7 @@
11845
if (xxdialogMode) return;
11846
11847
// Check if we are going to overwrite any files
11848
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14)|| (currentNode.agent.id == 34);
11848
+ var winAgent = isWindowsNode(currentNode);
11849
var targetFiles = [], overWriteCount = 0;
11850
for (var i in p13filetree.dir) { if (winAgent) { targetFiles.push(p13filetree.dir[i].n.toLowerCase()); } else { targetFiles.push(p13filetree.dir[i].n); } }
11851
for (var i = 0; i < files.length; i++) {
views/default3.handlebars
+6
-6
@@ -6895,7 +6895,7 @@
6895
} else if (op == 109) {
6896
// Upload files
6897
var wintype = false, linuxtype = false, chkNodeIds = getCheckedDevices();
6898
- for (var i in chkNodeIds) { var n = getNodeFromId(chkNodeIds[i]); if (n.agent) { if (((n.agent.id > 0) && (n.agent.id < 5)) || (n.agent.id == 34)) { wintype = true; } else { linuxtype = true; } } }
6898
+ for (var i in chkNodeIds) { var n = getNodeFromId(chkNodeIds[i]); if (n.agent) { if (isWindowsNode(n)) { wintype = true; } else { linuxtype = true; } } }
6899
var x = "Upload selected files to all selected devices" + '<br /><br />';
6900
x += '<form method=post enctype=multipart/form-data action=uploadfilebatch.ashx target=fileUploadFrame>';
6901
x += '<input type=hidden name=authCookie value=' + authCookie + ' /><input type=hidden name=nodeIds value=' + chkNodeIds.join(',') + ' /><input type=submit id=d2batchUploadSubmit style=display:none />';
@@ -7077,7 +7077,7 @@
7077
var n = getNodeFromId(options.nodeids[i]);
7078
if (n.agent) {
7079
if ((GetNodeRights(n) & 24) == 24) { agenttype = true; }
7080
- if ((n.agent.id > 0) && (n.agent.id < 5)) { wintype = true; } else { linuxtype = true; }
7080
+ if (isWindowsNode(n)) { wintype = true; } else { linuxtype = true; }
7081
}
7082
}
7083
if ((wintype == true) || (linuxtype == true) || (agenttype == true)) {
@@ -9580,7 +9580,7 @@
9580
} else if (op == 106) {
9581
// Run commands
9582
var wintype = false, linuxtype = false;
9583
- if (currentNode.agent) { if ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) { wintype = true; } else { linuxtype = true; } }
9583
+ if (currentNode.agent) { if (isWindowsNode(n)) { wintype = true; } else { linuxtype = true; } }
9584
if ((wintype == true) || (linuxtype == true)) {
9585
var x = "Run commands on selected devices." + '<br />';
9586
if (wintype == true) {
@@ -12504,7 +12504,7 @@
12504
12505
function p13findfileEx(b, t) {
12506
if (Q('d2findFilter').value.length == 0) return;
12507
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14) || (currentNode.agent.id == 34);
12507
+ var winAgent = isWindowsNode(currentNode);
12508
var slash = winAgent ? '\\' : '/';
12509
var path = p13filetreelocation.join(slash) + slash;
12510
if (!winAgent) { path = slash + path; }
@@ -12553,7 +12553,7 @@
12553
QE('p13OpenButton', false);
12554
} else {
12555
var cc = p13getFileSelCount(), tc = p13getFileCount(), sfc = p13getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders)
12556
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14) || (currentNode.agent.id == 34);
12556
+ var winAgent = isWindowsNode(currentNode);
12557
QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
12558
QE('p13NewFolderButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)));
12559
QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false) || (currentNode.agent.id == 14)));
@@ -12879,7 +12879,7 @@
12879
if (xxdialogMode) return;
12880
12881
// Check if we are going to overwrite any files
12882
- var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5)) || (currentNode.agent.id == 14) || (currentNode.agent.id == 34);
12882
+ var winAgent = isWindowsNode(currentNode);
12883
var targetFiles = [], overWriteCount = 0;
12884
for (var i in p13filetree.dir) { if (winAgent) { targetFiles.push(p13filetree.dir[i].n.toLowerCase()); } else { targetFiles.push(p13filetree.dir[i].n); } }
12885
for (var i = 0; i < files.length; i++) {