return correct responses for removedevices #7273

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2025-09-16 14:53:26 +01:00
parent 15f6c9d30b
commit ce5111477d

View File

@ -2812,7 +2812,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
// Get the node and the rights for this node
parent.GetNodeWithRights(domain, user, nodeid, function (node, rights, visible) {
// Check we have the rights to delete this device
if ((rights & MESHRIGHT_UNINSTALL) == 0) return;
if ((rights & MESHRIGHT_UNINSTALL) == 0) {
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removedevices', responseid: command.responseid, result: 'Denied' })); } catch (ex) { } }
return;
}
// Delete this node including network interface information, events and timeline
db.Remove(node._id); // Remove node with that id
@ -2877,12 +2880,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if ((state.connectivity & 1) != 0) { parent.wsagents[nodeid].close(); } // Disconnect mesh agent
if ((state.connectivity & 2) != 0) { parent.parent.mpsserver.closeAllForNode(nodeid); } // Disconnect CIRA/Relay/LMS connections
}
// Send response if required
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removedevices', responseid: command.responseid, result: 'ok' })); } catch (ex) { } }
});
}
// Send response if required, in this case we always send ok which is not ideal.
if (command.responseid != null) { try { ws.send(JSON.stringify({ action: 'removedevices', responseid: command.responseid, result: 'ok' })); } catch (ex) { } }
break;
}
case 'wakedevices':