Fixed X11 detect, added browser full screen.

This commit is contained in:
Ylian Saint-Hilaire 2018-11-28 10:50:25 -08:00
parent d968fd8f0f
commit df88d564fa
7 changed files with 64 additions and 2192 deletions

View File

@ -36,11 +36,25 @@
<Compile Include="agents\modules_meshcore\amt-lme.js" /> <Compile Include="agents\modules_meshcore\amt-lme.js" />
<Compile Include="agents\modules_meshcore\amt-mei.js" /> <Compile Include="agents\modules_meshcore\amt-mei.js" />
<Compile Include="agents\modules_meshcore\amt-scanner.js" /> <Compile Include="agents\modules_meshcore\amt-scanner.js" />
<Compile Include="agents\modules_meshcore\amt-wsman-duk.js" />
<Compile Include="agents\modules_meshcore\amt-wsman.js" />
<Compile Include="agents\modules_meshcore\amt-xml.js" /> <Compile Include="agents\modules_meshcore\amt-xml.js" />
<Compile Include="agents\modules_meshcore\amt.js" />
<Compile Include="agents\modules_meshcore\linux-dbus.js" />
<Compile Include="agents\modules_meshcore\monitor-border.js" />
<Compile Include="agents\modules_meshcore\monitor-info.js" />
<Compile Include="agents\modules_meshcore\power-monitor.js" />
<Compile Include="agents\modules_meshcore\process-manager.js" />
<Compile Include="agents\modules_meshcore\promise.js" />
<Compile Include="agents\modules_meshcore\service-manager.js" />
<Compile Include="agents\modules_meshcore\smbios.js" /> <Compile Include="agents\modules_meshcore\smbios.js" />
<Compile Include="agents\modules_meshcore\toaster.js" />
<Compile Include="agents\modules_meshcore\user-sessions.js" /> <Compile Include="agents\modules_meshcore\user-sessions.js" />
<Compile Include="agents\modules_meshcore\wifi-scanner-windows.js" /> <Compile Include="agents\modules_meshcore\wifi-scanner-windows.js" />
<Compile Include="agents\modules_meshcore\wifi-scanner.js" /> <Compile Include="agents\modules_meshcore\wifi-scanner.js" />
<Compile Include="agents\modules_meshcore\win-console.js" />
<Compile Include="agents\modules_meshcore\win-message-pump.js" />
<Compile Include="agents\modules_meshcore\win-registry.js" />
<Compile Include="agents\testsuite.js" /> <Compile Include="agents\testsuite.js" />
<Compile Include="agents\tinycore.js" /> <Compile Include="agents\tinycore.js" />
<Compile Include="amtevents.js" /> <Compile Include="amtevents.js" />

View File

@ -19,6 +19,7 @@ process.on('uncaughtException', function (ex) {
require('MeshAgent').SendCommand({ "action": "msg", "type": "console", "value": "uncaughtException1: " + ex }); require('MeshAgent').SendCommand({ "action": "msg", "type": "console", "value": "uncaughtException1: " + ex });
}); });
// NOTE: This seems to cause big problems, don't enable the debugger in the server's meshcore.
//attachDebugger({ webport: 9999, wait: 1 }).then(function (prt) { console.log('Point Browser for Debug to port: ' + prt); }); //attachDebugger({ webport: 9999, wait: 1 }).then(function (prt) { console.log('Point Browser for Debug to port: ' + prt); });
// Mesh Rights // Mesh Rights

File diff suppressed because one or more lines are too long

View File

