Code cleanup.

This commit is contained in:
Ylian Saint-Hilaire 2020-06-15 16:37:02 -07:00
parent 829c09aec0
commit 74c2234a45
15 changed files with 802 additions and 802 deletions

View File

@ -769,11 +769,11 @@ function run(argv) {
7 = Hibernate 7 = Hibernate
8 = Power Off - Soft 8 = Power Off - Soft
9 = Power Cycle (Off Hard) 9 = Power Cycle (Off Hard)
10 = Master Bus Reset 10 = Main Bus Reset
11 = Diagnostic Interrupt (NMI) 11 = Diagnostic Interrupt (NMI)
12 = Power Off - Soft Graceful 12 = Power Off - Soft Graceful
13 = Power Off - Hard Graceful 13 = Power Off - Hard Graceful
14 = Master Bus Reset Graceful 14 = Main Bus Reset Graceful
15 = Power Cycle (Off - Soft Graceful) 15 = Power Cycle (Off - Soft Graceful)
16 = Power Cycle (Off - Hard Graceful) 16 = Power Cycle (Off - Hard Graceful)
*/ */
@ -2869,7 +2869,7 @@ function performAmtPowerActionEx(stack, name, response, status) {
} }
} }
var DMTFPowerStates = ['', '', "Power on", "Light sleep", "Deep sleep", "Power cycle (Soft off)", "Off - Hard", "Hibernate (Off soft)", "Soft off", "Power cycle (Off-hard)", "Master bus reset", "Diagnostic interrupt (NMI)", "Not applicable", "Off - Soft graceful", "Off - Hard graceful", "Master bus reset graceful", "Power cycle (Off - Soft graceful)", "Power cycle (Off - Hard graceful)", "Diagnostic interrupt (INIT)"]; var DMTFPowerStates = ['', '', "Power on", "Light sleep", "Deep sleep", "Power cycle (Soft off)", "Off - Hard", "Hibernate (Off soft)", "Soft off", "Power cycle (Off-hard)", "Main bus reset", "Diagnostic interrupt (NMI)", "Not applicable", "Off - Soft graceful", "Off - Hard graceful", "Main bus reset graceful", "Power cycle (Off - Soft graceful)", "Power cycle (Off - Hard graceful)", "Diagnostic interrupt (INIT)"];
function performAmtPowerActionEx2(stack, name, response, status) { function performAmtPowerActionEx2(stack, name, response, status) {
if (status == 200) { if (status == 200) {
var powerNumber = parseInt(response.Body.PowerState); var powerNumber = parseInt(response.Body.PowerState);

View File

@ -613,7 +613,7 @@ function AmtStackCreateService(wsmanStack) {
1611: 'TLS Trusted Root Certificate Removed', 1611: 'TLS Trusted Root Certificate Removed',
1612: 'TLS Preshared Key Set', 1612: 'TLS Preshared Key Set',
1613: 'Kerberos Settings Modified', 1613: 'Kerberos Settings Modified',
1614: 'Kerberos Master Key Modified', 1614: 'Kerberos Main Key Modified',
1615: 'Flash Wear out Counters Reset', 1615: 'Flash Wear out Counters Reset',
1616: 'Power Package Modified', 1616: 'Power Package Modified',
1617: 'Set Realm Authentication Mode', 1617: 'Set Realm Authentication Mode',

View File

@ -613,7 +613,7 @@ function AmtStackCreateService(wsmanStack) {
1611: 'TLS Trusted Root Certificate Removed', 1611: 'TLS Trusted Root Certificate Removed',
1612: 'TLS Preshared Key Set', 1612: 'TLS Preshared Key Set',
1613: 'Kerberos Settings Modified', 1613: 'Kerberos Settings Modified',
1614: 'Kerberos Master Key Modified', 1614: 'Kerberos Main Key Modified',
1615: 'Flash Wear out Counters Reset', 1615: 'Flash Wear out Counters Reset',
1616: 'Power Package Modified', 1616: 'Power Package Modified',
1617: 'Set Realm Authentication Mode', 1617: 'Set Realm Authentication Mode',

View File

@ -50,12 +50,12 @@ function WiFiScanner()
{ {
if (process.platform == 'win32') if (process.platform == 'win32')
{ {
this.master = require('ScriptContainer').Create(15, ContainerPermissions.DEFAULT); this.main = require('ScriptContainer').Create(15, ContainerPermissions.DEFAULT);
this.master.parent = this; this.main.parent = this;
this.master.on('data', function (j) { this.parent.emit('accessPoint', new AccessPoint(j.ssid, j.bssid, j.lq)); }); this.main.on('data', function (j) { this.parent.emit('accessPoint', new AccessPoint(j.ssid, j.bssid, j.lq)); });
this.master.addModule('wifi-scanner-windows', getJSModule('wifi-scanner-windows')); this.main.addModule('wifi-scanner-windows', getJSModule('wifi-scanner-windows'));
this.master.ExecuteString(WindowsChildScript); this.main.ExecuteString(WindowsChildScript);
} }
else if (process.platform == 'linux') else if (process.platform == 'linux')
{ {

View File

@ -618,7 +618,7 @@ function AmtStackCreateService(wsmanStack) {
1611: 'TLS Trusted Root Certificate Removed', 1611: 'TLS Trusted Root Certificate Removed',
1612: 'TLS Preshared Key Set', 1612: 'TLS Preshared Key Set',
1613: 'Kerberos Settings Modified', 1613: 'Kerberos Settings Modified',
1614: 'Kerberos Master Key Modified', 1614: 'Kerberos Main Key Modified',
1615: 'Flash Wear out Counters Reset', 1615: 'Flash Wear out Counters Reset',
1616: 'Power Package Modified', 1616: 'Power Package Modified',
1617: 'Set Realm Authentication Mode', 1617: 'Set Realm Authentication Mode',

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -584,7 +584,7 @@ function AmtStackCreateService(wsmanStack) {
1611: 'TLS Trusted Root Certificate Removed', 1611: 'TLS Trusted Root Certificate Removed',
1612: 'TLS Preshared Key Set', 1612: 'TLS Preshared Key Set',
1613: 'Kerberos Settings Modified', 1613: 'Kerberos Settings Modified',
1614: 'Kerberos Master Key Modified', 1614: 'Kerberos Main Key Modified',
1615: 'Flash Wear out Counters Reset', 1615: 'Flash Wear out Counters Reset',
1616: 'Power Package Modified', 1616: 'Power Package Modified',
1617: 'Set Realm Authentication Mode', 1617: 'Set Realm Authentication Mode',

File diff suppressed because one or more lines are too long

View File

@ -455,7 +455,6 @@ body {
color: white; color: white;
} }
/* Support for new footer made with div (like masterhead) */
.footer1 { .footer1 {
text-align: left; text-align: left;
float: left; float: left;

View File

@ -88,7 +88,7 @@
<div class="areaProgress"><div id="progressbar" style="background-color:blue"></div></div> <div class="areaProgress"><div id="progressbar" style="background-color:blue"></div></div>
</div> </div>
<div id=deskarea3x style="max-height:calc(100vh - 82px);height:calc(100vh - 54px);background-color:gray"> <div id=deskarea3x style="max-height:calc(100vh - 82px);height:calc(100vh - 54px);background-color:gray">
<div id="masterListArea" style="height:calc(33.33vh);overflow-y:scroll"> <div id="mainListArea" style="height:calc(33.33vh);overflow-y:scroll">
<div class="listItem"><div style="display:inline-block;width:calc(40% - 10px)"></div><div style="display:inline-block;width:calc(40% - 10px)"></div><div style="display:inline-block;width:calc(20% - 10px)"></div></div> <div class="listItem"><div style="display:inline-block;width:calc(40% - 10px)"></div><div style="display:inline-block;width:calc(40% - 10px)"></div><div style="display:inline-block;width:calc(20% - 10px)"></div></div>
</div> </div>
<textarea id="defaultTextArea" autocomplete=off readonly style="height:calc(28.33vh);overflow-y:scroll;width:calc(100% - 5px);resize:none;background-color:#EFE"></textarea> <textarea id="defaultTextArea" autocomplete=off readonly style="height:calc(28.33vh);overflow-y:scroll;width:calc(100% - 5px);resize:none;background-color:#EFE"></textarea>
@ -139,7 +139,7 @@
document.ondragover = ondragover; document.ondragover = ondragover;
document.ondragleave = ondragleave; document.ondragleave = ondragleave;
document.onkeypress = onkeypress; document.onkeypress = onkeypress;
updateMasterList(); updateMainList();
loadServerTranslations(); loadServerTranslations();
QE('SaveServerButton', false); QE('SaveServerButton', false);
} }
@ -152,14 +152,14 @@
function langSelectorChange() { function langSelectorChange() {
selectedLanguage = Q('langSelector').value; selectedLanguage = Q('langSelector').value;
updateMasterList(); updateMainList();
onSearchChanged(true); onSearchChanged(true);
select(0, true, false); select(0, true, false);
} }
function cleanup() { function cleanup() {
translationFile = null; translationFile = null;
updateMasterList(); updateMainList();
Q('searchInput').value = ''; Q('searchInput').value = '';
currentSearchFilter = ''; currentSearchFilter = '';
} }
@ -236,14 +236,14 @@
translations.sort(enSort); translations.sort(enSort);
Q('searchInput').value = ''; Q('searchInput').value = '';
currentSearchFilter = ''; currentSearchFilter = '';
updateMasterList(); updateMainList();
select(0, true); select(0, true);
} }
}; };
fr.readAsText(translationFile); fr.readAsText(translationFile);
} }
function updateMasterList() { function updateMainList() {
var x = []; var x = [];
if (translations != null) { if (translations != null) {
//console.log(translations); //console.log(translations);
@ -256,7 +256,7 @@
x.push('<div class="listItem" id=nx' + i + ' onclick=select(' + i + ')><div id=ns' + i + ' style="display:inline-block;width:calc(40% - 10px)">' + source + '</div><div id=nt' + i + ' style="display:inline-block;width:calc(40% - 10px)">' + target + '</div><div id=nc' + i + ' style="display:inline-block;width:calc(20% - 10px)">' + comment + '</div></div>'); x.push('<div class="listItem" id=nx' + i + ' onclick=select(' + i + ')><div id=ns' + i + ' style="display:inline-block;width:calc(40% - 10px)">' + source + '</div><div id=nt' + i + ' style="display:inline-block;width:calc(40% - 10px)">' + target + '</div><div id=nc' + i + ' style="display:inline-block;width:calc(20% - 10px)">' + comment + '</div></div>');
} }
} }
QH('masterListArea', x.join('')); QH('mainListArea', x.join(''));
updateButtons(); updateButtons();
onSearchChanged(true); onSearchChanged(true);
} }
@ -271,9 +271,9 @@
Q('nx' + selectedItem).classList.remove('listItem'); Q('nx' + selectedItem).classList.remove('listItem');
Q('nx' + selectedItem).classList.add('listItemSel'); Q('nx' + selectedItem).classList.add('listItemSel');
if (scroll === true) { if (scroll === true) {
var x = (Q('masterListArea').clientHeight / 2) - (Q('nx' + selectedItem).clientHeight / 2); var x = (Q('mainListArea').clientHeight / 2) - (Q('nx' + selectedItem).clientHeight / 2);
if (x < 0) { x = 0; } if (x < 0) { x = 0; }
Q('masterListArea').scrollTop = Q('nx' + selectedItem).offsetTop - x; Q('mainListArea').scrollTop = Q('nx' + selectedItem).offsetTop - x;
} }
onLocChanged(); onLocChanged();
if (translations[i][selectedLanguage] != null) { if (translations[i][selectedLanguage] != null) {
@ -355,7 +355,7 @@
translations.sort(enSort); translations.sort(enSort);
Q('searchInput').value = ''; Q('searchInput').value = '';
currentSearchFilter = ''; currentSearchFilter = '';
updateMasterList(); updateMainList();
select(0, true); select(0, true);
}; };
xdr.onerror = function () { xdr.onerror = function () {

View File

@ -76,7 +76,7 @@ module.exports.CreateSwarmServer = function (parent, db, args, certificates) {
APPREQACK: 46, // Used to request an ack message. APPREQACK: 46, // Used to request an ack message.
APPACK: 47, // Used to ack a received message. APPACK: 47, // Used to ack a received message.
SERVERECHO: 48, // Server will echo this message, used for testing. SERVERECHO: 48, // Server will echo this message, used for testing.
KVMINFO: 49, // Used to send local KVM slave process information to mesh agent. KVMINFO: 49, // Used to send local KVM secondary process information to mesh agent.
REMOTEWAKE: 50, // Used to send remote wake information to server. REMOTEWAKE: 50, // Used to send remote wake information to server.
NEWCONNECTTOKEN: 51, // Used to send a new connection token to the Swarm Server. NEWCONNECTTOKEN: 51, // Used to send a new connection token to the Swarm Server.
WIFISCAN: 52, // Used to send visible WIFI AP's to the server. WIFISCAN: 52, // Used to send visible WIFI AP's to the server.

View File

@ -933,7 +933,7 @@
for (var i in message.ugroups) { groupCount++; } for (var i in message.ugroups) { groupCount++; }
if (groupCount == 0) { usergroups = null; } if (groupCount == 0) { usergroups = null; }
} }
//masterUpdate(8192); //mainUpdate(8192);
break; break;
} }
case 'files': { case 'files': {
@ -1104,7 +1104,7 @@
ugroup.desc = message.event.desc; ugroup.desc = message.event.desc;
ugroup.links = message.event.links; ugroup.links = message.event.links;
} }
//masterUpdate(8192 + 16384); //mainUpdate(8192 + 16384);
// Group update, refresh all our device groups and nodes. TODO: Optimize this to only do this when needed. // Group update, refresh all our device groups and nodes. TODO: Optimize this to only do this when needed.
meshserver.send({ action: 'meshes' }); meshserver.send({ action: 'meshes' });
@ -1118,7 +1118,7 @@
var c = 0; var c = 0;
for (var i in usergroups) { c++; } for (var i in usergroups) { c++; }
if (c == 0) { usergroups = null; } // If user groups is empty, set it to null. if (c == 0) { usergroups = null; } // If user groups is empty, set it to null.
//masterUpdate(8192 + 16384); //mainUpdate(8192 + 16384);
} }
break; break;
} }
@ -1315,7 +1315,7 @@
nodes.push(node); nodes.push(node);
// Web page update // Web page update
//masterUpdate(1 | 2 | 4 | 16); //mainUpdate(1 | 2 | 4 | 16);
updateDevices(); updateDevices();
} }
break; break;
@ -1371,7 +1371,7 @@
updateDevices(); updateDevices();
refreshDevice(message.event.nodeid); refreshDevice(message.event.nodeid);
//masterUpdate(4); //mainUpdate(4);
//if ((currentNode != null) && (currentNode._id == message.event.nodeid)) { gotoDevice(currentNode._id, xxcurrentView, true); } //if ((currentNode != null) && (currentNode._id == message.event.nodeid)) { gotoDevice(currentNode._id, xxcurrentView, true); }
// If we are looking at the sessions dialog box for this device now, update it // If we are looking at the sessions dialog box for this device now, update it

