mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 06:05:53 -05:00
Improved file search.
This commit is contained in:
parent
a3d712d207
commit
562000f120
@ -1721,8 +1721,28 @@ function CreateMeshCentralServer(config, args) {
|
||||
obj.GetConnectivityState = function (nodeid) { return obj.connectivityByNode[nodeid]; };
|
||||
|
||||
// Get the routing server id for a given node and connection type, can never be self.
|
||||
obj.GetRoutingServerIdNotSelf = function (nodeid, connectType) {
|
||||
if (obj.multiServer == null) return null;
|
||||
for (var serverid in obj.peerConnectivityByNode) {
|
||||
if (serverid == obj.serverId) continue;
|
||||
var state = obj.peerConnectivityByNode[serverid][nodeid];
|
||||
if ((state != null) && ((state.connectivity & connectType) != 0)) { return { serverid: serverid, meshid: state.meshid }; }
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// Get the routing server id for a given node and connection type, self first
|
||||
obj.GetRoutingServerId = function (nodeid, connectType) {
|
||||
if (obj.multiServer == null) return null;
|
||||
|
||||
// Look at our own server first
|
||||
var connections = obj.peerConnectivityByNode[obj.serverId];
|
||||
if (connections != null) {
|
||||
var state = connections[nodeid];
|
||||
if ((state != null) && ((state.connectivity & connectType) != 0)) { return { serverid: obj.serverId, meshid: state.meshid }; }
|
||||
}
|
||||
|
||||
// Look at other servers
|
||||
for (var serverid in obj.peerConnectivityByNode) {
|
||||
if (serverid == obj.serverId) continue;
|
||||
var state = obj.peerConnectivityByNode[serverid][nodeid];
|
||||
|
@ -945,7 +945,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
||||
}
|
||||
} else {
|
||||
// Check if a peer server is connected to this agent
|
||||
var routing = parent.parent.GetRoutingServerId(command.nodeid, 1); // 1 = MeshAgent routing type
|
||||
var routing = parent.parent.GetRoutingServerIdNotSelf(command.nodeid, 1); // 1 = MeshAgent routing type
|
||||
if (routing != null) {
|
||||
// Check if we have permission to send a message to that node
|
||||
rights = parent.GetNodeRights(user, routing.meshid, command.nodeid);
|
||||
|
@ -99,7 +99,7 @@ module.exports.CreateMeshDeviceFile = function (parent, ws, res, req, domain, us
|
||||
}
|
||||
} else {
|
||||
// Check if a peer server is connected to this agent
|
||||
var routing = parent.parent.GetRoutingServerId(command.nodeid, 1); // 1 = MeshAgent routing type
|
||||
var routing = parent.parent.GetRoutingServerIdNotSelf(command.nodeid, 1); // 1 = MeshAgent routing type
|
||||
if (routing != null) {
|
||||
// Check if we have permission to send a message to that node
|
||||
rights = parent.GetNodeRights(user, routing.meshid, command.nodeid);
|
||||
|
@ -146,7 +146,7 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
||||
}
|
||||
} else {
|
||||
// Check if a peer server is connected to this agent
|
||||
var routing = parent.parent.GetRoutingServerId(command.nodeid, 1); // 1 = MeshAgent routing type
|
||||
var routing = parent.parent.GetRoutingServerIdNotSelf(command.nodeid, 1); // 1 = MeshAgent routing type
|
||||
if (routing != null) {
|
||||
// Check if we have permission to send a message to that node
|
||||
rights = parent.GetNodeRights(user, routing.meshid, command.nodeid);
|
||||
|
@ -237,7 +237,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
});
|
||||
} else {
|
||||
// Check if a peer server is connected to this agent
|
||||
var routing = parent.parent.GetRoutingServerId(command.nodeid, 1); // 1 = MeshAgent routing type
|
||||
var routing = parent.parent.GetRoutingServerIdNotSelf(command.nodeid, 1); // 1 = MeshAgent routing type
|
||||
if (routing != null) {
|
||||
// Check if we have permission to send a message to that node
|
||||
parent.GetNodeWithRights(domain, user, command.nodeid, function (node, rights, visible) {
|
||||
@ -1112,6 +1112,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
case 'info': {
|
||||
var info = process.memoryUsage();
|
||||
info.dbType = ['None', 'NeDB', 'MongoJS', 'MongoDB'][parent.db.databaseType];
|
||||
try { if (parent.parent.multiServer != null) { info.serverId = parent.parent.multiServer.serverid; } } catch (ex) { }
|
||||
if (parent.db.databaseType == 3) { info.dbChangeStream = parent.db.changeStream; }
|
||||
if (parent.parent.pluginHandler != null) { info.plugins = []; for (var i in parent.parent.pluginHandler.plugins) { info.plugins.push(i); } }
|
||||
try { info.nodeVersion = process.version; } catch (ex) { }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8158,25 +8158,21 @@
|
||||
|
||||
function p13findfile() {
|
||||
if (xxdialogMode) return;
|
||||
var x = addHtmlValue("Filter", '<input id=d2findFilter style="width:230px" onkeyup=p13findfileValidate() placeholder="*.txt"></input>');
|
||||
var x = addHtmlValue("Filter", '<input id=d2findFilter style="width:230px" onkeyup=p13findfileValidate() onkeydown=p13findfileDown(event) placeholder="*.txt"></input>');
|
||||
x += '<div id=d2findResults style="width:100%;height:184px;background-color:white;border:1px solid black;padding:3px;overflow:scroll;margin-top:8px"></div>';
|
||||
x += '<div style=margin-top:8px><input id=filefind_dlgCancelButton type=button value=' + "Cancel" + ' style=float:right;width:80px;margin-left:5px onclick=p13findfileCancel()>';
|
||||
x += '<input id=filefind_dlgOkButton type=submit value=' + "OK" + ' style=float:right;width:80px onclick=p13findfileEx()><br /><br /></div>';
|
||||
setDialogMode(2, "File Files", 0, null, x);
|
||||
Q('d2findResults').focus();
|
||||
x += '<div style=margin-top:8px><input id=filefind_dlgCancelButton type=button value=' + "Close" + ' style=float:right;width:80px;margin-left:5px onclick=p13findfileCancel()>';
|
||||
x += '<input id=filefind_dlgOkButton type=submit value=' + "Search" + ' style=float:right;width:80px onclick=p13findfileEx()><br /><br /></div>';
|
||||
setDialogMode(2, "Find Files", 0, null, x);
|
||||
p13findfileValidate();
|
||||
Q('d2findFilter').focus();
|
||||
}
|
||||
|
||||
function p13findfileValidate() {
|
||||
QE('filefind_dlgOkButton', Q('d2findFilter').value.length > 0);
|
||||
}
|
||||
|
||||
function p13findfileCancel() {
|
||||
if (xxdialogTag != null) { files.sendText({ action: 'cancelfindfile', reqid: xxdialogTag }); }
|
||||
dialogclose(0)
|
||||
}
|
||||
function p13findfileDown(e) { if (e.code == "Enter") { p13findfileEx(); } }
|
||||
function p13findfileValidate() { QE('filefind_dlgOkButton', Q('d2findFilter').value.length > 0); }
|
||||
function p13findfileCancel() { if (xxdialogTag != null) { files.sendText({ action: 'cancelfindfile', reqid: xxdialogTag }); } dialogclose(0) }
|
||||
|
||||
function p13findfileEx(b, t) {
|
||||
if (Q('d2findFilter').value.length == 0) return;
|
||||
var winagent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
|
||||
var slash = winagent ? '\\' : '/';
|
||||
var path = p13filetreelocation.join(slash) + slash;
|
||||
|
Loading…
Reference in New Issue
Block a user