mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 14:45:52 -05:00
MeshPlayer improvements.
This commit is contained in:
parent
043a7c0b68
commit
dd92927586
@ -219,6 +219,7 @@
|
||||
<Content Include="public\images\mapmarker.png" />
|
||||
<Content Include="public\images\meshicon50.png" />
|
||||
<Content Include="public\images\trash.png" />
|
||||
<Content Include="public\player.htm" />
|
||||
<Content Include="public\scriptblocks.txt" />
|
||||
<Content Include="public\sounds\chimes.mp3" />
|
||||
<Content Include="public\styles\font-awesome\css\font-awesome.min.css" />
|
||||
|
@ -108,7 +108,7 @@ function CreateMeshCentralServer(config, args) {
|
||||
try { require('./pass').hash('test', function () { }, 0); } catch (e) { console.log('Old version of node, must upgrade.'); return; } // TODO: Not sure if this test works or not.
|
||||
|
||||
// Check for invalid arguments
|
||||
var validArguments = ['_', 'notls', 'user', 'port', 'aliasport', 'mpsport', 'mpsaliasport', 'redirport', 'cert', 'mpscert', 'deletedomain', 'deletedefaultdomain', 'showall', 'showusers', 'shownodes', 'showmeshes', 'showevents', 'showpower', 'clearpower', 'showiplocations', 'help', 'exactports', 'install', 'uninstall', 'start', 'stop', 'restart', 'debug', 'filespath', 'datapath', 'noagentupdate', 'launch', 'noserverbackup', 'mongodb', 'mongodbcol', 'wanonly', 'lanonly', 'nousers', 'mpsdebug', 'mpspass', 'ciralocalfqdn', 'dbexport', 'dbexportmin', 'dbimport', 'dbmerge', 'dbencryptkey', 'selfupdate', 'tlsoffload', 'userallowedip', 'userblockedip', 'swarmallowedip', 'agentallowedip', 'agentblockedip', 'fastcert', 'swarmport', 'swarmdebug', 'logintoken', 'logintokenkey', 'logintokengen', 'logintokengen', 'mailtokengen', 'admin', 'unadmin', 'sessionkey', 'sessiontime', 'minify', 'minifycore', 'dblistconfigfiles', 'dbshowconfigfile', 'dbpushconfigfiles', 'dbpullconfigfiles', 'dbdeleteconfigfiles', 'configkey', 'loadconfigfromdb', 'npmpath', 'memorytracking'];
|
||||
var validArguments = ['_', 'notls', 'user', 'port', 'aliasport', 'mpsport', 'mpsaliasport', 'redirport', 'cert', 'mpscert', 'deletedomain', 'deletedefaultdomain', 'showall', 'showusers', 'shownodes', 'showmeshes', 'showevents', 'showpower', 'clearpower', 'showiplocations', 'help', 'exactports', 'install', 'uninstall', 'start', 'stop', 'restart', 'debug', 'filespath', 'datapath', 'noagentupdate', 'launch', 'noserverbackup', 'mongodb', 'mongodbcol', 'wanonly', 'lanonly', 'nousers', 'mpsdebug', 'mpspass', 'ciralocalfqdn', 'dbexport', 'dbexportmin', 'dbimport', 'dbmerge', 'dbencryptkey', 'selfupdate', 'tlsoffload', 'userallowedip', 'userblockedip', 'swarmallowedip', 'agentallowedip', 'agentblockedip', 'fastcert', 'swarmport', 'swarmdebug', 'logintoken', 'logintokenkey', 'logintokengen', 'logintokengen', 'mailtokengen', 'admin', 'unadmin', 'sessionkey', 'sessiontime', 'minify', 'minifycore', 'dblistconfigfiles', 'dbshowconfigfile', 'dbpushconfigfiles', 'dbpullconfigfiles', 'dbdeleteconfigfiles', 'configkey', 'loadconfigfromdb', 'npmpath', 'memorytracking', 'serverid'];
|
||||
for (var arg in obj.args) { obj.args[arg.toLocaleLowerCase()] = obj.args[arg]; if (validArguments.indexOf(arg.toLocaleLowerCase()) == -1) { console.log('Invalid argument "' + arg + '", use --help.'); return; } }
|
||||
if (obj.args.mongodb == true) { console.log('Must specify: --mongodb [connectionstring] \r\nSee https://docs.mongodb.com/manual/reference/connection-string/ for MongoDB connection string.'); return; }
|
||||
for (i in obj.config.settings) { obj.args[i] = obj.config.settings[i]; } // Place all settings into arguments, arguments have already been placed into settings so arguments take precedence.
|
||||
|
@ -384,6 +384,7 @@ module.exports.CreateMultiServer = function (parent, args) {
|
||||
if (obj.peerConfig == null) { return null; }
|
||||
obj.serverid = obj.parent.config.peers.serverid;
|
||||
if (obj.serverid == null) { obj.serverid = require("os").hostname().toLowerCase(); } else { obj.serverid = obj.serverid.toLowerCase(); }
|
||||
if (args.serverid != null) { obj.serverid = args.serverid.toLowerCase(); }
|
||||
if (obj.parent.config.peers.servers[obj.serverid] == null) { console.log("Error: Unable to peer with other servers, \"" + obj.serverid + "\" not present in peer servers list."); return null; }
|
||||
//console.log('Server peering ID: ' + obj.serverid);
|
||||
|
||||
|
@ -10,6 +10,10 @@
|
||||
<script type="text/javascript" src="scripts/common-0.0.1.js"></script>
|
||||
<script type="text/javascript" src="scripts/agent-desktop-0.0.2.js"></script>
|
||||
<script type="text/javascript" src="scripts/amt-desktop-0.0.2.js"></script>
|
||||
<script type="text/javascript" src="scripts/zlib.js"></script>
|
||||
<script type="text/javascript" src="scripts/zlib-inflate.js"></script>
|
||||
<script type="text/javascript" src="scripts/zlib-adler32.js"></script>
|
||||
<script type="text/javascript" src="scripts/zlib-crc32.js"></script>
|
||||
</head>
|
||||
<body style="overflow:hidden;background-color:black">
|
||||
<div id=p11 class="noselect" style="overflow:hidden">
|
||||
@ -83,6 +87,7 @@
|
||||
var recFileMetadata = null;
|
||||
var recFileProtocol = 0;
|
||||
var agentDesktop = null;
|
||||
var amtDesktop = null;
|
||||
var playing = false;
|
||||
var readState = 0;
|
||||
var waitTimer = null;
|
||||
@ -162,6 +167,19 @@
|
||||
agentDesktop.State = 3;
|
||||
deskAdjust();
|
||||
}
|
||||
else if (recFileMetadata.protocol == 101) {
|
||||
// Intel AMT Redirection
|
||||
recFileProtocol = 101;
|
||||
x += '<br /><br /><span style=color:gray>Press [space] to play/pause.</span>';
|
||||
QE('PlayButton', true);
|
||||
QE('PauseButton', false);
|
||||
QE('RestartButton', false);
|
||||
recFileStartTime = recFileLastTime = time;
|
||||
amtDesktop = CreateAmtRemoteDesktop('Desk');
|
||||
amtDesktop.onScreenSizeChange = deskAdjust;
|
||||
amtDesktop.State = 3;
|
||||
deskAdjust();
|
||||
}
|
||||
QV('metadatadiv', true);
|
||||
QH('metadatadiv', x);
|
||||
QH('deskstatus', recFile.name);
|
||||
@ -181,19 +199,32 @@
|
||||
function processBlockEx(type, flags, time, data) {
|
||||
if (playing == false) return;
|
||||
var flagBinary = (flags & 1) != 0, flagUser = (flags & 2) != 0;
|
||||
if ((type == 2) && flagBinary && !flagUser) {
|
||||
var deltaTimeTotalSec = Math.floor((time - recFileStartTime) / 1000);
|
||||
if (currentDeltaTimeTotalSec != deltaTimeTotalSec) {
|
||||
currentDeltaTimeTotalSec = deltaTimeTotalSec;
|
||||
var deltaTimeHours = Math.floor(deltaTimeTotalSec / 3600);
|
||||
deltaTimeTotalSec -= (deltaTimeHours * 3600)
|
||||
var deltaTimeMinutes = Math.floor(deltaTimeTotalSec / 60);
|
||||
deltaTimeTotalSec -= (deltaTimeHours * 60)
|
||||
var deltaTimeSeconds = Math.floor(deltaTimeTotalSec);
|
||||
QH('timespan', pad2(deltaTimeHours) + ':' + pad2(deltaTimeMinutes) + ':' + pad2(deltaTimeSeconds))
|
||||
}
|
||||
agentDesktop.ProcessData(data);
|
||||
|
||||
// Update the clock
|
||||
var deltaTimeTotalSec = Math.floor((time - recFileStartTime) / 1000);
|
||||
if (currentDeltaTimeTotalSec != deltaTimeTotalSec) {
|
||||
currentDeltaTimeTotalSec = deltaTimeTotalSec;
|
||||
var deltaTimeHours = Math.floor(deltaTimeTotalSec / 3600);
|
||||
deltaTimeTotalSec -= (deltaTimeHours * 3600)
|
||||
var deltaTimeMinutes = Math.floor(deltaTimeTotalSec / 60);
|
||||
deltaTimeTotalSec -= (deltaTimeHours * 60)
|
||||
var deltaTimeSeconds = Math.floor(deltaTimeTotalSec);
|
||||
QH('timespan', pad2(deltaTimeHours) + ':' + pad2(deltaTimeMinutes) + ':' + pad2(deltaTimeSeconds))
|
||||
}
|
||||
|
||||
if ((type == 2) && flagBinary && !flagUser) {
|
||||
if (recFileProtocol == 2) {
|
||||
// MeshCentral Remote Desktop
|
||||
agentDesktop.ProcessData(data);
|
||||
} else if (recFileProtocol == 101) {
|
||||
// Intel AMT KVM
|
||||
//if ((readState == 0) && (rstr2hex(data) == '140000000400000000')) { readState = 1; }
|
||||
if ((readState == 0) && (rstr2hex(data) == '4100000000000000')) { readState = 1; }
|
||||
else if (readState == 1) { amtDesktop.ProcessData(data); }
|
||||
//console.log(rstr2hex(data));
|
||||
}
|
||||
}
|
||||
|
||||
recFileLastTime = time;
|
||||
if (playing) { readNextBlock(processBlock); }
|
||||
}
|
||||
@ -202,10 +233,8 @@
|
||||
recFile = null;
|
||||
recFilePtr = 0;
|
||||
recFileMetadata = null;
|
||||
if (agentDesktop != null) {
|
||||
agentDesktop.Canvas.clearRect(0, 0, agentDesktop.CanvasId.width, agentDesktop.CanvasId.height);
|
||||
agentDesktop = null;
|
||||
}
|
||||
if (agentDesktop != null) { agentDesktop.Canvas.clearRect(0, 0, agentDesktop.CanvasId.width, agentDesktop.CanvasId.height); agentDesktop = null; }
|
||||
if (amtDesktop != null) { amtDesktop.canvas.clearRect(0, 0, amtDesktop.CanvasId.width, amtDesktop.CanvasId.height); amtDesktop = null; }
|
||||
readState = 0;
|
||||
waitTimerArgs = null;
|
||||
currentDeltaTimeTotalSec = 0;
|
||||
@ -328,8 +357,9 @@
|
||||
QE('PauseButton', false);
|
||||
QE('RestartButton', false);
|
||||
QS('progressbar').width = '0px';
|
||||
QH('timespan', '00:00:00')
|
||||
agentDesktop.Canvas.clearRect(0, 0, agentDesktop.CanvasId.width, agentDesktop.CanvasId.height);
|
||||
QH('timespan', '00:00:00');
|
||||
if (agentDesktop) { agentDesktop.Canvas.clearRect(0, 0, agentDesktop.CanvasId.width, agentDesktop.CanvasId.height); }
|
||||
if (amtDesktop) { amtDesktop.canvas.clearRect(0, 0, amtDesktop.CanvasId.width, amtDesktop.CanvasId.height); amtDesktop = CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange = deskAdjust; amtDesktop.State = 3; }
|
||||
}
|
||||
|
||||
function clearConsoleMsg() {
|
||||
|
@ -78,7 +78,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
|
||||
|
||||
obj.ProcessData = function (data) {
|
||||
if (!data) return;
|
||||
// obj.Debug("KRecv(" + data.length + "): " + rstr2hex(data));
|
||||
//obj.Debug("KRecv(" + data.length + "): " + rstr2hex(data));
|
||||
//obj.inbytes += data.length;
|
||||
//obj.Debug("KRecv(" + obj.inbytes + ")");
|
||||
obj.acc += data;
|
||||
@ -159,7 +159,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
|
||||
if (obj.bpp == 1) obj.send(String.fromCharCode(0, 0, 0, 0, 8, 8, 0, 1) + ShortToStr(7) + ShortToStr(7) + ShortToStr(3) + String.fromCharCode(5, 2, 0, 0, 0, 0)); // Setup 8 bit color RGB332
|
||||
|
||||
obj.state = 4;
|
||||
obj.parent.xxStateChange(3);
|
||||
if (obj.parent) { obj.parent.xxStateChange(3); }
|
||||
_SendRefresh();
|
||||
//obj.timer = setInterval(obj.xxOnTimer, 50);
|
||||
|
||||
@ -602,13 +602,13 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
|
||||
obj.Stop = function () {
|
||||
obj.UnGrabMouseInput();
|
||||
obj.UnGrabKeyInput();
|
||||
obj.parent.Stop();
|
||||
if (obj.parent) { obj.parent.Stop(); }
|
||||
}
|
||||
|
||||
obj.send = function (x) {
|
||||
//obj.Debug("KSend(" + x.length + "): " + rstr2hex(x));
|
||||
//obj.outbytes += x.length;
|
||||
obj.parent.send(x);
|
||||
if (obj.parent) { obj.parent.send(x); }
|
||||
}
|
||||
|
||||
var convertAmtKeyCodeTable = {
|
||||
|
Loading…
Reference in New Issue
Block a user