mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 05:42:13 +03:00
Added details to context menu, recordings bug fixes.
This commit is contained in:
parent
efc378be6b
commit
3470c81b34
@ -720,28 +720,32 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// If there is a recording quota, remove any old recordings if needed
|
// If there is a recording quota, remove any old recordings if needed
|
||||||
function cleanUpRecordings() {
|
function cleanUpRecordings() {
|
||||||
if (domain.sessionrecording && ((typeof domain.sessionrecording.maxrecordings == 'number') || (typeof domain.sessionrecording.maxrecordingsizemegabytes == 'number'))) {
|
if ((parent.cleanUpRecordingsActive !== true) && domain.sessionrecording && ((typeof domain.sessionrecording.maxrecordings == 'number') || (typeof domain.sessionrecording.maxrecordingsizemegabytes == 'number'))) {
|
||||||
var recPath = null, fs = require('fs');
|
parent.cleanUpRecordingsActive = true;
|
||||||
if (domain.sessionrecording.filepath) { recPath = domain.sessionrecording.filepath; } else { recPath = parent.parent.recordpath; }
|
setTimeout(function () {
|
||||||
fs.readdir(recPath, function (err, files) {
|
var recPath = null, fs = require('fs');
|
||||||
if ((err != null) || (files == null)) return;
|
if (domain.sessionrecording.filepath) { recPath = domain.sessionrecording.filepath; } else { recPath = parent.parent.recordpath; }
|
||||||
var recfiles = [];
|
fs.readdir(recPath, function (err, files) {
|
||||||
for (var i in files) {
|
if ((err != null) || (files == null)) { delete parent.cleanUpRecordingsActive; return; }
|
||||||
if (files[i].endsWith('.mcrec')) {
|
var recfiles = [];
|
||||||
var j = files[i].indexOf('-');
|
for (var i in files) {
|
||||||
if (j > 0) { recfiles.push({ n: files[i], r: files[i].substring(j + 1), s: fs.statSync(parent.parent.path.join(recPath, files[i])).size }); }
|
if (files[i].endsWith('.mcrec')) {
|
||||||
|
var j = files[i].indexOf('-');
|
||||||
|
if (j > 0) { recfiles.push({ n: files[i], r: files[i].substring(j + 1), s: fs.statSync(parent.parent.path.join(recPath, files[i])).size }); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
recfiles.sort(function (a, b) { if (a.r < b.r) return 1; if (a.r > b.r) return -1; return 0; });
|
||||||
recfiles.sort(function (a, b) { if (a.r < b.r) return 1; if (a.r > b.r) return -1; return 0; });
|
var totalFiles = 0, totalSize = 0;
|
||||||
var totalFiles = 0, totalSize = 0;
|
for (var i in recfiles) {
|
||||||
for (var i in recfiles) {
|
var overQuota = false;
|
||||||
var overQuota = false;
|
if ((typeof domain.sessionrecording.maxrecordings == 'number') && (totalFiles >= domain.sessionrecording.maxrecordings)) { overQuota = true; }
|
||||||
if ((typeof domain.sessionrecording.maxrecordings == 'number') && (totalFiles >= domain.sessionrecording.maxrecordings)) { overQuota = true; }
|
else if ((typeof domain.sessionrecording.maxrecordingsizemegabytes == 'number') && (totalSize >= (domain.sessionrecording.maxrecordingsizemegabytes * 1048576))) { overQuota = true; }
|
||||||
else if ((typeof domain.sessionrecording.maxrecordingsizemegabytes == 'number') && (totalSize >= (domain.sessionrecording.maxrecordingsizemegabytes * 1048576))) { overQuota = true; }
|
if (overQuota) { fs.unlinkSync(parent.parent.path.join(recPath, recfiles[i].n)); }
|
||||||
if (overQuota) { fs.unlinkSync(parent.parent.path.join(recPath, recfiles[i].n)); }
|
totalFiles++;
|
||||||
totalFiles++;
|
totalSize += recfiles[i].s;
|
||||||
totalSize += recfiles[i].s;
|
}
|
||||||
}
|
delete parent.cleanUpRecordingsActive;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
52
meshrelay.js
52
meshrelay.js
@ -527,29 +527,37 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie
|
|||||||
|
|
||||||
// If there is a recording quota, remove any old recordings if needed
|
// If there is a recording quota, remove any old recordings if needed
|
||||||
function cleanUpRecordings() {
|
function cleanUpRecordings() {
|
||||||
if (domain.sessionrecording && ((typeof domain.sessionrecording.maxrecordings == 'number') || (typeof domain.sessionrecording.maxrecordingsizemegabytes == 'number'))) {
|
if ((parent.cleanUpRecordingsActive !== true) && domain.sessionrecording && ((typeof domain.sessionrecording.maxrecordings == 'number') || (typeof domain.sessionrecording.maxrecordingsizemegabytes == 'number'))) {
|
||||||
var recPath = null, fs = require('fs');
|
parent.cleanUpRecordingsActive = true;
|
||||||
if (domain.sessionrecording.filepath) { recPath = domain.sessionrecording.filepath; } else { recPath = parent.parent.recordpath; }
|
setTimeout(function () {
|
||||||
fs.readdir(recPath, function (err, files) {
|
var recPath = null, fs = require('fs');
|
||||||
if ((err != null) || (files == null)) return;
|
if (domain.sessionrecording.filepath) { recPath = domain.sessionrecording.filepath; } else { recPath = parent.parent.recordpath; }
|
||||||
var recfiles = [];
|
fs.readdir(recPath, function (err, files) {
|
||||||
for (var i in files) {
|
if ((err != null) || (files == null)) { delete parent.cleanUpRecordingsActive; return; }
|
||||||
if (files[i].endsWith('.mcrec')) {
|
var recfiles = [];
|
||||||
var j = files[i].indexOf('-');
|
for (var i in files) {
|
||||||
if (j > 0) { recfiles.push({ n: files[i], r: files[i].substring(j + 1), s: fs.statSync(parent.parent.path.join(recPath, files[i])).size }); }
|
if (files[i].endsWith('.mcrec')) {
|
||||||
|
var j = files[i].indexOf('-');
|
||||||
|
if (j > 0) {
|
||||||
|
var size = null;
|
||||||
|
try { size = fs.statSync(parent.parent.path.join(recPath, files[i])).size } catch (ex) { }
|
||||||
|
if (size != null) { recfiles.push({ n: files[i], r: files[i].substring(j + 1), s: size }); }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
recfiles.sort(function (a, b) { if (a.r < b.r) return 1; if (a.r > b.r) return -1; return 0; });
|
||||||
recfiles.sort(function (a, b) { if (a.r < b.r) return 1; if (a.r > b.r) return -1; return 0; });
|
var totalFiles = 0, totalSize = 0;
|
||||||
var totalFiles = 0, totalSize = 0;
|
for (var i in recfiles) {
|
||||||
for (var i in recfiles) {
|
var overQuota = false;
|
||||||
var overQuota = false;
|
if ((typeof domain.sessionrecording.maxrecordings == 'number') && (totalFiles >= domain.sessionrecording.maxrecordings)) { overQuota = true; }
|
||||||
if ((typeof domain.sessionrecording.maxrecordings == 'number') && (totalFiles >= domain.sessionrecording.maxrecordings)) { overQuota = true; }
|
else if ((typeof domain.sessionrecording.maxrecordingsizemegabytes == 'number') && (totalSize >= (domain.sessionrecording.maxrecordingsizemegabytes * 1048576))) { overQuota = true; }
|
||||||
else if ((typeof domain.sessionrecording.maxrecordingsizemegabytes == 'number') && (totalSize >= (domain.sessionrecording.maxrecordingsizemegabytes * 1048576))) { overQuota = true; }
|
if (overQuota) { fs.unlinkSync(parent.parent.path.join(recPath, recfiles[i].n)); }
|
||||||
if (overQuota) { fs.unlinkSync(parent.parent.path.join(recPath, recfiles[i].n)); }
|
totalFiles++;
|
||||||
totalFiles++;
|
totalSize += recfiles[i].s;
|
||||||
totalSize += recfiles[i].s;
|
}
|
||||||
}
|
delete parent.cleanUpRecordingsActive;
|
||||||
});
|
});
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8017,7 +8017,8 @@
|
|||||||
"ru": "Детали",
|
"ru": "Детали",
|
||||||
"zh-chs": "細節",
|
"zh-chs": "細節",
|
||||||
"xloc": [
|
"xloc": [
|
||||||
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevInfo"
|
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevInfo",
|
||||||
|
"default.handlebars->contextMenu->cxdetails"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -20105,7 +20106,8 @@
|
|||||||
"zh-chs": "外掛程式",
|
"zh-chs": "外掛程式",
|
||||||
"xloc": [
|
"xloc": [
|
||||||
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevPlugins",
|
"default.handlebars->container->topbar->1->1->MainSubMenuSpan->MainSubMenu->1->0->MainDevPlugins",
|
||||||
"default.handlebars->container->topbar->1->1->ServerSubMenuSpan->ServerSubMenu->1->0->ServerPlugins"
|
"default.handlebars->container->topbar->1->1->ServerSubMenuSpan->ServerSubMenu->1->0->ServerPlugins",
|
||||||
|
"default.handlebars->contextMenu->cxplugins"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -44,9 +44,11 @@
|
|||||||
<div id="cxterminal" class="cmtext" onclick="cmaction(2,event)">Terminal</div>
|
<div id="cxterminal" class="cmtext" onclick="cmaction(2,event)">Terminal</div>
|
||||||
<div id="cxfiles" class="cmtext" onclick="cmaction(4,event)">Files</div>
|
<div id="cxfiles" class="cmtext" onclick="cmaction(4,event)">Files</div>
|
||||||
<div id="cxevents" class="cmtext" onclick="cmaction(5,event)">Events</div>
|
<div id="cxevents" class="cmtext" onclick="cmaction(5,event)">Events</div>
|
||||||
<div id="cxconsole" class="cmtext" onclick="cmaction(6,event)">Console</div>
|
<div id="cxdetails" class="cmtext" onclick="cmaction(6,event)">Details</div>
|
||||||
|
<div id="cxconsole" class="cmtext" onclick="cmaction(7,event)">Console</div>
|
||||||
|
<div id="cxplugins" class="cmtext" onclick="cmaction(8,event)" style="display:none">Plugins</div>
|
||||||
<hr id="cxmgroupsplit" />
|
<hr id="cxmgroupsplit" />
|
||||||
<div id="cxmdesktop" class="cmtext" onclick="cmaction(7,event)" style="display:none">Multi-Desktop</div>
|
<div id="cxmdesktop" class="cmtext" onclick="cmaction(9,event)" style="display:none">Multi-Desktop</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="meshContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
|
<div id="meshContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
|
||||||
<div id="cxselectall" class="cmtext" onclick="cmmeshaction(1,event)">Select All</div>
|
<div id="cxselectall" class="cmtext" onclick="cmmeshaction(1,event)">Select All</div>
|
||||||
@ -4165,9 +4167,9 @@
|
|||||||
function cmaction(action,event) {
|
function cmaction(action,event) {
|
||||||
var nodeid = contextelement.children[1].attributes.onclick.value;
|
var nodeid = contextelement.children[1].attributes.onclick.value;
|
||||||
nodeid = nodeid.substring(12, nodeid.length - 18);
|
nodeid = nodeid.substring(12, nodeid.length - 18);
|
||||||
if (action == 7) { Q('viewselect').value = 3; Q('viewselect').onchange(); Q('autoConnectDesktopCheckbox').checked = true; Q('autoConnectDesktopCheckbox').onclick(); } // Multi-Desktop
|
if (action == 9) { Q('viewselect').value = 3; Q('viewselect').onchange(); Q('autoConnectDesktopCheckbox').checked = true; Q('autoConnectDesktopCheckbox').onclick(); } // Multi-Desktop
|
||||||
if ((action > 0) && (action < 7)) {
|
if ((action > 0) && (action < 9)) {
|
||||||
var panel = [0, 10, 12, 11, 13, 16, 15][action]; // (invalid), General, Desktop, Terminal, Files, Events, Console
|
var panel = [0, 10, 12, 11, 13, 16, 17, 15, 19][action]; // (invalid), General, Desktop, Terminal, Files, Events, Console, Plugin
|
||||||
if (event && (event.shiftKey == true)) {
|
if (event && (event.shiftKey == true)) {
|
||||||
// Open the device in a different tab
|
// Open the device in a different tab
|
||||||
window.open(window.location.origin + '?node=' + nodeid.split('/')[2] + '&viewmode=' + panel + '&hide=16', 'meshcentral:' + nodeid);
|
window.open(window.location.origin + '?node=' + nodeid.split('/')[2] + '&viewmode=' + panel + '&hide=16', 'meshcentral:' + nodeid);
|
||||||
@ -11136,6 +11138,10 @@
|
|||||||
|
|
||||||
var p52recordings = null;
|
var p52recordings = null;
|
||||||
function updateRecordings() {
|
function updateRecordings() {
|
||||||
|
// Save the list of currently checked recordings
|
||||||
|
var checkedRecordings = [], elements = document.getElementsByClassName('RecordingCheckbox');
|
||||||
|
for (var i=0;i<elements.length;i++) { if (elements[i].checked) { checkedRecordings.push(elements[i].value); } }
|
||||||
|
|
||||||
// Display the users using the sorted list
|
// Display the users using the sorted list
|
||||||
var x = '<table class=p3usersTable cellpadding=0 cellspacing=0>', addHeader = true;
|
var x = '<table class=p3usersTable cellpadding=0 cellspacing=0>', addHeader = true;
|
||||||
x += '<th>' + "Session" + '<th style=width:110px>' + nobreak("Start Time") + '<th style=width:110px>' + "Duration" + '<th style=width:110px>' + "Size";
|
x += '<th>' + "Session" + '<th style=width:110px>' + nobreak("Start Time") + '<th style=width:110px>' + "Duration" + '<th style=width:110px>' + "Size";
|
||||||
@ -11149,6 +11155,11 @@
|
|||||||
}
|
}
|
||||||
x += '</table>';
|
x += '</table>';
|
||||||
QH('p52recordings', x);
|
QH('p52recordings', x);
|
||||||
|
|
||||||
|
// Re-check recordings
|
||||||
|
elements = document.getElementsByClassName('RecordingCheckbox');
|
||||||
|
for (var i=0;i<elements.length;i++) { elements[i].checked = ((checkedRecordings.indexOf(elements[i].value) >= 0)); }
|
||||||
|
p52updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
function addRecordingHtml(i, rec) {
|
function addRecordingHtml(i, rec) {
|
||||||
@ -11184,7 +11195,8 @@
|
|||||||
if (rec.present == 1) { icon = 'm1'; actions = '<div style=cursor:pointer;float:right><a href=recordings.ashx?file=' + encodeURIComponent(rec.filename) + ' download><img src=images/link4.png height=10 width=10 title="Download Recording" download></a> </div>'; }
|
if (rec.present == 1) { icon = 'm1'; actions = '<div style=cursor:pointer;float:right><a href=recordings.ashx?file=' + encodeURIComponent(rec.filename) + ' download><img src=images/link4.png height=10 width=10 title="Download Recording" download></a> </div>'; }
|
||||||
var x = '<tr tabindex=0 onmouseover=userMouseHover2(this,1) onmouseout=userMouseHover2(this,0) onkeypress="if (event.key==\'Enter\') showRecordingDialog(event,\'' + i + '\')"><td style=cursor:pointer>';
|
var x = '<tr tabindex=0 onmouseover=userMouseHover2(this,1) onmouseout=userMouseHover2(this,0) onkeypress="if (event.key==\'Enter\') showRecordingDialog(event,\'' + i + '\')"><td style=cursor:pointer>';
|
||||||
x += '<div class=bar style=width:100%>';
|
x += '<div class=bar style=width:100%>';
|
||||||
x += '<div class=baricon><input class=RecordingCheckbox value=' + i + ' onclick=p52updateInfo() type=checkbox></div>';
|
//x += '<div class=baricon><input class=RecordingCheckbox value="' + encodeURIComponent(rec.filename) + '" onclick=p52updateInfo() type=checkbox></div>';
|
||||||
|
x += '<div></div>';
|
||||||
x += '<div class=baricon onclick=showRecordingDialog(event,"' + i + '")><div class=' + icon + '></div></div>';
|
x += '<div class=baricon onclick=showRecordingDialog(event,"' + i + '")><div class=' + icon + '></div></div>';
|
||||||
x += '<div class=g1 onclick=showRecordingDialog(event,"' + i + '")></div><div class=g2 onclick=showRecordingDialog("' + i + '")></div>';
|
x += '<div class=g1 onclick=showRecordingDialog(event,"' + i + '")></div><div class=g2 onclick=showRecordingDialog("' + i + '")></div>';
|
||||||
x += '<div onclick=showRecordingDialog(event,"' + i + '")>' + actions + '<div style=font-size:16px>' + sessionName + '</div></div></div><td style=text-align:center>' + sessionStartStr + '<td style=text-align:center>' + sessionLengthStr + '<td style=text-align:center>' + sessionSize;
|
x += '<div onclick=showRecordingDialog(event,"' + i + '")>' + actions + '<div style=font-size:16px>' + sessionName + '</div></div></div><td style=text-align:center>' + sessionStartStr + '<td style=text-align:center>' + sessionLengthStr + '<td style=text-align:center>' + sessionSize;
|
||||||
@ -11195,7 +11207,6 @@
|
|||||||
if (xxdialogMode) return;
|
if (xxdialogMode) return;
|
||||||
if ((event.target.tagName == 'IMG') || (event.target.tagName == 'A')) return;
|
if ((event.target.tagName == 'IMG') || (event.target.tagName == 'A')) return;
|
||||||
var rec = p52recordings[i];
|
var rec = p52recordings[i];
|
||||||
//console.log(rec);
|
|
||||||
var x = '';
|
var x = '';
|
||||||
if (rec.protocol) {
|
if (rec.protocol) {
|
||||||
var protocolStr = "Unknown";
|
var protocolStr = "Unknown";
|
||||||
@ -11220,7 +11231,15 @@
|
|||||||
|
|
||||||
function refreshRecodings() { meshserver.send({ action: 'recordings', limit: 1000 }); }
|
function refreshRecodings() { meshserver.send({ action: 'recordings', limit: 1000 }); }
|
||||||
function openRecodringPlayer() { if (!xxdialogMode) window.open(window.location.origin + '{{{domainurl}}}player.htm', 'meshcentral-deskplayer'); }
|
function openRecodringPlayer() { if (!xxdialogMode) window.open(window.location.origin + '{{{domainurl}}}player.htm', 'meshcentral-deskplayer'); }
|
||||||
function p52updateInfo() { }
|
function p52updateInfo() {
|
||||||
|
var elements = document.getElementsByClassName('RecordingCheckbox'), checkcount = 0;
|
||||||
|
for (var i=0;i<elements.length;i++) { if (elements[i].checked === true) { checkcount++; } }
|
||||||
|
if (checkcount > 0) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// FILE SELECTOR, DIALOG 3
|
// FILE SELECTOR, DIALOG 3
|
||||||
|
Loading…
Reference in New Issue
Block a user