@ -44,24 +44,18 @@ function monitorinfo()
if (info._user32.EnumDisplayMonitors(0, 0, this._monitorinfo.callback, this._monitorinfo.dwData).Val == 0) { if (info._user32.EnumDisplayMonitors(0, 0, this._monitorinfo.callback, this._monitorinfo.dwData).Val == 0) {
rejector('LastError=' + info._kernel32.GetLastError().Val); rejector('LastError=' + info._kernel32.GetLastError().Val);
return; return;
} } else {
else {
resolver(this._monitorinfo.callback.results); resolver(this._monitorinfo.callback.results);
} }
})); }));
} }
} }
else if(process.platform == 'linux') else if (process.platform == 'linux')
{ {
// First thing we need to do, is determine where the X11 libraries are // First thing we need to do, is determine where the X11 libraries are
var askOS = false; var askOS = false;
try try { if (require('user-sessions').isRoot()) { askOS = true; } } catch (e) { }
{
if (require('user-sessions').isRoot()) { askOS = true; }
}
catch (e)
{ }
if (askOS) if (askOS)
{ {
@ -74,17 +68,15 @@ function monitorinfo()
var paths = p.stdout._lines.split('\n'); var paths = p.stdout._lines.split('\n');
var searchPath = ''; var searchPath = '';
for (var i in paths) for (var i in paths) {
{ if (paths[i].endsWith(':')) {
if (paths[i].endsWith(':'))
{
searchPath = paths[i].substring(0, paths[i].length - 1); searchPath = paths[i].substring(0, paths[i].length - 1);
} } else {
else try { // Added by Ylian: Try/catch to fix X11 detection, not sure if this is correct.
{ if (paths[i].split('libX11.').length > 1) { Object.defineProperty(this, 'Location_X11LIB', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); }
if (paths[i].split('libX11.').length > 1) { Object.defineProperty(this, 'Location_X11LIB', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); } if (paths[i].split('libXtst.').length > 1) { Object.defineProperty(this, 'Location_X11TST', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); }
if (paths[i].split('libXtst.').length > 1) { Object.defineProperty(this, 'Location_X11TST', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); } if (paths[i].split('libXext.').length > 1) { Object.defineProperty(this, 'Location_X11EXT', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); }
if (paths[i].split('libXext.').length > 1) { Object.defineProperty(this, 'Location_X11EXT', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); } } catch (ex) { }
} }
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.2.3-h", "version": "0.2.3-k",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",
@ -40,7 +40,6 @@
"multiparty": "^4.2.1", "multiparty": "^4.2.1",
"nedb": "^1.8.0", "nedb": "^1.8.0",
"node-forge": "^0.7.6", "node-forge": "^0.7.6",
"node-windows": "^0.1.14",
"ws": "^6.1.2", "ws": "^6.1.2",
"xmldom": "^0.1.27", "xmldom": "^0.1.27",
"yauzl": "^2.9.1" "yauzl": "^2.9.1"

File diff suppressed because one or more lines are too long

View File

@ -383,11 +383,11 @@
<div id=p10html2></div> <div id=p10html2></div>
<div id=p10html3></div> <div id=p10html3></div>
</div> </div>
<div id=p11 style=display:none> <div id=p11 class=noselect style=display:none>
<div id="p11title"> <div id="p11title">
<div id=p11deviceNameHeader> <div id=p11deviceNameHeader>
<div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div> <div style="float:left"><div class="backButton" onclick=goBack() title="Back"><div class="backButtonEx"></div></div></div>
<div style="float:right" id="devListToolbarViewIcons"><div class="viewSelector" onclick=deskToggleFull() title="Full Screen"><div class="viewSelector5"></div></div></div> <div style="float:right" id="devListToolbarViewIcons"><div class="viewSelector" onclick=deskToggleFull(event) title="Full Screen. Hold shift to browser full screen."><div class="viewSelector5"></div></div></div>
<h1>Desktop - <span id=p11deviceName></span></h1> <h1>Desktop - <span id=p11deviceName></span></h1>
</div> </div>
</div> </div>
@ -399,7 +399,7 @@
<div class=icon2 style="float:left;margin:7px"></div> <div class=icon2 style="float:left;margin:7px"></div>
<div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div> <div style='width:auto;border-radius:8px;padding:8px;background-color:lightsalmon'>Remote computer is not powered on, click here to issue a power command.</div>
</div> </div>
<table cellpadding=0 cellspacing=0 style="width:100%;padding:0px;padding:0px;margin-top:0px"> <table id=deskarea0 cellpadding=0 cellspacing=0 style="width:100%;padding:0px;padding:0px;margin-top:0px">
<tr id=deskarea1> <tr id=deskarea1>
<td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0"> <td style="padding-top:2px;padding-bottom:2px;background:#C0C0C0">
<div style="float:right;text-align:right"> <div style="float:right;text-align:right">
@ -409,11 +409,11 @@
<input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px;display:none"> <input id="deskFocusBtn" type="button" title="Toggle focus mode, when active only the region around the mouse is updated" onkeypress="return false" onkeydown="return false" value="Focus All" onclick="deskToggleFocus()" style="margin-right:3px;display:none">
<input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick=deskSaveImage() style=margin-right:3px> <input id="deskSaveBtn" type="button" title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value="Save..." onclick=deskSaveImage() style=margin-right:3px>
<input id="deskActionsBtn" type=button title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() style=margin-right:3px /> <input id="deskActionsBtn" type=button title="Perform power actions on the device" onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() style=margin-right:3px />
<input type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" style="margin-right:3px"> <input id="deskActionsSettings" type="button" value="Settings..." title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick="showDesktopSettings()" style="margin-right:3px">
<input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="margin-right:3px;display:none"> <input type="button" title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick="showPowerActionDlg()" style="margin-right:3px;display:none">
</div> </div>
<div> <div>
<div id="idx_deskFullBtn2" onclick=deskToggleFull() style="float:left;font-size:large;cursor:pointer;display:none">&nbsp;&#x2716;</div> <div id="idx_deskFullBtn2" onclick=deskToggleFull(event) style="float:left;font-size:large;cursor:pointer;display:none">&nbsp;&#x2716;</div>
<input type="button" id="autoconnectbutton1" value="AutoConnect" onclick=autoConnectDesktop(event) onkeypress="return false" onkeydown="return false" style="display:none"> <input type="button" id="autoconnectbutton1" value="AutoConnect" onclick=autoConnectDesktop(event) onkeypress="return false" onkeydown="return false" style="display:none">
<span id=connectbutton1span>&nbsp;<input type=button id=connectbutton1 value="Connect" onclick=connectDesktop(event,1) onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id=connectbutton1span>&nbsp;<input type=button id=connectbutton1 value="Connect" onclick=connectDesktop(event,1) onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id=connectbutton1hspan>&nbsp;<input type=button id=connectbutton1h value="HW Connect" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled"></span> <span id=connectbutton1hspan>&nbsp;<input type=button id=connectbutton1h value="HW Connect" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
@ -3688,9 +3688,11 @@
QE('deskkeys', deskState == 3); QE('deskkeys', deskState == 3);
QV('DeskToolsButton', meshrights & 8); QV('DeskToolsButton', meshrights & 8);
QE('DeskToolsButton', online); QE('DeskToolsButton', online);
QV('DeskToastButton', (currentNode.agent) && (currentNode.agent.id < 5) && (meshrights & 8)); QV('DeskToastButton', (currentNode.agent) && (currentNode.agent.id < 5) && (meshrights & 8) && (browserfullscreen == false));
QE('DeskToastButton', online); QE('DeskToastButton', online);
QV('DeskControlSpan', meshrights & 8) QV('DeskControlSpan', meshrights & 8)
QV('deskActionsBtn', (browserfullscreen == false));
QV('deskActionsSettings', (browserfullscreen == false));
if (meshrights & 8) { Q('DeskControl').checked = (getstore('DeskControl', 1) == 1); } else { Q('DeskControl').checked = false; } if (meshrights & 8) { Q('DeskControl').checked = (getstore('DeskControl', 1) == 1); } else { Q('DeskControl').checked = false; }
if (online == false) QV('DeskTools', false); if (online == false) QV('DeskTools', false);
} }
@ -3898,8 +3900,30 @@
QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus)); QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus));
} }
// Enter browser fullscreen
function enterBrowserFullscreen(elem) {
if (elem.requestFullscreen) { elem.requestFullscreen(); }
else if (elem.msRequestFullscreen) { elem.msRequestFullscreen(); }
else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); }
else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); }
}
// Exit browser fullscreen
function exitBrowserFullscreen() {
if (document.exitFullscreen) { document.exitFullscreen(); }
else if (document.msExitFullscreen) { document.msExitFullscreen(); }
else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); }
else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); }
}
// Return true if the browser is fullscreen. This is a delayed method that will return true/false late. Not very useful.
function isBrowserFullscreen() {
if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { return false; } else { return true; }
}
var fullscreen = false; var fullscreen = false;
function deskToggleFull() { var browserfullscreen = false;
function deskToggleFull(e) {
fullscreen = !fullscreen; fullscreen = !fullscreen;
QV('mastheadx', !fullscreen); QV('mastheadx', !fullscreen);
QV('masthead', !fullscreen); QV('masthead', !fullscreen);
@ -3911,6 +3935,8 @@
QV('deskFullBtn', !fullscreen); QV('deskFullBtn', !fullscreen);
QV('page_leftbar', !fullscreen); QV('page_leftbar', !fullscreen);
if (fullscreen) { if (fullscreen) {
// If shift is pressed, enter browser full screen.
if (e.shiftKey == true) { enterBrowserFullscreen(Q('deskarea0')); browserfullscreen = true; }
QS('column_l').width = '930px'; QS('column_l').width = '930px';
QS('column_l').height = ''; QS('column_l').height = '';
QS('column_l')['margin-left'] = ''; QS('column_l')['margin-left'] = '';
@ -3925,6 +3951,8 @@
QS('column_l').width = '100%'; QS('column_l').width = '100%';
QS('column_l')["max-height"] = ''; QS('column_l')["max-height"] = '';
} else { } else {
exitBrowserFullscreen();
browserfullscreen = false;
QS('container').width = '960px'; QS('container').width = '960px';
QS('container')['border-right'] = '1px solid #b7b7b7'; QS('container')['border-right'] = '1px solid #b7b7b7';
QS('container')['border-left'] = '1px solid #b7b7b7'; QS('container')['border-left'] = '1px solid #b7b7b7';
@ -3934,6 +3962,7 @@
} }
deskAdjust(); deskAdjust();
deskAdjust(); deskAdjust();
updateDesktopButtons();
} }
function deskToggleFocus() { function deskToggleFocus() {