mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 06:35:54 -05:00
Fix folder drag & drop and added relay events.
This commit is contained in:
parent
1ee8c9c467
commit
4c84830027
@ -1311,7 +1311,11 @@ function createMeshCore(agent)
|
||||
for (var i in cmd.delfiles) {
|
||||
var p = obj.path.join(cmd.path, cmd.delfiles[i]), delcount = 0;
|
||||
try { delcount = deleteFolderRecursive(p, cmd.rec); } catch (e) { }
|
||||
MeshServerLog((cmd.rec ? 'Delete recursive: \"' : 'Delete: \"') + p + '\", ' + delcount + ' element(s) removed', this.httprequest);
|
||||
if ((delcount == 1) && !cmd.rec) {
|
||||
MeshServerLog('Delete: \"' + p + '\"', this.httprequest);
|
||||
} else {
|
||||
MeshServerLog((cmd.rec ? 'Delete recursive: \"' : 'Delete: \"') + p + '\", ' + delcount + ' element(s) removed', this.httprequest);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
6
agents/meshcore.min.js
vendored
6
agents/meshcore.min.js
vendored
@ -1311,7 +1311,11 @@ function createMeshCore(agent)
|
||||
for (var i in cmd.delfiles) {
|
||||
var p = obj.path.join(cmd.path, cmd.delfiles[i]), delcount = 0;
|
||||
try { delcount = deleteFolderRecursive(p, cmd.rec); } catch (e) { }
|
||||
MeshServerLog((cmd.rec ? 'Delete recursive: \"' : 'Delete: \"') + p + '\", ' + delcount + ' element(s) removed', this.httprequest);
|
||||
if ((delcount == 1) && !cmd.rec) {
|
||||
MeshServerLog('Delete: \"' + p + '\"', this.httprequest);
|
||||
} else {
|
||||
MeshServerLog((cmd.rec ? 'Delete recursive: \"' : 'Delete: \"') + p + '\", ' + delcount + ' element(s) removed', this.httprequest);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
13
meshrelay.js
13
meshrelay.js
@ -157,6 +157,7 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie
|
||||
relayinfo.peer1.ws.send('c');
|
||||
relayinfo.peer1.ws._socket.resume(); // Release the traffic
|
||||
relayinfo.peer2.ws._socket.resume(); // Release the traffic
|
||||
ws.time = relayinfo.peer1.ws.time = Date.now();
|
||||
|
||||
relayinfo.peer1.ws.peer = relayinfo.peer2.ws;
|
||||
relayinfo.peer2.ws.peer = relayinfo.peer1.ws;
|
||||
@ -165,6 +166,12 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie
|
||||
if (relayinfo.timeout) { clearTimeout(relayinfo.timeout); delete relayinfo.timeout; }
|
||||
|
||||
parent.parent.debug(1, 'Relay connected: ' + obj.id + ' (' + cleanRemoteAddr(ws._socket.remoteAddress) + ' --> ' + cleanRemoteAddr(obj.peer.ws._socket.remoteAddress) + ')');
|
||||
|
||||
// Log the connection
|
||||
if (user) {
|
||||
var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: user._id, username: parent.users[user._id].name, msg: 'Started relay session \"' + obj.id + '\" from ' + cleanRemoteAddr(obj.peer.ws._socket.remoteAddress) + ' to ' + cleanRemoteAddr(ws._socket.remoteAddress) };
|
||||
parent.parent.DispatchEvent(['*', user._id], obj, event);
|
||||
}
|
||||
} else {
|
||||
// Connected already, drop (TODO: maybe we should re-connect?)
|
||||
ws.close();
|
||||
@ -237,6 +244,12 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie
|
||||
try { peer.ws.close(); } catch (e) { } // Soft disconnect
|
||||
try { peer.ws._socket._parent.end(); } catch (e) { } // Hard disconnect
|
||||
|
||||
// Log the disconnection
|
||||
if (user && ws.time) {
|
||||
var event = { etype: 'relay', action: 'relaylog', domain: domain.id, userid: user._id, username: parent.users[user._id].name, msg: 'Ended relay session \"' + obj.id + '\" from ' + cleanRemoteAddr(obj.peer.ws._socket.remoteAddress) + ' to ' + cleanRemoteAddr(ws._socket.remoteAddress) + ', ' + Math.floor((Date.now() - ws.time) / 1000) + ' second(s)' };
|
||||
parent.parent.DispatchEvent(['*', user._id], obj, event);
|
||||
}
|
||||
|
||||
// Aggressive peer cleanup
|
||||
delete peer.id;
|
||||
delete peer.ws;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.3.8-y",
|
||||
"version": "0.3.9-a",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
BIN
public/images/icon-relay.png
Normal file
BIN
public/images/icon-relay.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 340 B |
@ -1186,6 +1186,14 @@ a {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.relayIcon16 {
|
||||
background: url(../images/icon-relay.png);
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.lbbutton {
|
||||
width: 74px;
|
||||
height: 74px;
|
||||
|
File diff suppressed because one or more lines are too long
@ -5723,7 +5723,13 @@
|
||||
QV('p13bigfail', false);
|
||||
QV('p13bigok', false);
|
||||
if (e.dataTransfer == null || e.dataTransfer.files.length == 0 || p13filetree == null) return;
|
||||
p13doUploadFiles(e.dataTransfer.files);
|
||||
|
||||
// Check if these are files we can upload, remove all folders.
|
||||
var files = [];
|
||||
for (var i in e.dataTransfer.files) { if ((e.dataTransfer.files[i].type != null) && (e.dataTransfer.files[i].size != null) && (e.dataTransfer.files[i].type != '') && (e.dataTransfer.files[i].size != 0)) { files.push(e.dataTransfer.files[i]); } }
|
||||
if (files.length == 0) return;
|
||||
|
||||
p13doUploadFiles(files);
|
||||
}
|
||||
|
||||
var p13dragtimer = null;
|
||||
@ -5969,6 +5975,7 @@
|
||||
var icon = 'si3';
|
||||
if (event.etype == 'user') icon = 'm2';
|
||||
if (event.etype == 'server') icon = 'si3';
|
||||
if (event.etype == 'relay') icon = 'relayIcon16';
|
||||
|
||||
var msg = event.msg.split('(R)').join('®');
|
||||
if (event.username) {
|
||||
@ -7257,21 +7264,27 @@
|
||||
QV('bigok', false);
|
||||
//QV('p5fileCatchAllInput', false);
|
||||
|
||||
// Check if these are files we can upload, remove all folders.
|
||||
if (e.dataTransfer == null) return;
|
||||
var files = [];
|
||||
for (var i in e.dataTransfer.files) { if ((e.dataTransfer.files[i].type != null) && (e.dataTransfer.files[i].size != null) && (e.dataTransfer.files[i].type != '') && (e.dataTransfer.files[i].size != 0)) { files.push(e.dataTransfer.files[i]); } }
|
||||
if (files.length == 0) return;
|
||||
|
||||
// For Chrome & Firefox
|
||||
var error = 0;
|
||||
p5uploadFile(); // Display the the dialog box
|
||||
try { Q('p5uploadinput').files = e.dataTransfer.files; } catch (ex) { error = 1; } // Set the files in the dialog box
|
||||
try { Q('p5uploadinput').files = files; } catch (ex) { error = 1; } // Set the files in the dialog box
|
||||
if (error == 0) { p5uploadFileEx(); } // Press the submit button
|
||||
setDialogMode(0); // Close the dialog box
|
||||
|
||||
// For IE browser - This will not work with very large files
|
||||
if (error == 1) {
|
||||
if (e.dataTransfer == null || e.dataTransfer.files.length == 0 || filetreelocation.length == 0) return;
|
||||
var names = [], sizes = [], types = [], datas = [], readercount = e.dataTransfer.files.length, totalSize = 0;
|
||||
for (var i = 0; i < e.dataTransfer.files.length; i++) { totalSize += e.dataTransfer.files[i].size; }
|
||||
if (filetreelocation.length == 0) return;
|
||||
var names = [], sizes = [], types = [], datas = [], readercount = files.length, totalSize = 0;
|
||||
for (var i = 0; i < files.length; i++) { totalSize += files[i].size; }
|
||||
if (totalSize > 1300000) { p5uploadFile(); return; } // File is too large, not sure what the real maximum is.
|
||||
for (var i = 0; i < e.dataTransfer.files.length; i++) {
|
||||
var reader = new FileReader(), file = e.dataTransfer.files[i];
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var reader = new FileReader(), file = files[i];
|
||||
names.push(file.name);
|
||||
sizes.push(file.size);
|
||||
types.push(file.type);
|
||||
@ -7349,6 +7362,7 @@
|
||||
var icon = 'si3';
|
||||
if (event.etype == 'user') icon = 'm2';
|
||||
if (event.etype == 'server') icon = 'si3';
|
||||
if (event.etype == 'relay') icon = 'relayIcon16';
|
||||
|
||||
var msg = event.msg.split('(R)').join('®');
|
||||
if (event.nodeid) {
|
||||
@ -8054,6 +8068,7 @@
|
||||
var icon = 'si3';
|
||||
if (event.etype == 'user') icon = 'm2';
|
||||
if (event.etype == 'server') icon = 'si3';
|
||||
if (event.etype == 'relay') icon = 'relayIcon16';
|
||||
|
||||
var msg = event.msg.split('(R)').join('®');
|
||||
if (event.nodeid) {
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user