View File

@ -263,7 +263,7 @@
</div> </div>
<div style="display:none" id=devListToolbarSort> <div style="display:none" id=devListToolbarSort>
Sort Sort
<select id=sortselect onchange=masterUpdate(6)> <select id=sortselect onchange=mainUpdate(6)>
<option>Group</option> <option>Group</option>
<option>Power</option> <option>Power</option>
<option>Device</option> <option>Device</option>
@ -1329,10 +1329,10 @@
window.addEventListener('blur', ondocblur, false); window.addEventListener('blur', ondocblur, false);
window.onresize = function () { window.onresize = function () {
hideContextMenu(); hideContextMenu();
masterUpdate(512); mainUpdate(512);
if ((xtermfit != null) && (xxcurrentView == 12)) { xtermfit.fit(); } if ((xtermfit != null) && (xxcurrentView == 12)) { xtermfit.fit(); }
} }
setTimeout(function() { masterUpdate(512); }, 200); setTimeout(function() { mainUpdate(512); }, 200);
// Connect to the mesh server // Connect to the mesh server
meshserver = MeshServerCreateControl(domainUrl, authCookie); meshserver = MeshServerCreateControl(domainUrl, authCookie);
@ -1353,7 +1353,7 @@
QV('accountChangeEmailAddressSpan', (features & 0x200000) == 0); QV('accountChangeEmailAddressSpan', (features & 0x200000) == 0);
// Display the page devices // Display the page devices
masterUpdate(3) mainUpdate(3)
for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); } for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); }
Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel'); Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
@ -1713,7 +1713,7 @@
if (xxcurrentView >= 10) QC('column_l').remove('room4submenu'); if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen); QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen);
} }
masterUpdate(512); mainUpdate(512);
QV('body', true); QV('body', true);
} }
@ -1805,7 +1805,7 @@
// We are not user administrator // We are not user administrator
users = null; users = null;
wssessions = null; wssessions = null;
masterUpdate(16384); mainUpdate(16384);
if (xxcurrentView == 4 || ((xxcurrentView >= 30) && (xxcurrentView < 40))) { setDialogMode(0); go(1); currentUser = null; } if (xxcurrentView == 4 || ((xxcurrentView >= 30) && (xxcurrentView < 40))) { setDialogMode(0); go(1); currentUser = null; }
} }
meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) }); meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) });
@ -1821,7 +1821,7 @@
// To boost the speed of the web page when even floods occur, this method perform a delayed update on the web page. // To boost the speed of the web page when even floods occur, this method perform a delayed update on the web page.
var updateNaggleTimer = null; var updateNaggleTimer = null;
var updateNaggleFlags = 0; var updateNaggleFlags = 0;
function masterUpdate(flags) { function mainUpdate(flags) {
updateNaggleFlags |= flags; updateNaggleFlags |= flags;
if (updateNaggleTimer == null) { if (updateNaggleTimer == null) {
updateNaggleTimer = setTimeout(function () { updateNaggleTimer = setTimeout(function () {
@ -1870,7 +1870,7 @@
QV('authAppSetupCheck', userinfo.otpsecret == 1); QV('authAppSetupCheck', userinfo.otpsecret == 1);
QV('authKeySetupCheck', userinfo.otphkeys > 0); QV('authKeySetupCheck', userinfo.otphkeys > 0);
QV('authCodesSetupCheck', userinfo.otpkeys > 0); QV('authCodesSetupCheck', userinfo.otpkeys > 0);
masterUpdate(4 + 128 + 4096); mainUpdate(4 + 128 + 4096);
// Check if none or at least 2 factors are enabled. // Check if none or at least 2 factors are enabled.
if ((backupCodesWarningDone == false) && (authFactorCount == 1)) { if ((backupCodesWarningDone == false) && (authFactorCount == 1)) {
@ -1981,20 +1981,20 @@
users = {}; users = {};
for (var m in message.users) { users[message.users[m]._id] = message.users[m]; } for (var m in message.users) { users[message.users[m]._id] = message.users[m]; }
if (currentUser != null) { currentUser = users[currentUser._id]; } if (currentUser != null) { currentUser = users[currentUser._id]; }
masterUpdate(16384); mainUpdate(16384);
updateSelf(); updateSelf();
break; break;
} }
case 'wssessioncount': { case 'wssessioncount': {
wssessions = message.wssessions; wssessions = message.wssessions;
masterUpdate(16384); mainUpdate(16384);
break; break;
} }
case 'meshes': { case 'meshes': {
meshes = {}; meshes = {};
for (var m in message.meshes) { meshes[message.meshes[m]._id] = message.meshes[m]; } for (var m in message.meshes) { meshes[message.meshes[m]._id] = message.meshes[m]; }
if (currentMesh != null) { currentMesh = meshes[currentMesh._id]; } if (currentMesh != null) { currentMesh = meshes[currentMesh._id]; }
masterUpdate(4 + 128); mainUpdate(4 + 128);
break; break;
} }
case 'usergroups': { case 'usergroups': {
@ -2008,7 +2008,7 @@
for (var i in message.ugroups) { groupCount++; message.ugroups[i]._id = i; } for (var i in message.ugroups) { groupCount++; message.ugroups[i]._id = i; }
if (groupCount == 0) { usergroups = null; } if (groupCount == 0) { usergroups = null; }
} }
masterUpdate(8192); mainUpdate(8192);
break; break;
} }
case 'files': { case 'files': {
@ -2039,7 +2039,7 @@
// Change the reference to the current node // Change the reference to the current node
if (currentNode != null) { currentNode = getNodeFromId(currentNode._id); if (currentNode != null) { gotoDevice(currentNode._id, xxcurrentView, true); } else { go(1); } } if (currentNode != null) { currentNode = getNodeFromId(currentNode._id); if (currentNode != null) { gotoDevice(currentNode._id, xxcurrentView, true); } else { go(1); } }
masterUpdate(1 | 2 | 4 | 64); mainUpdate(1 | 2 | 4 | 64);
break; break;
} }
case 'powertimeline': { case 'powertimeline': {
@ -2048,7 +2048,7 @@
powerTimeline = message.timeline; powerTimeline = message.timeline;
powerTimelineUpdate = Date.now() + 300000; // Update every 5 minutes powerTimelineUpdate = Date.now() + 300000; // Update every 5 minutes
for (var i in powerTimeline) { if (i % 2 == 1) { powerTimeline[i] = powerTimeline[i] * 1000; } } // Decompress time for (var i in powerTimeline) { if (i % 2 == 1) { powerTimeline[i] = powerTimeline[i] * 1000; } } // Decompress time
if (currentNode._id == message.nodeid) { masterUpdate(256); } if (currentNode._id == message.nodeid) { mainUpdate(256); }
break; break;
} }
case 'getsysinfo': { case 'getsysinfo': {
@ -2213,13 +2213,13 @@
case 'events': { case 'events': {
if ((message.nodeid != null) && (currentNode != null) && (message.nodeid == currentNode._id)) { if ((message.nodeid != null) && (currentNode != null) && (message.nodeid == currentNode._id)) {
currentDeviceEvents = message.events; currentDeviceEvents = message.events;
masterUpdate(1024); mainUpdate(1024);
} else if ((message.user != null) && (message.user == currentUser.name)) { } else if ((message.user != null) && (message.user == currentUser.name)) {
currentUserEvents = message.events; currentUserEvents = message.events;
masterUpdate(2048); mainUpdate(2048);
} else { } else {
events = message.events; events = message.events;
masterUpdate(32); mainUpdate(32);
} }
break; break;
} }
@ -2405,7 +2405,7 @@
currentDeviceEvents.unshift(message.event); currentDeviceEvents.unshift(message.event);
var eventLimit = parseInt(p16limitdropdown.value); var eventLimit = parseInt(p16limitdropdown.value);
while (currentDeviceEvents.length > eventLimit) { currentDeviceEvents.pop(); } // Remove element(s) at the end while (currentDeviceEvents.length > eventLimit) { currentDeviceEvents.pop(); } // Remove element(s) at the end
masterUpdate(1024); mainUpdate(1024);
} }
if (currentUser && (message.event.userid == currentUser._id)) { if (currentUser && (message.event.userid == currentUser._id)) {
@ -2413,14 +2413,14 @@
currentUserEvents.unshift(message.event); currentUserEvents.unshift(message.event);
var eventLimit = parseInt(p31limitdropdown.value); var eventLimit = parseInt(p31limitdropdown.value);
while (currentUserEvents.length > eventLimit) { currentUserEvents.pop(); } // Remove element(s) at the end while (currentUserEvents.length > eventLimit) { currentUserEvents.pop(); } // Remove element(s) at the end
masterUpdate(2048); mainUpdate(2048);
} }
// Add this event to the master events log. // Add this event to the main events log.
events.unshift(message.event); events.unshift(message.event);
var eventLimit = parseInt(p3limitdropdown.value); var eventLimit = parseInt(p3limitdropdown.value);
while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end while (events.length > eventLimit) { events.pop(); } // Remove element(s) at the end
masterUpdate(32); mainUpdate(32);
} }
if (message.event.noact) break; // Take no action on this event if (message.event.noact) break; // Take no action on this event
switch (message.event.action) { switch (message.event.action) {
@ -2444,10 +2444,10 @@
// Update the web page // Update the web page
if ((webstate.deskAspectRatio != null) && (webstate.deskAspectRatio != deskAspectRatio)) { deskAspectRatio = webstate.deskAspectRatio; deskAdjust(); } if ((webstate.deskAspectRatio != null) && (webstate.deskAspectRatio != deskAspectRatio)) { deskAspectRatio = webstate.deskAspectRatio; deskAdjust(); }
if ((webstate.showRealNames != null) && (webstate.showRealNames != oldShowRealNames)) { showRealNames = Q('RealNameCheckBox').checked = (webstate.showRealNames == '1'); masterUpdate(6); } if ((webstate.showRealNames != null) && (webstate.showRealNames != oldShowRealNames)) { showRealNames = Q('RealNameCheckBox').checked = (webstate.showRealNames == '1'); mainUpdate(6); }
if ((webstate.uiMode != null) && (webstate.uiMode != oldUiMode)) { userInterfaceSelectMenu(parseInt(webstate.uiMode)); } if ((webstate.uiMode != null) && (webstate.uiMode != oldUiMode)) { userInterfaceSelectMenu(parseInt(webstate.uiMode)); }
if ((webstate.sort != null) && (webstate.sort != oldSort)) { document.getElementById('sortselect').selectedIndex = sort = parseInt(webstate.sort); masterUpdate(6); } if ((webstate.sort != null) && (webstate.sort != oldSort)) { document.getElementById('sortselect').selectedIndex = sort = parseInt(webstate.sort); mainUpdate(6); }
if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) { if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; } masterUpdate(0xFFFFFFFF); } if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) { if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; } mainUpdate(0xFFFFFFFF); }
if ((webstate.nightMode != null) && (webstate.nightMode != oldNightMode)) { nightMode = (webstate.nightMode == '1'); if (nightMode) { QC('body').add('night'); QS('body')['background-color'] = '#000'; } else { QC('body').remove('night'); QS('body')['background-color'] = '#d3d9d6'; } } if ((webstate.nightMode != null) && (webstate.nightMode != oldNightMode)) { nightMode = (webstate.nightMode == '1'); if (nightMode) { QC('body').add('night'); QS('body')['background-color'] = '#000'; } else { QC('body').remove('night'); QS('body')['background-color'] = '#d3d9d6'; } }
if ((webstate.footerBar != null) && (webstate.footerBar != oldFooterBar)) { footerBar = (webstate.footerBar == '1'); QS('container')['grid-template-rows'] = null; QS('container')['-ms-grid-rows'] = null; adjustPanels(); } if ((webstate.footerBar != null) && (webstate.footerBar != oldFooterBar)) { footerBar = (webstate.footerBar == '1'); QS('container')['grid-template-rows'] = null; QS('container')['-ms-grid-rows'] = null; adjustPanels(); }
} }
@ -2491,14 +2491,14 @@
delete users[message.event.account._id]; // No longer part of our groups, remove this user. delete users[message.event.account._id]; // No longer part of our groups, remove this user.
} }
masterUpdate(4 | 16384); mainUpdate(4 | 16384);
break; break;
} }
case 'accountremove': { case 'accountremove': {
// An account was removed // An account was removed
if (users == null) break; if (users == null) break;
delete users[message.event.userid]; delete users[message.event.userid];
masterUpdate(16384); mainUpdate(16384);
break; break;
} }
case 'createusergroup': case 'createusergroup':
@ -2515,7 +2515,7 @@
if (message.event.desc) { ugroup.desc = message.event.desc; } else { delete ugroup.desc; } if (message.event.desc) { ugroup.desc = message.event.desc; } else { delete ugroup.desc; }
if (message.event.links) { ugroup.links = message.event.links; } else { delete ugroup.links; } if (message.event.links) { ugroup.links = message.event.links; } else { delete ugroup.links; }
} }
masterUpdate(4096 + 8192 + 16384); mainUpdate(4096 + 8192 + 16384);
// Group update, refresh all our device groups and nodes. TODO: Optimize this to only do this when needed. // Group update, refresh all our device groups and nodes. TODO: Optimize this to only do this when needed.
meshserver.send({ action: 'meshes' }); meshserver.send({ action: 'meshes' });
@ -2529,7 +2529,7 @@
var c = 0; var c = 0;
for (var i in usergroups) { c++; } for (var i in usergroups) { c++; }
if (c == 0) { usergroups = null; } // If user groups is empty, set it to null. if (c == 0) { usergroups = null; } // If user groups is empty, set it to null.
masterUpdate(8192 + 16384); mainUpdate(8192 + 16384);
} }
break; break;
} }
@ -2537,7 +2537,7 @@
// A new mesh was created // A new mesh was created
if ((meshes[message.event.meshid] == null) && ((serverinfo.manageAllDeviceGroups) || (message.event.links[userinfo._id] != null))) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some. if ((meshes[message.event.meshid] == null) && ((serverinfo.manageAllDeviceGroups) || (message.event.links[userinfo._id] != null))) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some.
meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links }; meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links };
masterUpdate(4 + 128 + 8192 + 16384); mainUpdate(4 + 128 + 8192 + 16384);
meshserver.send({ action: 'files' }); meshserver.send({ action: 'files' });
} }
break; break;
@ -2583,19 +2583,19 @@
if ((xxcurrentView >= 10) && (xxcurrentView < 20) && currentNode && !IsNodeViewable(currentNode)) { setDialogMode(0); go(1); } if ((xxcurrentView >= 10) && (xxcurrentView < 20) && currentNode && !IsNodeViewable(currentNode)) { setDialogMode(0); go(1); }
} }
} }
masterUpdate(4 + 128 + 8192 + 16384); mainUpdate(4 + 128 + 8192 + 16384);
if (currentNode && !IsNodeViewable(currentNode)) { currentNode = null; if ((xxcurrentView >= 10) && (xxcurrentView < 20)) { go(1); } } if (currentNode && !IsNodeViewable(currentNode)) { currentNode = null; if ((xxcurrentView >= 10) && (xxcurrentView < 20)) { go(1); } }
//meshserver.send({ action: 'files' }); // TODO: Why do we need to do this?? //meshserver.send({ action: 'files' }); // TODO: Why do we need to do this??
// If we are looking at a mesh that is now deleted, move back to "My Account" // If we are looking at a mesh that is now deleted, move back to "My Account"
if (xxcurrentView == 20 && currentMesh._id == message.event.meshid) { masterUpdate(4096); } if (xxcurrentView == 20 && currentMesh._id == message.event.meshid) { mainUpdate(4096); }
break; break;
} }
case 'deletemesh': { case 'deletemesh': {
// Delete the mesh // Delete the mesh
if (meshes[message.event.meshid]) { if (meshes[message.event.meshid]) {
delete meshes[message.event.meshid]; delete meshes[message.event.meshid];
masterUpdate(128); mainUpdate(128);
meshserver.send({ action: 'files' }); meshserver.send({ action: 'files' });
} }
@ -2603,7 +2603,7 @@
var newnodes = []; var newnodes = [];
if (nodes != null) { for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } } } if (nodes != null) { for (var i in nodes) { if (nodes[i].meshid != message.event.meshid) { newnodes.push(nodes[i]); } } }
nodes = newnodes; nodes = newnodes;
masterUpdate(4 + 8192 + 16384); mainUpdate(4 + 8192 + 16384);
// If we are looking at a mesh that is now deleted, move back to "My Account" // If we are looking at a mesh that is now deleted, move back to "My Account"
if (xxcurrentView >= 20 && xxcurrentView < 30 && currentMesh._id == message.event.meshid) { setDialogMode(0); go(2); } if (xxcurrentView >= 20 && xxcurrentView < 30 && currentMesh._id == message.event.meshid) { setDialogMode(0); go(2); }
@ -2625,7 +2625,7 @@
nodes.push(node); nodes.push(node);
// Web page update // Web page update
masterUpdate(1 | 2 | 4 | 16); mainUpdate(1 | 2 | 4 | 16);
break; break;
} }
@ -2642,7 +2642,7 @@
nodes.splice(index, 1); nodes.splice(index, 1);
// Web page update // Web page update
masterUpdate(4 | 16); mainUpdate(4 | 16);
} }
break; break;
} }
@ -2695,7 +2695,7 @@
if (message.event.node.icon) { node.icon = message.event.node.icon; } if (message.event.node.icon) { node.icon = message.event.node.icon; }
// Web page update // Web page update
masterUpdate(2 | 4 | 8 | 16); mainUpdate(2 | 4 | 8 | 16);
refreshDevice(node._id); refreshDevice(node._id);
if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); } if ((currentNode == node) && (xxdialogMode != null) && (xxdialogTag == '@xxmap')) { p10showNodeLocationDialog(); }
@ -2713,12 +2713,12 @@
// TODO: Correctly disconnect from this node (Desktop/Terminal/Files...) // TODO: Correctly disconnect from this node (Desktop/Terminal/Files...)
if ((xxcurrentView >= 10) && (xxcurrentView < 20) && !IsNodeViewable(currentNode)) { currentNode = null; setDialogMode(0); go(1); } if ((xxcurrentView >= 10) && (xxcurrentView < 20) && !IsNodeViewable(currentNode)) { currentNode = null; setDialogMode(0); go(1); }
nodes.splice(index, 1); nodes.splice(index, 1);
masterUpdate(4 | 16); mainUpdate(4 | 16);
} else { } else {
// We see the new mesh, move this device // We see the new mesh, move this device
node.meshid = message.event.newMeshId; node.meshid = message.event.newMeshId;
node.meshnamel = meshes[message.event.newMeshId]?meshes[message.event.newMeshId].name.toLowerCase():'*'; node.meshnamel = meshes[message.event.newMeshId]?meshes[message.event.newMeshId].name.toLowerCase():'*';
masterUpdate(1 | 2 | 4); mainUpdate(1 | 2 | 4);
} }
refreshDevice(message.event.nodeid); refreshDevice(message.event.nodeid);
} else { } else {
@ -2735,7 +2735,7 @@
nodes.push(node); nodes.push(node);
// Web page update // Web page update
masterUpdate(1 | 2 | 4 | 16); mainUpdate(1 | 2 | 4 | 16);
} }
break; break;
} }
@ -2779,7 +2779,7 @@
if ((node.conn & 1) == 0) { delete node.sessions; } if ((node.conn & 1) == 0) { delete node.sessions; }
// Web page update // Web page update
masterUpdate(1 | 4 | 16); mainUpdate(1 | 4 | 16);
refreshDevice(node._id); refreshDevice(node._id);
} }
break; break;
@ -2792,7 +2792,7 @@
} else { } else {
wssessions[message.event.userid] = message.event.count; wssessions[message.event.userid] = message.event.count;
} }
masterUpdate(16384); mainUpdate(16384);
} }
break; break;
} }
@ -2865,7 +2865,7 @@
for (var i in node.sessions) { if (Object.keys(node.sessions[i]).length == 0) { delete node.sessions[i]; } } for (var i in node.sessions) { if (Object.keys(node.sessions[i]).length == 0) { delete node.sessions[i]; } }
if (Object.keys(node.sessions).length == 0) { delete node.sessions; } if (Object.keys(node.sessions).length == 0) { delete node.sessions; }
} }
masterUpdate(4); mainUpdate(4);
if ((currentNode != null) && (currentNode._id == message.event.nodeid)) { gotoDevice(currentNode._id, xxcurrentView, true); } if ((currentNode != null) && (currentNode._id == message.event.nodeid)) { gotoDevice(currentNode._id, xxcurrentView, true); }
// If we are looking at the sessions dialog box for this device now, update it // If we are looking at the sessions dialog box for this device now, update it
@ -3027,7 +3027,7 @@
function onRealNameCheckBox() { function onRealNameCheckBox() {
showRealNames = Q('RealNameCheckBox').checked; showRealNames = Q('RealNameCheckBox').checked;
putstore('showRealNames', showRealNames ? 1 : 0); putstore('showRealNames', showRealNames ? 1 : 0);
masterUpdate(6); mainUpdate(6);
} }
function onOnlineCheckBox(e) { function onOnlineCheckBox(e) {
@ -3041,8 +3041,8 @@
Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel'); Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel');
putstore('deviceView', Q('viewselect').value); putstore('deviceView', Q('viewselect').value);
putstore('viewsize', Q('sizeselect').value); putstore('viewsize', Q('sizeselect').value);
masterUpdate(4); mainUpdate(4);
setTimeout(function () { masterUpdate(512); }, 200); setTimeout(function () { mainUpdate(512); }, 200);
} }
function ondockeypress(e) { function ondockeypress(e) {
@ -3077,7 +3077,7 @@
showRealNames = !showRealNames; showRealNames = !showRealNames;
Q('RealNameCheckBox').value = showRealNames; Q('RealNameCheckBox').value = showRealNames;
putstore('showRealNames', showRealNames ? 1 : 0); putstore('showRealNames', showRealNames ? 1 : 0);
masterUpdate(6) mainUpdate(6)
return; return;
} }
if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return; if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
@ -3090,7 +3090,7 @@
} else { } else {
if (e.charCode != 0 && searchFocus == 0) { Q('KvmSearchInput').value = Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; } if (e.charCode != 0 && searchFocus == 0) { Q('KvmSearchInput').value = Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; }
} }
if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); } if (processed > 0) { if (processed == 1) { mainUpdate(5); } return haltEvent(e); }
} }
if (Q('viewselect').value == 4) { if (Q('viewselect').value == 4) {
if (e.key) { if (e.key) {
@ -3123,14 +3123,14 @@
if (!xxdialogMode && xxcurrentView == 4) { if (!xxdialogMode && xxcurrentView == 4) {
if (e.keyCode === 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = (x.substring(0, x.length - 1)); processed = 1; } if (e.keyCode === 8 && userSearchFocus == 0) { var x = Q('UserSearchInput').value; Q('UserSearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
if (e.keyCode === 27) { Q('UserSearchInput').value = ''; processed = 1; } if (e.keyCode === 27) { Q('UserSearchInput').value = ''; processed = 1; }
if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); } if (processed > 0) { if (processed == 1) { mainUpdate(5); } return haltEvent(e); }
} }
if (xxdialogMode || xxcurrentView != 1 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return; if (xxdialogMode || xxcurrentView != 1 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return;
var processed = 0; var processed = 0;
if (Q('viewselect').value < 4) { if (Q('viewselect').value < 4) {
if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('KvmSearchInput').value = Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; } if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('KvmSearchInput').value = Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; }
if (e.keyCode === 27) { Q('KvmSearchInput').value = Q('SearchInput').value = ''; processed = 1; } if (e.keyCode === 27) { Q('KvmSearchInput').value = Q('SearchInput').value = ''; processed = 1; }
if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); } if (processed > 0) { if (processed == 1) { mainUpdate(5); } return haltEvent(e); }
} }
if (Q('viewselect').value == 4) { if (Q('viewselect').value == 4) {
if (e.keyCode === 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = (x.substring(0, x.length - 1)); processed = 1; } if (e.keyCode === 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = (x.substring(0, x.length - 1)); processed = 1; }
@ -3676,7 +3676,7 @@
} }
function disconnectAllKvmFunction() { if (xxdialogMode) return false; for (var nodeid in multiDesktop) { multiDesktop[nodeid].Stop(); } multiDesktop = {}; } function disconnectAllKvmFunction() { if (xxdialogMode) return false; for (var nodeid in multiDesktop) { multiDesktop[nodeid].Stop(); } multiDesktop = {}; }
function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][state]); } catch (ex) {} } function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][state]); } catch (ex) {} }
function onDeviceSearchChanged(e) { if (e.target.id == 'SearchInput') { Q('KvmSearchInput').value = Q('SearchInput').value; } else { Q('SearchInput').value = Q('KvmSearchInput').value; } masterUpdate(5); } function onDeviceSearchChanged(e) { if (e.target.id == 'SearchInput') { Q('KvmSearchInput').value = Q('SearchInput').value; } else { Q('SearchInput').value = Q('KvmSearchInput').value; } mainUpdate(5); }
function showMultiDesktopSettings() { function showMultiDesktopSettings() {
QV('d7amtkvm', false); QV('d7amtkvm', false);
@ -5390,7 +5390,7 @@
QH('p10html', x); QH('p10html', x);
// Show node last 7 days timeline // Show node last 7 days timeline
masterUpdate(256); mainUpdate(256);
// Check if we have terminal and file access // Check if we have terminal and file access
var desktopAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 65536) == 0)); var desktopAccess = ((meshrights == 0xFFFFFFFF) || ((meshrights & 65536) == 0));
@ -8554,7 +8554,7 @@
if (n != m) { if (n != m) {
if (m != '*') { args.locale = m; } else { delete args.locale; } if (m != '*') { args.locale = m; } else { delete args.locale; }
putstore('loctag', args.locale); putstore('loctag', args.locale);
masterUpdate(0xFFFFFFFF); // Refresh everything. mainUpdate(0xFFFFFFFF); // Refresh everything.
} }
} }
@ -10751,7 +10751,7 @@
meshserver.send(x); meshserver.send(x);
} }
function onUserSearchInputChanged() { masterUpdate(16384); } function onUserSearchInputChanged() { mainUpdate(16384); }
// //
@ -12300,8 +12300,8 @@
function center() { function center() {
setSessionActivity(); setSessionActivity();
if (xxcurrentView == 11) { deskAdjust(); } if (xxcurrentView == 11) { deskAdjust(); }
else if (xxcurrentView == 10) { masterUpdate(256); } else if (xxcurrentView == 10) { mainUpdate(256); }
else if (xxcurrentView == 1) { masterUpdate(4); } else if (xxcurrentView == 1) { mainUpdate(4); }
} }
function messagebox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t, 1); } function messagebox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t, 1); }
function statusbox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t); } function statusbox(t, m) { setSessionActivity(); QH('id_dialogMessage', m); setDialogMode(1, t); }
@ -12452,7 +12452,7 @@
QV('p15BackButton', x != 115); QV('p15BackButton', x != 115);
if ((x == 15) || (x == 115)) { setupConsole(); } if ((x == 15) || (x == 115)) { setupConsole(); }
if (x == 1) masterUpdate(4); if (x == 1) mainUpdate(4);
// Setup web notifications // Setup web notifications
if ((x == 2) && Notification) { QV('accountEnableNotificationsSpan', Notification.permission != 'granted'); } if ((x == 2) && Notification) { QV('accountEnableNotificationsSpan', Notification.permission != 'granted'); }

View File

@ -2227,7 +2227,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
const authCookie = obj.parent.encodeCookie({ userid: user._id, domainid: domain.id, ip: req.clientIp }, obj.parent.loginCookieEncryptionKey); const authCookie = obj.parent.encodeCookie({ userid: user._id, domainid: domain.id, ip: req.clientIp }, obj.parent.loginCookieEncryptionKey);
const authRelayCookie = obj.parent.encodeCookie({ ruserid: user._id, domainid: domain.id }, obj.parent.loginCookieEncryptionKey); const authRelayCookie = obj.parent.encodeCookie({ ruserid: user._id, domainid: domain.id }, obj.parent.loginCookieEncryptionKey);
// Send the master web application // Send the main web application
var extras = (req.query.key != null) ? ('&key=' + req.query.key) : ''; var extras = (req.query.key != null) ? ('&key=' + req.query.key) : '';
if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrols.logoutUrl = (domain.url + 'logout?' + Math.random() + extras); } // If a default user is in use or no user mode, don't display the logout button if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrols.logoutUrl = (domain.url + 'logout?' + Math.random() + extras); } // If a default user is in use or no user mode, don't display the logout button
var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified