diff --git a/public/player.htm b/public/player.htm index 5e263237..d16f58b1 100644 --- a/public/player.htm +++ b/public/player.htm @@ -165,28 +165,28 @@ try { recFileMetadata = JSON.parse(data) } catch (ex) { cleanup(); return; } if ((recFileMetadata == null) || (recFileMetadata.magic != 'MeshCentralRelaySession') || (recFileMetadata.ver != 1)) { cleanup(); return; } var x = ''; - x += addInfo('Time', recFileMetadata.time); - if (recFileEndTime != 0) { var secs = Math.floor((recFileEndTime - time) / 1000); x += addInfo('Duration', secs + ' second' + ((secs > 1) ? 's' : '')); } - x += addInfo('Username', recFileMetadata.username); - x += addInfo('UserID', recFileMetadata.userid); - x += addInfo('SessionID', recFileMetadata.sessionid); - if (recFileMetadata.ipaddr1 && recFileMetadata.ipaddr2) { x += addInfo('Addresses', recFileMetadata.ipaddr1 + ' to ' + recFileMetadata.ipaddr2); } - if (recFileMetadata.devicename) { x += addInfo('DeviceName', recFileMetadata.devicename); } - x += addInfo('NodeID', recFileMetadata.nodeid); + x += addInfo("Time", recFileMetadata.time); + if (recFileEndTime != 0) { var secs = Math.floor((recFileEndTime - time) / 1000); x += addInfo("Duration", format("{0} second{1}", secs, (secs > 1) ? 's' : '')); } + x += addInfo("Username", recFileMetadata.username); + x += addInfo("UserID", recFileMetadata.userid); + x += addInfo("SessionID", recFileMetadata.sessionid); + if (recFileMetadata.ipaddr1 && recFileMetadata.ipaddr2) { x += addInfo("Addresses", format("{0} to {1}", recFileMetadata.ipaddr1, recFileMetadata.ipaddr2)); } + if (recFileMetadata.devicename) { x += addInfo("DeviceName", recFileMetadata.devicename); } + x += addInfo("NodeID", recFileMetadata.nodeid); if (recFileMetadata.protocol) { var p = recFileMetadata.protocol; - if (p == 1) { p = 'MeshCentral Terminal'; } - else if (p == 2) { p = 'MeshCentral Desktop'; } - else if (p == 100) { p = 'Intel® AMT WSMAN'; } - else if (p == 101) { p = 'Intel® AMT Redirection'; } - x += addInfoNoEsc('Protocol', p); + if (p == 1) { p = "MeshCentral Terminal"; } + else if (p == 2) { p = "MeshCentral Desktop"; } + else if (p == 100) { p = "Intel® AMT WSMAN"; } + else if (p == 101) { p = "Intel® AMT Redirection"; } + x += addInfoNoEsc("Protocol", p); } QV('DeskParent', true); QV('TermParent', false); if (recFileMetadata.protocol == 1) { // MeshCentral remote terminal recFileProtocol = 1; - x += '

Press [space] to play/pause.'; + x += '

' + "Press [space] to play/pause." + ''; QE('PlayButton', true); QE('PauseButton', false); QE('RestartButton', false); @@ -195,7 +195,7 @@ else if (recFileMetadata.protocol == 2) { // MeshCentral remote desktop recFileProtocol = 2; - x += '

Press [space] to play/pause.'; + x += '

' + "Press [space] to play/pause." + ''; QE('PlayButton', true); QE('PauseButton', false); QE('RestartButton', false); @@ -301,7 +301,7 @@ QS('progressbar').width = '0px'; QH('timespan', '00:00:00'); QV('metadatadiv', true); - QH('metadatadiv', 'MeshCentral Session Player

Drag & drop a .mcrec file or click "Open File..."'); + QH('metadatadiv', 'MeshCentral Session Player

' + "Drag & drop a .mcrec file or click \"Open File...\"" + ''); QV('DeskParent', true); QV('TermParent', false); } @@ -529,10 +529,9 @@ 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 haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; } - function pad2(num) { var s = "00" + num; return s.substr(s.length - 2); } + function pad2(num) { var s = '00' + num; return s.substr(s.length - 2); } + function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; start(); diff --git a/views/default.handlebars b/views/default.handlebars index 30d03707..b8b4dbd7 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -983,15 +983,15 @@ 'use strict'; // Process server-side web state - var webState = "{{{webstate}}}"; - if (webState != "") { webState = JSON.parse(decodeURIComponent(webState)); } + var webState = '{{{webstate}}}'; + if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); } for (var i in webState) { localStorage.setItem(i, webState[i]); } if (!webState.loctag) { delete localStorage.removeItem('loctag'); } var args; var autoReconnect = true; - var powerStatetable = ['', 'Powered', 'Sleep', 'Sleep', 'Sleep', 'Hibernating', 'Power off', 'Present']; - var StatusStrs = ['Disconnected', 'Connecting...', 'Setup...', 'Connected', 'Intel® AMT Connected']; + var powerStatetable = ['', "Powered", "Sleep", "Sleep", "Sleep", "Hibernating", "Power off", "Present"]; + var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"]; var sort = 0; var searchFocus = 0; var mapSearchFocus = 0; @@ -1014,23 +1014,23 @@ var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000 }; var terminal; var files; - var debugLevel = parseInt("{{{debuglevel}}}"); - var features = parseInt("{{{features}}}"); - var sessionTime = parseInt("{{{sessiontime}}}"); - var domain = "{{{domain}}}"; - var domainUrl = "{{{domainurl}}}"; - var authCookie = "{{{authCookie}}}"; - var authRelayCookie = "{{{authRelayCookie}}}"; + var debugLevel = parseInt('{{{debuglevel}}}'); + var features = parseInt('{{{features}}}'); + var sessionTime = parseInt('{{{sessiontime}}}'); + var domain = '{{{domain}}}'; + var domainUrl = '{{{domainurl}}}'; + var authCookie = '{{{authCookie}}}'; + var authRelayCookie = '{{{authRelayCookie}}}'; var authCookieRenewTimer = null; var multiDesktop = {}; var multiDesktopFilter = null; - var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}"; + var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}'; var amtScanResults = null; var debugmode = 0; var clickOnce = (((features & 256) != 0) && detectClickOnce()); var attemptWebRTC = ((features & 128) != 0); - var passRequirements = "{{{passRequirements}}}"; - if (passRequirements != "") { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } + var passRequirements = '{{{passRequirements}}}'; + if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } var deskAspectRatio = 0; try { deskAspectRatio = parseInt(getstore('deskAspectRatio', '0')); } catch (ex) { } var uiMode = parseInt(getstore('uiMode', 1)); @@ -1126,8 +1126,8 @@ document.onkeypress = ondockeypress; document.onkeydown = ondockeydown; document.onkeyup = ondockeyup; - //window.addEventListener("focus", ondocfocus, false); - window.addEventListener("blur", ondocblur, false); + //window.addEventListener('focus', ondocfocus, false); + window.addEventListener('blur', ondocblur, false); window.onresize = function () { masterUpdate(512); } setTimeout(function() { masterUpdate(512); }, 200); @@ -1139,12 +1139,12 @@ meshserver.Start(); // Setup page controls - Q('sortselect').selectedIndex = sort = getstore("sort", 0); - Q('sizeselect').selectedIndex = getstore("_viewsize", 1); - Q('SearchInput').value = getstore("_search", ""); - showRealNames = (getstore("showRealNames", 0) == 1); + Q('sortselect').selectedIndex = sort = getstore('sort', 0); + Q('sizeselect').selectedIndex = getstore('_viewsize', 1); + Q('SearchInput').value = getstore('_search', ''); + showRealNames = (getstore('showRealNames', 0) == 1); Q('RealNameCheckBox').checked = showRealNames; - Q('viewselect').value = getstore("_deviceView", 1); + Q('viewselect').value = getstore('_deviceView', 1); Q('DeskControl').checked = (getstore('DeskControl', 1) == 1); QV('accountChangeEmailAddressSpan', (features & 0x200000) == 0); @@ -1154,17 +1154,17 @@ Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel'); // Setup upload drag & drop - Q('p5filetable').addEventListener("drop", p5fileDragDrop, false); - Q('p5filetable').addEventListener("dragover", p5fileDragOver, false); - Q('p5filetable').addEventListener("dragleave", p5fileDragLeave, false); - //Q('p5fileCatchAllInput').addEventListener("drop", p5fileDragDrop, false); - //Q('p5fileCatchAllInput').addEventListener("dragover", p5fileDragOver, false); - //Q('p5fileCatchAllInput').addEventListener("dragleave", p5fileDragLeave, false); + Q('p5filetable').addEventListener('drop', p5fileDragDrop, false); + Q('p5filetable').addEventListener('dragover', p5fileDragOver, false); + Q('p5filetable').addEventListener('dragleave', p5fileDragLeave, false); + //Q('p5fileCatchAllInput').addEventListener('drop', p5fileDragDrop, false); + //Q('p5fileCatchAllInput').addEventListener('dragover', p5fileDragOver, false); + //Q('p5fileCatchAllInput').addEventListener('dragleave', p5fileDragLeave, false); // Setup upload drag & drop - Q('p13filetable').addEventListener("drop", p13fileDragDrop, false); - Q('p13filetable').addEventListener("dragover", p13fileDragOver, false); - Q('p13filetable').addEventListener("dragleave", p13fileDragLeave, false); + Q('p13filetable').addEventListener('drop', p13fileDragDrop, false); + Q('p13filetable').addEventListener('dragover', p13fileDragOver, false); + Q('p13filetable').addEventListener('dragleave', p13fileDragLeave, false); // Timeline update interval setInterval(updateDeviceTimeline, 120000); // Check every 2 minutes @@ -1178,7 +1178,7 @@ // Terminal special keys var x = ''; - for (var c = 1; c < 27; c++) x += ""; + for (var c = 1; c < 27; c++) x += ''; QH('specialkeylist', x); // Setup server stats panels @@ -1206,9 +1206,9 @@ putstore('webPageStackMenu', webPageStackMenu); } if (webPageStackMenu == false) { - QC('body').remove("menu_stack"); + QC('body').remove('menu_stack'); } else { - QC('body').add("menu_stack"); + QC('body').add('menu_stack'); if (xxcurrentView >= 10) QC('column_l').remove('room4submenu'); } deskAdjust(); @@ -1248,15 +1248,15 @@ var hide = 0; if (args.hide) { hide = parseInt(args.hide); } if (webPageFullScreen == false) { - QC('body').remove("menu_stack"); - QC('body').remove("fullscreen"); - QC('body').remove("arg_hide"); + QC('body').remove('menu_stack'); + QC('body').remove('fullscreen'); + QC('body').remove('arg_hide'); if (xxcurrentView >= 10) QC('column_l').add('room4submenu'); QV('UserDummyMenuSpan', false); //QV('page_leftbar', false); } else { - QC('body').add("fullscreen"); - if (hide & 16) QC('body').add("arg_hide"); // This is replacement for QV('page_leftbar', !(hide & 16)); + QC('body').add('fullscreen'); + if (hide & 16) QC('body').add('arg_hide'); // This is replacement for QV('page_leftbar', !(hide & 16)); QV('page_leftbar', !(hide & 16)); QV('MainMenuSpan', !(hide & 16)); if (xxcurrentView >= 10) QC('column_l').remove('room4submenu'); @@ -1288,8 +1288,8 @@ hideContextMenu(); // Hide the context menu if present QV('verifyEmailId2', false); QV('logoutControl', false); - if (errorCode == 'noauth') { QH('p0span', 'Unable to perform authentication'); return; } - if (prevState == 2) { if (autoReconnect) { setTimeout(serverPoll, 5000); } } else { QH('p0span', 'Unable to connect web socket'); } + if (errorCode == 'noauth') { QH('p0span', "Unable to perform authentication"); return; } + if (prevState == 2) { if (autoReconnect) { setTimeout(serverPoll, 5000); } } else { QH('p0span', "Unable to connect web socket"); } if (authCookieRenewTimer != null) { clearInterval(authCookieRenewTimer); authCookieRenewTimer = null; } } else if (state == 2) { // Fetch list of meshes, nodes, files @@ -1306,7 +1306,7 @@ var xdr = null; try { xdr = new XDomainRequest(); } catch (e) { } if (!xdr) xdr = new XMLHttpRequest(); - xdr.open("HEAD", window.location.href); + xdr.open('HEAD', window.location.href); xdr.timeout = 15000; xdr.onload = function () { reload(); }; xdr.onerror = xdr.ontimeout = function () { setTimeout(serverPoll, 10000); }; @@ -1315,13 +1315,13 @@ // Return true if this browser supports clickonce function detectClickOnce() { - for (var i in window.navigator.mimeTypes) { if (window.navigator.mimeTypes[i].type == "application/x-ms-application") { return true; } } + for (var i in window.navigator.mimeTypes) { if (window.navigator.mimeTypes[i].type == 'application/x-ms-application') { return true; } } var userAgent = window.navigator.userAgent.toUpperCase(); return (userAgent.indexOf('.NET CLR 3.5') >= 0) || (userAgent.indexOf('(WINDOWS NT ') >= 0); } function updateSiteAdmin() { - var noServerBackup = "{{{noServerBackup}}}"; + var noServerBackup = '{{{noServerBackup}}}'; var siteRights = userinfo.siteadmin; if (noServerBackup == 1) { siteRights &= 0xFFFFFFFA; } // If not server backups allowed, remove server backup and restore permissions @@ -1401,7 +1401,7 @@ // Check if backup codes should really be enabled if ((backupCodesWarningDone == false) && !(userinfo.otpkeys > 0) && (((userinfo.otpsecret == 1) && !(userinfo.otphkeys > 0)) || ((userinfo.otpsecret != 1) && (userinfo.otphkeys == 1)))) { - var n = { text: 'Please add two-factor backup codes. If the current factor is lost, there is not way to recover this account.', title: 'Two factor authentication' }; + var n = { text: "Please add two-factor backup codes. If the current factor is lost, there is not way to recover this account.", title: "Two factor authentication" }; addNotification(n); backupCodesWarningDone = true; } @@ -1414,13 +1414,13 @@ QV('getStarted2', !newGroupsAllowed); if (typeof userinfo.passchange == 'number') { - if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', ' - Reset on next login.'); } + if (userinfo.passchange == -1) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); } else if ((passRequirements != null) && (typeof passRequirements.reset == 'number')) { var seconds = (userinfo.passchange) + (passRequirements.reset * 86400) - Math.floor(Date.now() / 1000); - if (seconds < 0) { QH('p2nextPasswordUpdateTime', ' - Reset on next login.'); } - else if (seconds < 3600) { QH('p2nextPasswordUpdateTime', ' - Reset in ' + Math.floor(seconds / 60) + ' minute' + addLetterS(Math.floor(seconds / 60)) + '.'); } - else if (seconds < 86400) { QH('p2nextPasswordUpdateTime', ' - Reset in ' + Math.floor(seconds / 3600) + ' hour' + addLetterS(Math.floor(seconds / 3600)) + '.'); } - else { QH('p2nextPasswordUpdateTime', ' - Reset in ' + Math.floor(seconds / 86400) + ' day' + addLetterS(Math.floor(seconds / 86400)) + '.'); } + if (seconds < 0) { QH('p2nextPasswordUpdateTime', " - Reset on next login."); } + else if (seconds < 3600) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} minute{1}.", Math.floor(seconds / 60), addLetterS(Math.floor(seconds / 60)))); } + else if (seconds < 86400) { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} hour{1}.", Math.floor(seconds / 3600), addLetterS(Math.floor(seconds / 3600)))); } + else { QH('p2nextPasswordUpdateTime', format(" - Reset in {0} day{1}."), Math.floor(seconds / 86400), addLetterS(Math.floor(seconds / 86400))); } } } } @@ -1432,10 +1432,10 @@ if (delta > serverinfo.timeout) { window.location.href = 'logout'; } else { var ds = Math.round((serverinfo.timeout - delta) / 1000); if (ds <= 60) { - QH('idleTimeoutNotify', '
' + ds + ' second' + addLetterS(ds) + ' until disconnect'); + QH('idleTimeoutNotify', '
' + format("{0} second{1} until disconnect", ds, addLetterS(ds))); } else { ds = Math.round(ds / 60); - if (ds <= 5) { QH('idleTimeoutNotify', '
' + ds + ' minute' + addLetterS(ds) + ' until disconnect'); } + if (ds <= 5) { QH('idleTimeoutNotify', '
' + format("{0} minute{1} until disconnect", ds, addLetterS(ds))); } } } } @@ -1476,7 +1476,7 @@ case 'serverinfo': { serverinfo = message.serverinfo; if (serverinfo.timeout) { setInterval(checkIdleSessionTimeout, 10000); checkIdleSessionTimeout(); } - if (debugmode == 1) { console.log("Server time: ", printDateTime(new Date(serverinfo.serverTime))); } + if (debugmode == 1) { console.log('Server time: ', printDateTime(new Date(serverinfo.serverTime))); } break; } case 'userinfo': { @@ -1545,32 +1545,32 @@ if (message.nodeid != powerTimelineReq) break; //console.log('getsysinfo', message); // *********************** if (message.noinfo === true) { - QH('p17info', 'No information for this device.'); + QH('p17info', "No information for this device."); } else { var x = '', s = {}; if (message.hardware) { if (message.hardware.identifiers) { var ident = message.hardware.identifiers; // BIOS - x += '
BIOS
'; - if (ident.bios_vendor) { x += addDetailItem('Vendor', ident.bios_vendor, s); } - if (ident.bios_version) { x += addDetailItem('Version', ident.bios_version, s); } + x += '
' + "BIOS" + '
'; + if (ident.bios_vendor) { x += addDetailItem("Vendor", ident.bios_vendor, s); } + if (ident.bios_version) { x += addDetailItem("Version", ident.bios_version, s); } x += '
'; // Motherboard - x += '
Motherboard
'; - if (ident.board_vendor) { x += addDetailItem('Vendor', ident.board_vendor, s); } - if (ident.board_name) { x += addDetailItem('Name', ident.board_name, s); } - if (ident.board_serial && (ident.board_serial != '')) { x += addDetailItem('Serial', ident.board_serial, s); } - if (ident.board_version) { x += addDetailItem('Version', ident.board_version, s); } - if (ident.product_uuid) { x += addDetailItem('Identifier', ident.product_uuid, s); } + x += '
' + "Motherboard" + '
'; + if (ident.board_vendor) { x += addDetailItem("Vendor", ident.board_vendor, s); } + if (ident.board_name) { x += addDetailItem("Name", ident.board_name, s); } + if (ident.board_serial && (ident.board_serial != '')) { x += addDetailItem("Serial", ident.board_serial, s); } + if (ident.board_version) { x += addDetailItem("Version", ident.board_version, s); } + if (ident.product_uuid) { x += addDetailItem("Identifier", ident.product_uuid, s); } x += '
'; } if (message.hardware.windows) { if (message.hardware.windows.memory) { // Memory - x += '
Memory
'; + x += '
' + "Memory" + '
'; // Sort Memory function memorySort(a, b) { if (a.BankLabel > b.BankLabel) return 1; if (a.BankLabel < b.BankLabel) return -1; return 0; } @@ -1582,8 +1582,8 @@ x += '' x += '
'; x += '
' + m.BankLabel + '
'; - if (m.Capacity) { x += addDetailItem('Capacity / Speed', ( m.Capacity / 1024 / 1024) + ' Mb, ' + m.Speed + ' Mhz', s); } - if (m.PartNumber) { x += addDetailItem('Part Number', ((m.Manufacturer && m.Manufacturer != 'Undefined')?(m.Manufacturer + ', '):'') + m.PartNumber, s); } + if (m.Capacity) { x += addDetailItem("Capacity / Speed", format("{0} Mb, {1} Mhz", (m.Capacity / 1024 / 1024), m.Speed), s); } + if (m.PartNumber) { x += addDetailItem("Part Number", ((m.Manufacturer && m.Manufacturer != 'Undefined')?(m.Manufacturer + ', '):'') + m.PartNumber, s); } x += '
'; } x += '
'; @@ -1592,10 +1592,10 @@ if (message.hardware.windows.osinfo) { // Operating System var m = message.hardware.windows.osinfo; - x += '
Operating System
'; - if (m.Caption) { x += addDetailItem('Name', m.Caption, s); } - if (m.Version) { x += addDetailItem('Version', m.Version, s); } - if (m.OSArchitecture) { x += addDetailItem('Architecture', m.OSArchitecture, s); } + x += '
' + "Operating System" + '
'; + if (m.Caption) { x += addDetailItem("Name", m.Caption, s); } + if (m.Version) { x += addDetailItem("Version", m.Version, s); } + if (m.OSArchitecture) { x += addDetailItem("Architecture", m.OSArchitecture, s); } x += '
'; } @@ -1615,7 +1615,7 @@ node.lastconnect = message.time; node.lastaddr = message.addr; if ((currentNode._id == node._id) && (Q('MainComputerState').innerHTML == '')) { - QH('MainComputerState', 'Last seen:
' + printDateTime(new Date(node.lastconnect)) + '
'); + QH('MainComputerState', '' + "Last seen:" + '
' + printDateTime(new Date(node.lastconnect)) + '
'); } } break; @@ -1644,7 +1644,7 @@ Q('d2clipText').value = message.data; } else if ((message.type == 'setclip') && (xxdialogTag == 'clipboard') && (currentNode != null) && (currentNode._id == message.nodeid)) { // Display success/fail on the clipboard dialog box. - QH('dlgClipStatus', message.success ? 'Success' : 'Failed') + QH('dlgClipStatus', message.success ? '' + "Success" + '' : '' + "Failed" + '') setTimeout(function () { try { QH('dlgClipStatus', ''); } catch (ex) { } }, 2000); } } @@ -1661,38 +1661,38 @@ case 'getnetworkinfo': { if ((currentNode._id == message.nodeid) && (xxdialogMode == 2) && (xxdialogTag == 'if' + message.nodeid)) { if (message.netif == null) { - QH('d2netinfo', 'No network interface information available for this device.'); + QH('d2netinfo', "No network interface information available for this device."); } else { var x = '
'; - if (currentNode.lastconnect) { x += addHtmlValue2('Last agent connection', printDateTime(new Date(currentNode.lastconnect))); } + if (currentNode.lastconnect) { x += addHtmlValue2("Last agent connection", printDateTime(new Date(currentNode.lastconnect))); } if (currentNode.lastaddr) { var splitip = currentNode.lastaddr.split(':'); if (splitip.length > 2) { // IPv6 - x += addHtmlValue2('Last agent address', currentNode.lastaddr + ' '); + x += addHtmlValue2("Last agent address", currentNode.lastaddr + ' '); } else { // IPv4 if (isPrivateIP(currentNode.lastaddr)) { - x += addHtmlValue2('Last agent address', splitip[0] + ' '); + x += addHtmlValue2("Last agent address", splitip[0] + ' '); } else { - x += addHtmlValue2('Last agent address', '' + splitip[0] + ' '); + x += addHtmlValue2("Last agent address", '' + splitip[0] + ' '); } } } - x += addHtmlValue2('Last interfaces update', printDateTime(new Date(message.updateTime))); + x += addHtmlValue2("Last interfaces update", printDateTime(new Date(message.updateTime))); for (var i in message.netif) { var net = message.netif[i]; x += '
' - if (net.name) { x += addHtmlValue2('Name', '' + EscapeHtml(net.name) + ''); } - if (net.desc) { x += addHtmlValue2('Description', EscapeHtml(net.desc).replace('(R)', '®').replace('(r)', '®')); } - if (net.dnssuffix) { x += addHtmlValue2('DNS suffix', EscapeHtml(net.dnssuffix) + ' '); } - if (net.mac) { x += addHtmlValue2('MAC address', '' + EscapeHtml(net.mac.toLowerCase()) + ' '); } - if (net.v4addr) { x += addHtmlValue2('IPv4 address', EscapeHtml(net.v4addr) + ' '); } - if (net.v4mask) { x += addHtmlValue2('IPv4 mask', EscapeHtml(net.v4mask) + ' '); } - if (net.v4gateway) { x += addHtmlValue2('IPv4 gateway', EscapeHtml(net.v4gateway) + ' '); } - if (net.gatewaymac) { x += addHtmlValue2('Gateway MAC', '' + EscapeHtml(net.gatewaymac.toLowerCase()) + ' '); } + if (net.name) { x += addHtmlValue2("Name", '' + EscapeHtml(net.name) + ''); } + if (net.desc) { x += addHtmlValue2("Description", EscapeHtml(net.desc).replace('(R)', '®').replace('(r)', '®')); } + if (net.dnssuffix) { x += addHtmlValue2("DNS suffix", EscapeHtml(net.dnssuffix) + ' '); } + if (net.mac) { x += addHtmlValue2("MAC address", '' + EscapeHtml(net.mac.toLowerCase()) + ' '); } + if (net.v4addr) { x += addHtmlValue2("IPv4 address", EscapeHtml(net.v4addr) + ' '); } + if (net.v4mask) { x += addHtmlValue2("IPv4 mask", EscapeHtml(net.v4mask) + ' '); } + if (net.v4gateway) { x += addHtmlValue2("IPv4 gateway", EscapeHtml(net.v4gateway) + ' '); } + if (net.gatewaymac) { x += addHtmlValue2("Gateway MAC", '' + EscapeHtml(net.gatewaymac.toLowerCase()) + ' '); } } x += '
'; QH('d2netinfo', x); @@ -1703,15 +1703,15 @@ case 'serverversion': { if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerUpdate')) { var x = '
'; - if (!message.current) { message.current = 'Unknown'; } - if (!message.latest) { message.latest = 'Unknown'; } - x += addHtmlValue2('Current Version', '' + EscapeHtml(message.current) + ''); - x += addHtmlValue2('Latest Version', '' + EscapeHtml(message.latest) + ''); + if (!message.current) { message.current = "Unknown"; } + if (!message.latest) { message.latest = "Unknown"; } + x += addHtmlValue2("Current Version", '' + EscapeHtml(message.current) + ''); + x += addHtmlValue2("Latest Version", '' + EscapeHtml(message.latest) + ''); x += '
'; if ((message.latest.indexOf('.') == -1) || (message.current == message.latest) || ((features & 2048) == 0)) { setDialogMode(2, "MeshCentral Version", 1, null, x); } else { - setDialogMode(2, "MeshCentral Version", 3, server_showVersionDlgEx, x + '
'); + setDialogMode(2, "MeshCentral Version", 3, server_showVersionDlgEx, x + '
'); server_showVersionDlgUpdate(); } } @@ -1720,10 +1720,10 @@ case 'servererrors': { if ((xxdialogMode == 2) && (xxdialogTag == 'MeshCentralServerErrors')) { if (message.data == null) { - setDialogMode(2, "MeshCentral Server Errors", 1, null, 'Server has no error log.'); + setDialogMode(2, "MeshCentral Server Errors", 1, null, "Server has no error log."); } else { var x = '
' + message.data + '
'; - setDialogMode(2, "MeshCentral Server Errors", 3, server_showErrorsDlgEx, x + '
'); + setDialogMode(2, "MeshCentral Server Errors", 3, server_showErrorsDlgEx, x + '
'); server_showVersionDlgUpdate(); } } @@ -1748,8 +1748,8 @@ } case 'getcookie': { if (message.tag == 'clickonce') { - var basicPort = "{{{serverRedirPort}}}" == "" ? "{{{serverPublicPort}}}" : "{{{serverRedirPort}}}"; - var rdpurl = "http://" + window.location.hostname + ":" + basicPort + "/clickonce/minirouter/MeshMiniRouter.application?WS=wss%3A%2F%2F" + window.location.hostname + "%2Fmeshrelay.ashx%3Fauth=" + message.cookie + "&CH={{{webcerthash}}}&AP=" + message.protocol + ((debugmode == 1) ? "" : "&HOL=1"); + var basicPort = '{{{serverRedirPort}}}' == '' ? '{{{serverPublicPort}}}' : '{{{serverRedirPort}}}'; + var rdpurl = 'http://' + window.location.hostname + ':' + basicPort + '/clickonce/minirouter/MeshMiniRouter.application?WS=wss%3A%2F%2F' + window.location.hostname + '%2Fmeshrelay.ashx%3Fauth=' + message.cookie + '&CH={{{webcerthash}}}&AP=' + message.protocol + ((debugmode == 1) ? '' : '&HOL=1'); var newWindow = window.open(rdpurl, '_blank'); newWindow.opener = null; } @@ -1774,8 +1774,8 @@ var secret = message.secret; if (secret.length == 52) { secret = secret.split(/(.............)/).filter(Boolean).join(' '); } else if (secret.length == 32) { secret = secret.split(/(....)/).filter(Boolean).join(' '); secret = secret.substring(0, 20) + '
' + secret.substring(20) } - QH('d2optinfo', '
Install Google Authenticator or a compatible application and scan the barcode, use this link or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login.

Secret
' + secret + '


Enter the token here for 2-step login: = 48 && event.charCode <= 57)\" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text>
'); - new QRCode(Q("qrcode"), { text: message.url, width: 128, height: 128, colorDark: "#000000", colorLight: "#EEE", correctLevel: QRCode.CorrectLevel.H }); + QH('d2optinfo', '
' + "Install Google Authenticator or a compatible application and scan the barcode, use this link or enter the secret. Then, enter the current 6 digit token below to activate 2-Step login." + '

Secret
' + secret + '


' + "Enter the token here for 2-step login:" + ' = 48 && event.charCode <= 57)\" onkeyup=account_addOtpCheck(event) onkeydown=account_addOtpCheck() maxlength=6 id=d2otpauthinput type=text>
'); + new QRCode(Q('qrcode'), { text: message.url, width: 128, height: 128, colorDark: '#000000', colorLight: '#EEE', correctLevel: QRCode.CorrectLevel.H }); QV('idx_dlgOkButton', true); QE('idx_dlgOkButton', false); Q('d2otpauthinput').focus(); @@ -1795,7 +1795,7 @@ case 'otpauth-getpasswords': { if (xxdialogMode) return; var x = "One time tokens can be used as secondary authentication. Generate a set, print them and keep them in a safe place."; - x += "
"; + x += '
'; if (message.passwords) { var j = 0, clipb = ''; for (var i in message.passwords) { @@ -1811,38 +1811,38 @@ } } } else { - x += '
No Active Tokens'; + x += '
' + "No Active Tokens"; } - x += "

"; - x += "
"; - x += ""; + x += '

'; + x += '
'; + x += ''; if (message.passwords != null) { - x += ""; - x += ' '; + x += ''; + x += ' '; } - x += "

"; + x += '
'; setDialogMode(2, "Manage Backup Codes", 8, null, x, 'otpauth-manage'); break; } case 'otp-hkey-get': { if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return; - var start = "
"; - var end = "
"; - var x = "Hardware keys are used as secondary login authentication."; - x += "
"; + var start = '
'; + var end = '
'; + var x = "Hardware keys are used as secondary login authentication."; + x += '
'; if (message.keys && message.keys.length > 0) { for (var i in message.keys) { var key = message.keys[i], type = (key.type == 2)?'OTP':'WebAuthn'; - x += start + '' + key.name + "" + end; + x += start + '' + key.name + '' + end; } } else { - x += start + 'No Keys Configured' + end; + x += start + '' + "No Keys Configured" + end; } - x += "
"; - x += "
"; - if ((features & 0x00020000) != 0) { x += ""; } - if ((features & 0x00004000) != 0) { x += ""; } - x += "

"; + x += '
'; + x += '
'; + if ((features & 0x00020000) != 0) { x += ''; } + if ((features & 0x00004000) != 0) { x += ''; } + x += '

'; setDialogMode(2, "Manage Security Keys", 8, null, x, 'otpauth-hardware-manage'); if (u2fSupported() == false) { QE('d2addkey1', false); } break; @@ -1851,7 +1851,7 @@ if (message.result) { meshserver.send({ action: 'otp-hkey-get' }); // Success, ask for the full list of keys. } else { - setDialogMode(2, "Add Security Key", 1, null, '
Error, Unable to add key.

'); + setDialogMode(2, "Add Security Key", 1, null, '
' + "Error, Unable to add key." + '

'); } break; } @@ -1860,13 +1860,13 @@ if (message.result == true) { meshserver.send({ action: 'otp-hkey-get' }); // Success, ask for the full list of keys. } else { - setDialogMode(2, "Add Security Key", 1, null, '
ERROR: Unable to add key.

', 'otpauth-hardware-manage'); + setDialogMode(2, "Add Security Key", 1, null, '
' + "ERROR: Unable to add key." + '

', 'otpauth-hardware-manage'); } break; } case 'webauthn-startregister': { if (xxdialogMode && (xxdialogTag != 'otpauth-hardware-manage')) return; - var x = "Press the key button now.

"; + var x = "Press the key button now." + '

'; setDialogMode(2, "Add Security Key", 2, null, x); var publicKey = message.request; @@ -1923,9 +1923,9 @@ // Update the web page 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'); masterUpdate(6); } 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); masterUpdate(6); } if ((webstate.loctag != null) && (webstate.loctag != oldLoctag)) { if (webstate.loctag != null) { args.locale = webstate.loctag; } else { delete args.locale; } masterUpdate(0xFFFFFFFF); } } break; @@ -2187,16 +2187,16 @@ // Show the notification if (n & 2) { - if (((node.conn & 1) == 0) && ((message.event.conn & 1) != 0)) { addNotification({ text: 'Agent connected', title: node.name, icon: node.icon, nodeid: node._id }); } - if (((node.conn & 2) == 0) && ((message.event.conn & 2) != 0)) { addNotification({ text: 'Intel AMT detected', title: node.name, icon: node.icon, nodeid: node._id }); } - if (((node.conn & 4) == 0) && ((message.event.conn & 4) != 0)) { addNotification({ text: 'Intel AMT CIRA connected', title: node.name, icon: node.icon, nodeid: node._id }); } - if (((node.conn & 16) == 0) && ((message.event.conn & 16) != 0)) { addNotification({ text: 'MQTT connected', title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 1) == 0) && ((message.event.conn & 1) != 0)) { addNotification({ text: "Agent connected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 2) == 0) && ((message.event.conn & 2) != 0)) { addNotification({ text: "Intel AMT detected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 4) == 0) && ((message.event.conn & 4) != 0)) { addNotification({ text: "Intel AMT CIRA connected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 16) == 0) && ((message.event.conn & 16) != 0)) { addNotification({ text: "MQTT connected", title: node.name, icon: node.icon, nodeid: node._id }); } } if (n & 4) { - if (((node.conn & 1) != 0) && ((message.event.conn & 1) == 0)) { addNotification({ text: 'Agent disconnected', title: node.name, icon: node.icon, nodeid: node._id }); } - if (((node.conn & 2) != 0) && ((message.event.conn & 2) == 0)) { addNotification({ text: 'Intel AMT not detected', title: node.name, icon: node.icon, nodeid: node._id }); } - if (((node.conn & 4) != 0) && ((message.event.conn & 4) == 0)) { addNotification({ text: 'Intel AMT CIRA disconnected', title: node.name, icon: node.icon, nodeid: node._id }); } - if (((node.conn & 16) != 0) && ((message.event.conn & 16) == 0)) { addNotification({ text: 'MQTT disconnected', title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 1) != 0) && ((message.event.conn & 1) == 0)) { addNotification({ text: "Agent disconnected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 2) != 0) && ((message.event.conn & 2) == 0)) { addNotification({ text: "Intel AMT not detected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 4) != 0) && ((message.event.conn & 4) == 0)) { addNotification({ text: "Intel AMT CIRA disconnected", title: node.name, icon: node.icon, nodeid: node._id }); } + if (((node.conn & 16) != 0) && ((message.event.conn & 16) == 0)) { addNotification({ text: "MQTT disconnected", title: node.name, icon: node.icon, nodeid: node._id }); } } // Change the node connection state @@ -2234,7 +2234,7 @@ var x = ''; if (message.event.results == null) { // The scan could not occur because of an error. Likely the user range was invalid. - x = '
Unable to scan this address range.
Sample IP range values
192.168.0.100
192.168.1.0/24
192.167.0.1-192.168.0.100
'; + x = '
' + "Unable to scan this address range." + '
' + "Sample IP range values
192.168.0.100
192.168.1.0/24
192.167.0.1-192.168.0.100" + '
'; } else { // Go thru all the results and populate the dialog box amtScanResults = message.event.results; @@ -2242,7 +2242,7 @@ var r = message.event.results[i], shortname = r.hostname; if (shortname.length > 20) { shortname = shortname.substring(0, 20) + '...'; } var str = '' + EscapeHtml(shortname) + ' - v' + r.ver; - if (r.state == 2) { if (r.tls == 1) { str += ' with TLS.'; } else { str += ' without TLS.'; } } else { str += ' not activated.'; } + if (r.state == 2) { if (r.tls == 1) { str += " with TLS."; } else { str += " without TLS."; } } else { str += ' not activated.'; } x += '
' + str + '
'; } // If no results where found, display a nice message @@ -2297,25 +2297,25 @@ var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1); var url; if (serverinfo.https == true) { - var portStr = (serverinfo.port == 443) ? '' : (":" + serverinfo.port); - url = "https://" + servername + portStr + domainUrl + "agentinvite?c=" + message.cookie; + var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port); + url = 'https://' + servername + portStr + domainUrl + 'agentinvite?c=' + message.cookie; } else { - var portStr = (serverinfo.port == 80) ? '' : (":" + serverinfo.port); - url = "http://" + servername + portStr + domainUrl + "agentinvite?c=" + message.cookie; + var portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port); + url = 'http://' + servername + portStr + domainUrl + 'agentinvite?c=' + message.cookie; } Q('agentInvitationLink').href = url; - var t = message.expire + ' hour' + addLetterS(message.expire); - if (message.expire == 24) { t = '1 day'; } - if (message.expire == 168) { t = '1 week'; } - if (message.expire == 5040) { t = '1 month'; } - if (message.expire == 0) { t = 'Unlimited'; } - QH('agentInvitationLink', 'Invitation Link (' + t + ')'); + var t = format("{0} hour{1}", message.expire, addLetterS(message.expire)); + if (message.expire == 24) { t = "1 day"; } + if (message.expire == 168) { t = "1 week"; } + if (message.expire == 5040) { t = "1 month"; } + if (message.expire == 0) { t = "Unlimited"; } + QH('agentInvitationLink', format("Invitation Link ({0})", t)); QV('agentInvitationLinkDiv', true); break; } case 'getmqttlogin': { if ((currentNode == null) || (currentNode._id != message.nodeid) || (xxdialogMode != null)) return; - var x = "These settings can be used to connect MQTT for this device.

"; + var x = "These settings can be used to connect MQTT for this device." + '

'; delete message.action; delete message.nodeid; x += ''; @@ -2354,7 +2354,7 @@ function onRealNameCheckBox() { showRealNames = Q('RealNameCheckBox').checked; - putstore("showRealNames", showRealNames ? 1 : 0); + putstore('showRealNames', showRealNames ? 1 : 0); masterUpdate(6); return; } @@ -2363,15 +2363,15 @@ if (i != null) { Q('viewselect').value = i; } for (var j = 1; j < 5; j++) { Q('devViewButton' + j).classList.remove('viewSelectorSel'); } Q('devViewButton' + Q('viewselect').value).classList.add('viewSelectorSel'); - putstore("_deviceView", Q('viewselect').value); - putstore("_viewsize", Q('sizeselect').value); + putstore('_deviceView', Q('viewselect').value); + putstore('_viewsize', Q('sizeselect').value); masterUpdate(4); setTimeout(function () { masterUpdate(512); }, 200); } function ondockeypress(e) { setSessionActivity(); - if (!xxdialogMode && xxcurrentView == 11 && desktop && Q("DeskControl").checked) { + if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) { // Check what keys we are allows to send if (currentNode != null) { var mesh = meshes[currentNode.meshid]; @@ -2401,7 +2401,7 @@ if (e.ctrlKey == true && e.charCode == 96) { showRealNames = !showRealNames; Q('RealNameCheckBox').value = showRealNames; - putstore("showRealNames", showRealNames ? 1 : 0); + putstore('showRealNames', showRealNames ? 1 : 0); masterUpdate(6) return; } @@ -2431,7 +2431,7 @@ function ondockeydown(e) { setSessionActivity(); - if (!xxdialogMode && xxcurrentView == 11 && desktop && Q("DeskControl").checked) { + if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) { // Check what keys we are allows to send if (currentNode != null) { var mesh = meshes[currentNode.meshid]; @@ -2466,7 +2466,7 @@ function ondockeyup(e) { setSessionActivity(); - if (!xxdialogMode && xxcurrentView == 11 && desktop && Q("DeskControl").checked) { + if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked) { // Check what keys we are allows to send if (currentNode != null) { var mesh = meshes[currentNode.meshid]; @@ -2489,7 +2489,7 @@ //function ondocfocus() { } // TODO: Add handleReleaseKeys() for Intel AMT. - function ondocblur() { if (!xxdialogMode && xxcurrentView == 11 && desktop && Q("DeskControl").checked && desktop.m.handleReleaseKeys) { return desktop.m.handleReleaseKeys(); } } + function ondocblur() { if (!xxdialogMode && xxcurrentView == 11 && desktop && Q('DeskControl').checked && desktop.m.handleReleaseKeys) { return desktop.m.handleReleaseKeys(); } } // Highlights the device being hovered function devMouseHover(element, over) { @@ -3853,7 +3853,7 @@ } map_cm_nodemenu_items.forEach(function (item){ if (item.text == 'Zoom-in to extent' || item.text == 'Zoom-out to extent') { item.data = feature; } - else { if (item != "-") { item.data = feature.getId(); } } + else { if (item != '-') { item.data = feature.getId(); } } }); xxmap.contextmenu.extend(map_cm_nodemenu_items); } @@ -4436,9 +4436,9 @@ // Update the web page title if ((currentNode) && (xxcurrentView >= 10) && (xxcurrentView < 20)) { - document.title = decodeURIComponent("{{{extitle}}}") + ' - ' + currentNode.name + ' - ' + mesh.name; + document.title = decodeURIComponent('{{{extitle}}}') + ' - ' + currentNode.name + ' - ' + mesh.name; } else { - document.title = decodeURIComponent("{{{extitle}}}"); + document.title = decodeURIComponent('{{{extitle}}}'); } // Clear user consent status if present @@ -4500,13 +4500,13 @@ function deviceActionFunction() { if (xxdialogMode) return; var meshrights = meshes[currentNode.meshid].links[userinfo._id].rights; - var x = "Select an operation to perform on this device.

"; + var x = "Select an operation to perform on this device." + '

'; var y = ''; - x += addHtmlValue('Operation', y); + x += addHtmlValue("Operation", y); setDialogMode(2, "Device Action", 3, deviceActionFunctionEx, x); } @@ -4615,9 +4615,9 @@ if (xxdialogMode) return; var x = '', node = getNodeFromId(nodeid), buttons = 3, meshrights = getNodeRights(nodeid); if ((meshrights & 4) == 0) return; - x += addHtmlValue('Username', ''); - x += addHtmlValue('Password', ''); - x += addHtmlValue('Security', ''); + x += addHtmlValue("Username", ''); + x += addHtmlValue("Password", ''); + x += addHtmlValue("Security", ''); if ((node.intelamt.user != null) && (node.intelamt.user != '')) { buttons = 7; } setDialogMode(2, "Edit Intel® AMT credentials", buttons, editDeviceAmtSettingsEx, x, { node: node, func: func, arg: arg }); if ((node.intelamt.user != null) && (node.intelamt.user != '')) { Q('dp10username').value = node.intelamt.user; } else { Q('dp10username').value = 'admin'; } @@ -4648,8 +4648,8 @@ function p10showSendMqttMsgDialog(nodeids) { if (xxdialogMode) return false; - var x = addHtmlValue('Topic', ''); - x += addHtmlValue('Message', '
'); + var x = addHtmlValue("Topic", ''); + x += addHtmlValue("Message", '
'); setDialogMode(2, "Send MQTT message", 3, p10showSendMqttMsgDialogEx, x, nodeids); p10validateSendMqttMsgDialog(); Q('dp2topic').focus(); @@ -4670,16 +4670,16 @@ if (nodeids.length == 1) { try { targetMeshId = meshes[getNodeFromId(nodeids[0])]._id; } catch (ex) { } } // List all available alternative groups - var y = "', count = 0; for (var i in meshes) { var meshrights = meshes[i].links[userinfo._id].rights; - if ((meshes[i]._id != targetMeshId) && (meshrights & 4)) { count++; y += ""; } + if ((meshes[i]._id != targetMeshId) && (meshrights & 4)) { count++; y += ''; } } y += ""; if (count > 0) { - var x = (nodeids.length == 1) ? "Select a new group for this device

" : "Select a new group for selected devices

"; - x += addHtmlValue('New Device Group', y); + var x = (nodeids.length == 1) ? ("Select a new group for this device" + '

') : ("Select a new group for selected devices" + '

'); + x += addHtmlValue("New Device Group", y); setDialogMode(2, "Change Group", 3, p10showChangeGroupDialogEx, x, nodeids); } else { setDialogMode(2, "Change Group", 1, null, "No other device group of same type exists."); @@ -4693,8 +4693,8 @@ function p10showDeleteNodeDialog(nodeid) { if (xxdialogMode) return false; - var x = "Are you sure you want to delete node \"" + EscapeHtml(currentNode.name) + "\"?

"; - x += ""; + var x = format("Are you sure you want to delete node {0}?", EscapeHtml(currentNode.name)) + '

'; + x += ''; setDialogMode(2, "Delete Node", 3, p10showDeleteNodeDialogEx, x, nodeid); p10validateDeleteNodeDialog(); return false; @@ -4764,7 +4764,7 @@ // Show network interfaces function p10showNodeNetInfoDialog() { if (xxdialogMode) return false; - setDialogMode(2, "Network Interfaces", 1, null, "
Loading...
", 'if' + currentNode._id ); + setDialogMode(2, "Network Interfaces", 1, null, '
' + "Loading..." + '
', 'if' + currentNode._id ); meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id }); return false; } @@ -4772,9 +4772,9 @@ // Show MeshCentral Router dialog function p10showMeshRouterDialog() { if (xxdialogMode) return; - var x = "
MeshCentral Router is a Windows tool for TCP port mapping. You can, for example, RDP into a remote device thru this server.

"; + var x = '
' + "MeshCentral Router is a Windows tool for TCP port mapping. You can, for example, RDP into a remote device thru this server." + '

'; x += addHtmlValue('Win32 Executable', 'MeshCentralRouter.exe'); - setDialogMode(2, "MeshCentral Router", 1, null, x, "fileDownload"); + setDialogMode(2, "MeshCentral Router", 1, null, x, 'fileDownload'); } // Request MQTT login credentials @@ -4783,14 +4783,14 @@ // Show MeshCmd dialog function p10showMeshCmdDialog(mode, nodeid) { if (xxdialogMode) return; - var y = ""; + var y = ''; var x = ""; if (mode == 0) { x += '
MeshCmd is a command line tool that performs lots of different operations. The action file can optionally be downloaded and edited to provide server information and credentials.

'; } @@ -4800,13 +4800,13 @@ if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); } if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); } x += "
"; - setDialogMode(2, ["Download MeshCmd","Network Router"][mode], 9, null, x, "fileDownload"); + setDialogMode(2, [ "Download MeshCmd", "Network Router" ][mode], 9, null, x, 'fileDownload'); meshCmdOsClick(); } function meshCmdOsClick() { var os = Q('aginsSelect').value, osn = '', osurl = ''; - //Q('meshcmddownloadid').href = "meshagents?meshcmd=" + os; + //Q('meshcmddownloadid').href = 'meshagents?meshcmd=' + os; if (os == 3) { osn = 'MeshCmd (Win32 executable)'; } if (os == 4) { osn = 'MeshCmd (Win64 executable)'; } if (os == 5) { osn = 'MeshCmd (Linux x86, 32bit)'; } @@ -4839,9 +4839,9 @@ meshserver.send({ action: 'changedevice', nodeid: currentNode._id, icon: icon }); } - var showEditNodeValueDialog_modes = ['Device Name', 'Hostname', 'Description', 'Tags']; + var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Description", "Tags"]; var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags']; - var showEditNodeValueDialog_modes3 = ['', '', '', 'Tag1, Tag2, Tag3']; + var showEditNodeValueDialog_modes3 = ['', '', '', "Tag1, Tag2, Tag3"]; function showEditNodeValueDialog(mode) { if (xxdialogMode) return; var x = addHtmlValue(showEditNodeValueDialog_modes[mode], ''); @@ -5008,7 +5008,7 @@ // Switch to software KVM //if (urlvars && urlvars['kvmdatatrace']) { console.log('WebRTC Data Channel Open'); } console.log('WebRTC Data Channel Open'); - Q('deskstatus').textContent = StatusStrs[desktop.State] + ', Soft-KVM'; + Q('deskstatus').textContent = StatusStrs[desktop.State] + ", Soft-KVM"; desktop.m.hold(true); webRtcDesktop.webRtcActive = true; webRtcDesktop.softdesktop = CreateKvmDataChannel(webRtcDesktop.webchannel, CreateAgentRemoteDesktop('Desk', Q('id_mainarea')), desktop.m); @@ -5120,7 +5120,7 @@ var xstate = state; if ((xstate == 3) && (xdesktop.contype == 2)) { xstate++; } var str = StatusStrs[xstate]; - if ((desktop != null) && (desktop.webRtcActive == true)) { str += ', WebRTC'; } + if ((desktop != null) && (desktop.webRtcActive == true)) { str += ", WebRTC"; } //if (desktop.m.stopInput == true) { str += ', Loopback'; } QH('deskstatus', str); switch (state) { @@ -5131,7 +5131,7 @@ QV('DeskFocus', false); QV('termdisplays', false); QV('deskRecordIcon', false); - deskFocusBtn.value = 'All Focus'; + deskFocusBtn.value = "All Focus"; if (fullscreen == true) { deskToggleFull(); } webRtcDesktopReset(); deskPreferedStickyDisplay = 0; @@ -5198,7 +5198,7 @@ } } if (desktop.contype == 2) { - if (desktopsettings.showfocus == false) { desktop.m.focusmode = 0; deskFocusBtn.value = 'All Focus'; } + if (desktopsettings.showfocus == false) { desktop.m.focusmode = 0; deskFocusBtn.value = "All Focus"; } if (desktop.State != 0) { desktop.Stop(); setTimeout(function () { connectDesktop(null, 2); }, 50); } } } @@ -5262,7 +5262,7 @@ function deskToggleFocus() { desktop.m.focusmode = (desktop.m.focusmode + 64) % 192; - Q('deskFocusBtn').value = ['All Focus', 'Small Focus', 'Large Focus'][desktop.m.focusmode / 64]; + Q('deskFocusBtn').value = ["All Focus", "Small Focus", "Large Focus"][desktop.m.focusmode / 64]; } function deskAdjust() { @@ -5312,7 +5312,7 @@ if (!mod || !sw || !sh || !cv) return; // Check if we are in single desktop mode - if (cv.id == "Desk") { deskAdjust(); return; } + if (cv.id == 'Desk') { deskAdjust(); return; } // Figure out and adjust the size to fill the width of the div var vsize = [{ x: 180, y: 101 }, { x: 302, y: 169 }, { x: 454, y: 255 }][Q('sizeselect').selectedIndex]; @@ -5418,7 +5418,7 @@ function showDeskType() { if (xxdialogMode || desktop == null || desktop.State != 3) return; Q('DeskType').blur(); - var x = '
Enter text and click OK to remotely type it using a US english keyboard. Make sure to place the remote cursor at the correct position before proceeding.
'; + var x = '
' + "Enter text and click OK to remotely type it using a US english keyboard. Make sure to place the remote cursor at the correct position before proceeding." + '
'; x += ''; setDialogMode(2, "Remote Keyboard Entry", 3, showDeskTypeEx, x); Q('d2typeText').focus(); @@ -5471,7 +5471,7 @@ x += ''; x += '
'; x += ''; - x += '
 
'; + x += '
 
'; setDialogMode(2, "Remote Clipboard", 8, null, x, 'clipboard'); Q('d2clipText').focus(); } @@ -5591,20 +5591,20 @@ var service = deskTools.services[index]; if (service != null) { var x = ''; - if (service.name) { x += addHtmlValue('Name', service.name); } - if (service.displayName) { x += addHtmlValue('Display name', service.displayName); } + if (service.name) { x += addHtmlValue("Name", service.name); } + if (service.displayName) { x += addHtmlValue("Display name", service.displayName); } if (service.status) { - if (service.status.state) { x += addHtmlValue('State', capitalizeFirstLetter(service.status.state.toLowerCase())); } - if (service.status.pid) { x += addHtmlValue('PID', service.status.pid); } + if (service.status.state) { x += addHtmlValue("State", capitalizeFirstLetter(service.status.state.toLowerCase())); } + if (service.status.pid) { x += addHtmlValue("PID", service.status.pid); } var serviceTypes = []; - if (service.status.isFileSystemDriver === true) { serviceTypes.push('FileSystemDriver'); } - if (service.status.isInteractive === true) { serviceTypes.push('Interactive'); } - if (service.status.isKernelDriver === true) { serviceTypes.push('KernelDriver'); } - if (service.status.isOwnProcess === true) { serviceTypes.push('OwnProcess'); } - if (service.status.isSharedProcess === true) { serviceTypes.push('SharedProcess'); } - if (serviceTypes.length > 0) { x += addHtmlValue('Type', serviceTypes.join(', ')); } + if (service.status.isFileSystemDriver === true) { serviceTypes.push("FileSystemDriver"); } + if (service.status.isInteractive === true) { serviceTypes.push("Interactive"); } + if (service.status.isKernelDriver === true) { serviceTypes.push("KernelDriver"); } + if (service.status.isOwnProcess === true) { serviceTypes.push("OwnProcess"); } + if (service.status.isSharedProcess === true) { serviceTypes.push("SharedProcess"); } + if (serviceTypes.length > 0) { x += addHtmlValue("Type", serviceTypes.join(', ')); } } - x += '
'; + x += '
'; setDialogMode(2, "Service Details", 8, null, x, name); } } @@ -5627,8 +5627,8 @@ // Save the desktop image to file function deskSaveImage() { if (xxdialogMode || desktop == null || desktop.State != 3) return; - var d = new Date(), n = 'Desktop-' + currentNode.name + '-' + d.getFullYear() + "-" + ("0" + (d.getMonth() + 1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + "-" + ("0" + d.getMinutes()).slice(-2); - Q("Desk")['toBlob'](function (blob) { saveAs(blob, n + ".jpg"); }); + var d = new Date(), n = 'Desktop-' + currentNode.name + '-' + d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + ('0' + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2); + Q('Desk')['toBlob'](function (blob) { saveAs(blob, n + '.jpg'); }); } function deskDisplayInfo(sender, displays, selDisplay) { @@ -5664,8 +5664,8 @@ function dmousemove(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousemove(e); desktop.m.sendKeepAlive(); } else { desktop.m.mousemove(e); } } } function dmousewheel(e) { setSessionActivity(); e.addx = Q('DeskParent').scrollLeft; e.addy = Q('DeskParent').scrollTop; if (!xxdialogMode && desktop != null && Q('DeskControl').checked) { if ((webRtcDesktop != null) && (webRtcDesktop.softdesktop != null)) { webRtcDesktop.softdesktop.m.mousewheel(e); desktop.m.sendKeepAlive(); } else { if (desktop.m.mousewheel) { desktop.m.mousewheel(e); } } haltEvent(e); return true; } return false; } function drotate(x) { if (!xxdialogMode && desktop != null) { desktop.m.setRotation(desktop.m.rotation + x); deskAdjust(); deskAdjust(); } } - function stopProcess(id, name) { setDialogMode(2, "Process Control", 3, stopProcessEx, 'Stop process #' + id + ' "' + name + '"?', id); return false; } - function stopProcessEx(buttons, tag) { meshserver.send({ action: 'msg', type:'pskill', nodeid: currentNode._id, value: tag }); setTimeout(refreshDeskTools, 300); } + function stopProcess(id, name) { setDialogMode(2, "Process Control", 3, stopProcessEx, format("Stop process #{0} \"{1}\"?", id, name), id); return false; } + function stopProcessEx(buttons, tag) { meshserver.send({ action: 'msg', type: 'pskill', nodeid: currentNode._id, value: tag }); setTimeout(refreshDeskTools, 300); } // // TERMINAL @@ -5709,7 +5709,7 @@ if (terminal) { Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation]; Q('id_tfxkeysbutton').value = fxEmulations[terminal.m.fxEmulation]; - Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n')?'CR+LF':'LF'; + Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n')?"CR+LF":"LF"; } } @@ -5718,7 +5718,7 @@ var xstate = state; if ((xstate == 3) && (xterminal.contype == 2)) { xstate++; } var str = StatusStrs[xstate]; - if (terminal.webRtcActive == true) { str += ', WebRTC'; } + if (terminal.webRtcActive == true) { str += ", WebRTC"; } QH('termstatus', str); switch (state) { case 0: @@ -5806,7 +5806,7 @@ Q('connectbutton2').blur(); // Deselect the connect button so the button does not get key presses. } - var terminalEmulations = ['UTF8 Terminal', 'Extended ASCII', 'Intel ASCII']; + var terminalEmulations = ["UTF8 Terminal", "Extended ASCII", "Intel ASCII"]; function termToggleType() { if (!terminal || xxdialogMode) return; terminal.m.terminalEmulation = (terminal.m.terminalEmulation + 1) % 3; @@ -5814,7 +5814,7 @@ Q('id_ttypebutton').blur(); // Deselect the connect button so the button does not get key presses. } - var fxEmulations = ['Intel (F10 = ESC+[OM)', 'Alternate (F10 = ESC+0)', 'VT100+ (F10 = ESC+[OY)']; + var fxEmulations = ["Intel (F10 = ESC+[OM)", "Alternate (F10 = ESC+0)", "VT100+ (F10 = ESC+[OY)"]; function termToggleFx() { if (!terminal || xxdialogMode) return; terminal.m.fxEmulation = (terminal.m.fxEmulation + 1) % 3; @@ -5825,7 +5825,7 @@ function termToggleCr() { if (!terminal || xxdialogMode) return; if (terminal.m.lineFeed == '\n') { terminal.m.lineFeed = '\r\n'; } else { terminal.m.lineFeed = '\n'; } - Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n') ? 'CR+LF' : 'LF'; + Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n') ? "CR+LF" : "LF"; } function termSendKey(key, id) { @@ -5868,9 +5868,9 @@ } function onFilesStateChange(xfiles, state) { - p13Connect.value = (state == 0) ? 'Connect' : 'Disconnect'; + p13Connect.value = (state == 0) ? "Connect" : "Disconnect"; var str = StatusStrs[state]; - if (files.webRtcActive == true) { str += ', WebRTC'; } + if (files.webRtcActive == true) { str += ", WebRTC"; } Q('p13Status').textContent = str; switch (state) { case 0: @@ -5993,7 +5993,7 @@ // Figure out the date var fdatestr = ''; - if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + " "; } + if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + ' '; } // Figure out the size var fsize = ''; @@ -6002,11 +6002,11 @@ var h = ''; if (f.t < 3) { var right = '', title = ''; - h = "
 " + right + "
" + shortname + "
"; + h = '
 ' + right + '
' + shortname + '
'; } else { var link = shortname; - if (f.s > 0) { link = "" + shortname + ""; } - h = "
 " + fdatestr + "" + fsize + "
" + link + "
"; + if (f.s > 0) { link = '' + shortname + ''; } + h = '
 ' + fdatestr + '' + fsize + '
' + link + '
'; } if (f.t < 3) { html1 += h; } else { html2 += h; } @@ -6060,7 +6060,7 @@ QE('p13RenameFileButton', false); QE('p13ViewFileButton', false); QE('p13SelectAllButton', false); - Q('p13SelectAllButton').value = 'Select All'; + Q('p13SelectAllButton').value = "Select All"; QE('p13RefreshButton', false); QE('p13CutButton', false); QE('p13CopyButton', false); @@ -6074,7 +6074,7 @@ QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13ViewFileButton', (cc == 1) && (sfc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13SelectAllButton', tc > 0); - Q('p13SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All'); + Q('p13SelectAllButton').value = (cc > 0 ? "Select None" : "Select All"); QE('p13RefreshButton', true); QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); @@ -6088,7 +6088,7 @@ function p13selectallfile() { var nv = (p13getFileSelCount() == 0), checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p13setActions(); } function p13createfolder() { setDialogMode(2, "New Folder", 3, p13createfolderEx, ''); focusTextBox('p13renameinput'); p13fileNameCheck(); } function p13createfolderEx() { files.sendText({ action: 'mkdir', reqid: 1, path: p13filetreelocation.join('/') + '/' + Q('p13renameinput').value }); p13folderup(999); } - function p13deletefile() { var cc = p13getFileSelCount(), rec = (p13getFileSelDirCount() > 0) ? "


" : ""; setDialogMode(2, "Delete", 3, p13deletefileEx, (cc > 1) ? ('Delete ' + cc + ' selected items?' + rec) : ('Delete selected item?' + rec)); } + function p13deletefile() { var cc = p13getFileSelCount(), rec = (p13getFileSelDirCount() > 0) ? '


' : ""; setDialogMode(2, "Delete", 3, p13deletefileEx, (cc > 1) ? (format("Delete {0} selected items?", cc) + rec) : ("Delete selected item?" + rec)); } function p13deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(p13filetree.dir[checkboxes[i].value].n); } } files.sendText({ action: 'rm', reqid: 1, path: p13filetreelocation.join('/'), delfiles: delfiles, rec: Q('p13recdeleteinput').checked }); p13folderup(999); } function p13renamefile() { var renamefile, checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = p13filetree.dir[checkboxes[i].value].n; } } setDialogMode(2, "Rename", 3, p13renamefileEx, '', { action: 'rename', path: p13filetreelocation.join('/'), oldname: renamefile}); focusTextBox('p13renameinput'); p13fileNameCheck(); } function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.sendText(t); p13folderup(999); } @@ -6101,7 +6101,7 @@ if (checkboxes[i].checked) { if (p13filetree.dir[checkboxes[i].value].s <= 204800) { p13downloadfile(encodeURIComponent(p13filetreelocation.join('/') + '/' + p13filetree.dir[checkboxes[i].value].n), encodeURIComponent(p13filetree.dir[checkboxes[i].value].n), p13filetree.dir[checkboxes[i].value].s, 'viewer'); - } else { messagebox('File Editor', 'Only files less than 200k can be edited.'); } + } else { messagebox("File Editor", "Only files less than 200k can be edited."); } break; } } @@ -6139,7 +6139,7 @@ function p13fileDragLeave(e) { haltEvent(e); - if (e.target.id != "p13filetable") { + if (e.target.id != 'p13filetable') { QV('p13bigfail', false); QV('p13bigok', false); } else { @@ -6201,7 +6201,7 @@ function p13editSaveBack(b, tag) { var data = new TextEncoder().encode(Q('p13fileeditarea').value); - p13uploadFileContinue(1, [{ name: tag, size: data.byteLength, type: "text/plain", xdata: data }]); + p13uploadFileContinue(1, [{ name: tag, size: data.byteLength, type: 'text/plain', xdata: data }]); } /* @@ -6291,7 +6291,7 @@ p13uploadFileContinue(1, files); } else { // Otherwise, prompt for confirmation - setDialogMode(2, "Upload File", 3, p13uploadFileContinue, 'Upload will overwrite ' + overWriteCount + ' file' + addLetterS(overWriteCount) + '. Continue?', files); + setDialogMode(2, "Upload File", 3, p13uploadFileContinue, format("Upload will overwrite {0} file{1}. Continue?", overWriteCount, addLetterS(overWriteCount)), files); } } @@ -6300,7 +6300,7 @@ uploadFile.xpath = p13filetreelocation.join('/'); uploadFile.xfiles = files; uploadFile.xfilePtr = -1; - setDialogMode(2, "Upload File", 10, p13uploadFileCancel, '
Connecting...

'); + setDialogMode(2, "Upload File", 10, p13uploadFileCancel, '
' + "Connecting..." + '

'); p13uploadReconnect(); } @@ -6431,7 +6431,7 @@ } } if (dateHeader != null) x += ''; - if (x == '') x = "
No Events Found

"; + if (x == '') x = '
' + "No Events Found" + '

'; QH('p16events', x); } @@ -6505,7 +6505,7 @@ var samenode = (consoleNode == 'server'); consoleNode = 'server'; - QH('p15deviceName', 'My Server Console'); + QH('p15deviceName', "My Server Console"); QE('p15consoleText', true); QH('p15statetext', ''); QH('p15coreName', ''); @@ -6530,13 +6530,13 @@ } var online = (((consoleNode.conn & 1) != 0) || ((consoleNode.conn & 16) != 0)) ? true : false; var onlineText = ((consoleNode.conn & 1) != 0) ? "Agent is online" : "Agent is offline" - if ((consoleNode.conn & 16) != 0) { onlineText += ', MQTT is online' } + if ((consoleNode.conn & 16) != 0) { onlineText += ", MQTT is online" } QH('p15statetext', onlineText); QE('p15consoleText', online); QE('p15uploadCore', ((consoleNode.conn & 1) != 0)); QV('p15outputselecttd', (consoleNode.conn & 17) == 17); } else { - QH('p15statetext', 'Access Denied'); + QH('p15statetext', "Access Denied"); QE('p15consoleText', false); QE('p15uploadCore', false); QV('p15outputselecttd', false); @@ -6568,7 +6568,7 @@ } else { if (((consoleNode.conn & 16) != 0) && ((Q('p15outputselect').value == 2) || ((consoleNode.conn & 1) == 0))) { // Send the command to MQTT - t = '
MQTT> ' + EscapeHtml(v) + '
'; + t = '
' + "MQTT" + '> ' + EscapeHtml(v) + '
'; consoleNode.consoleText += t; meshserver.send({ action: 'sendmqttmsg', topic: 'console', nodeids: [ consoleNode._id ], msg: v }); } else { @@ -6604,7 +6604,7 @@ } } else { // Agent console data - if (source == 'MQTT') { data = '
MQTT> ' + EscapeHtml(data) + '
'; } else { data = '
' + data + '
' } + if (source == 'MQTT') { data = '
' + "MQTT" + '> ' + EscapeHtml(data) + '
'; } else { data = '
' + data + '
' } if (node.consoleText == null) { node.consoleText = data; } else { node.consoleText += data; } if (consoleNode == node) { Q('p15agentConsoleText').innerHTML += data; @@ -6624,7 +6624,7 @@ if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'default' }); } // Upload default core else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'clear' }); } // Clear the core else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file - else { setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue('Action', '')); } + else { setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", '')); } } function p15uploadCoreEx() { @@ -6714,12 +6714,12 @@ function account_addhkey(type) { if (type == 3) { - var x = "Type in the name of the key to add.

"; - x += addHtmlValue('Key Name', ''); + var x = "Type in the name of the key to add." + '

'; + x += addHtmlValue("Key Name", ''); } else if (type == 2) { - var x = "Type in a key name, select the OTP box and press the button on the YubiKey™.

"; - x += addHtmlValue('Key Name', ''); - x += addHtmlValue('YubiKey™ OTP', ''); + var x = "Type in a key name, select the OTP box and press the button on the YubiKey™." + '

'; + x += addHtmlValue("Key Name", ''); + x += addHtmlValue("YubiKey™ OTP", ''); } setDialogMode(2, "Add Security Key", 3, account_addhkeyEx, x, type); Q('dp1keyname').focus(); @@ -6734,7 +6734,7 @@ if (name == '') { name = 'MyKey'; } if (type == 2) { meshserver.send({ action: 'otp-hkey-yubikey-add', name: name, otp: Q('dp1key').value }); - setDialogMode(2, "Add Security Key", 0, null, "
Checking...


", 'otpauth-hardware-manage'); + setDialogMode(2, "Add Security Key", 0, null, '
' + "Checking..." + '


', 'otpauth-hardware-manage'); } else if (type == 3) { meshserver.send({ action: 'webauthn-startregister', name: name }); } @@ -6745,14 +6745,14 @@ meshserver.send({ action: 'otp-hkey-get' }); } - var loclist = { "af": "Afrikaans", "sq": "Albanian", "ar": "Arabic (Standard)", "ar-dz": "Arabic (Algeria)", "ar-bh": "Arabic (Bahrain)", "ar-eg": "Arabic (Egypt)", "ar-iq": "Arabic (Iraq)", "ar-jo": "Arabic (Jordan)", "ar-kw": "Arabic (Kuwait)", "ar-lb": "Arabic (Lebanon)", "ar-ly": "Arabic (Libya)", "ar-ma": "Arabic (Morocco)", "ar-om": "Arabic (Oman)", "ar-qa": "Arabic (Qatar)", "ar-sa": "Arabic (Saudi Arabia)", "ar-sy": "Arabic (Syria)", "ar-tn": "Arabic (Tunisia)", "ar-ae": "Arabic (U.A.E.)", "ar-ye": "Arabic (Yemen)", "an": "Aragonese", "hy": "Armenian", "as": "Assamese", "ast": "Asturian", "az": "Azerbaijani", "eu": "Basque", "bg": "Bulgarian", "be": "Belarusian", "bn": "Bengali", "bs": "Bosnian", "br": "Breton", "my": "Burmese", "ca": "Catalan", "ch": "Chamorro", "ce": "Chechen", "zh": "Chinese", "zh-hk": "Chinese (Hong Kong)", "zh-cn": "Chinese (PRC)", "zh-sg": "Chinese (Singapore)", "zh-tw": "Chinese (Taiwan)", "cv": "Chuvash", "co": "Corsican", "cr": "Cree", "hr": "Croatian", "cs": "Czech", "da": "Danish", "nl": "Dutch (Standard)", "nl-be": "Dutch (Belgian)", "en": "English", "en-au": "English (Australia)", "en-bz": "English (Belize)", "en-ca": "English (Canada)", "en-ie": "English (Ireland)", "en-jm": "English (Jamaica)", "en-nz": "English (New Zealand)", "en-ph": "English (Philippines)", "en-za": "English (South Africa)", "en-tt": "English (Trinidad & Tobago)", "en-gb": "English (United Kingdom)", "en-us": "English (United States)", "en-zw": "English (Zimbabwe)", "eo": "Esperanto", "et": "Estonian", "fo": "Faeroese", "fa": "Farsi (Persian)", "fj": "Fijian", "fi": "Finnish", "fr": "French (Standard)", "fr-be": "French (Belgium)", "fr-ca": "French (Canada)", "fr-fr": "French (France)", "fr-lu": "French (Luxembourg)", "fr-mc": "French (Monaco)", "fr-ch": "French (Switzerland)", "fy": "Frisian", "fur": "Friulian", "gd": "Gaelic (Scots)", "gd-ie": "Gaelic (Irish)", "gl": "Galacian", "ka": "Georgian", "de": "German (Standard)", "de-at": "German (Austria)", "de-de": "German (Germany)", "de-li": "German (Liechtenstein)", "de-lu": "German (Luxembourg)", "de-ch": "German (Switzerland)", "el": "Greek", "gu": "Gujurati", "ht": "Haitian", "he": "Hebrew", "hi": "Hindi", "hu": "Hungarian", "is": "Icelandic", "id": "Indonesian", "iu": "Inuktitut", "ga": "Irish", "it": "Italian (Standard)", "it-ch": "Italian (Switzerland)", "ja": "Japanese", "kn": "Kannada", "ks": "Kashmiri", "kk": "Kazakh", "km": "Khmer", "ky": "Kirghiz", "tlh": "Klingon", "ko": "Korean", "ko-kp": "Korean (North Korea)", "ko-kr": "Korean (South Korea)", "la": "Latin", "lv": "Latvian", "lt": "Lithuanian", "lb": "Luxembourgish", "mk": "FYRO Macedonian", "ms": "Malay", "ml": "Malayalam", "mt": "Maltese", "mi": "Maori", "mr": "Marathi", "mo": "Moldavian", "nv": "Navajo", "ng": "Ndonga", "ne": "Nepali", "no": "Norwegian", "nb": "Norwegian (Bokmal)", "nn": "Norwegian (Nynorsk)", "oc": "Occitan", "or": "Oriya", "om": "Oromo", "fa-ir": "Persian/Iran", "pl": "Polish", "pt": "Portuguese", "pt-br": "Portuguese (Brazil)", "pa": "Punjabi", "pa-in": "Punjabi (India)", "pa-pk": "Punjabi (Pakistan)", "qu": "Quechua", "rm": "Rhaeto-Romanic", "ro": "Romanian", "ro-mo": "Romanian (Moldavia)", "ru": "Russian", "ru-mo": "Russian (Moldavia)", "sz": "Sami (Lappish)", "sg": "Sango", "sa": "Sanskrit", "sc": "Sardinian", "sd": "Sindhi", "si": "Singhalese", "sr": "Serbian", "sk": "Slovak", "sl": "Slovenian", "so": "Somani", "sb": "Sorbian", "es": "Spanish", "es-ar": "Spanish (Argentina)", "es-bo": "Spanish (Bolivia)", "es-cl": "Spanish (Chile)", "es-co": "Spanish (Colombia)", "es-cr": "Spanish (Costa Rica)", "es-do": "Spanish (Dominican Republic)", "es-ec": "Spanish (Ecuador)", "es-sv": "Spanish (El Salvador)", "es-gt": "Spanish (Guatemala)", "es-hn": "Spanish (Honduras)", "es-mx": "Spanish (Mexico)", "es-ni": "Spanish (Nicaragua)", "es-pa": "Spanish (Panama)", "es-py": "Spanish (Paraguay)", "es-pe": "Spanish (Peru)", "es-pr": "Spanish (Puerto Rico)", "es-es": "Spanish (Spain)", "es-uy": "Spanish (Uruguay)", "es-ve": "Spanish (Venezuela)", "sx": "Sutu", "sw": "Swahili", "sv": "Swedish", "sv-fi": "Swedish (Finland)", "sv-sv": "Swedish (Sweden)", "ta": "Tamil", "tt": "Tatar", "te": "Teluga", "th": "Thai", "tig": "Tigre", "ts": "Tsonga", "tn": "Tswana", "tr": "Turkish", "tk": "Turkmen", "uk": "Ukrainian", "hsb": "Upper Sorbian", "ur": "Urdu", "ve": "Venda", "vi": "Vietnamese", "vo": "Volapuk", "wa": "Walloon", "cy": "Welsh", "xh": "Xhosa", "ji": "Yiddish", "zu": "Zulu" }; + var loclist = { 'af': "Afrikaans", 'sq': "Albanian", 'ar': "Arabic (Standard)", 'ar-dz': "Arabic (Algeria)", 'ar-bh': "Arabic (Bahrain)", 'ar-eg': "Arabic (Egypt)", 'ar-iq': "Arabic (Iraq)", 'ar-jo': "Arabic (Jordan)", 'ar-kw': "Arabic (Kuwait)", 'ar-lb': "Arabic (Lebanon)", 'ar-ly': "Arabic (Libya)", 'ar-ma': "Arabic (Morocco)", 'ar-om': "Arabic (Oman)", 'ar-qa': "Arabic (Qatar)", 'ar-sa': "Arabic (Saudi Arabia)", 'ar-sy': "Arabic (Syria)", 'ar-tn': "Arabic (Tunisia)", 'ar-ae': "Arabic (U.A.E.)", 'ar-ye': "Arabic (Yemen)", 'an': "Aragonese", 'hy': "Armenian", 'as': "Assamese", 'ast': "Asturian", 'az': "Azerbaijani", 'eu': "Basque", 'bg': "Bulgarian", 'be': "Belarusian", 'bn': "Bengali", 'bs': "Bosnian", 'br': "Breton", 'my': "Burmese", 'ca': "Catalan", 'ch': "Chamorro", 'ce': "Chechen", 'zh': "Chinese", 'zh-hk': "Chinese (Hong Kong)", 'zh-cn': "Chinese (PRC)", 'zh-sg': "Chinese (Singapore)", 'zh-tw': "Chinese (Taiwan)", 'cv': "Chuvash", 'co': "Corsican", 'cr': "Cree", 'hr': "Croatian", 'cs': "Czech", 'da': "Danish", 'nl': "Dutch (Standard)", 'nl-be': "Dutch (Belgian)", 'en': "English", 'en-au': "English (Australia)", 'en-bz': "English (Belize)", 'en-ca': "English (Canada)", 'en-ie': "English (Ireland)", 'en-jm': "English (Jamaica)", 'en-nz': "English (New Zealand)", 'en-ph': "English (Philippines)", 'en-za': "English (South Africa)", 'en-tt': "English (Trinidad & Tobago)", 'en-gb': "English (United Kingdom)", 'en-us': "English (United States)", 'en-zw': "English (Zimbabwe)", 'eo': "Esperanto", 'et': "Estonian", 'fo': "Faeroese", 'fa': "Farsi (Persian)", 'fj': "Fijian", 'fi': "Finnish", 'fr': "French (Standard)", 'fr-be': "French (Belgium)", 'fr-ca': "French (Canada)", 'fr-fr': "French (France)", 'fr-lu': "French (Luxembourg)", 'fr-mc': "French (Monaco)", 'fr-ch': "French (Switzerland)", 'fy': "Frisian", 'fur': "Friulian", 'gd': "Gaelic (Scots)", 'gd-ie': "Gaelic (Irish)", 'gl': "Galacian", 'ka': "Georgian", 'de': "German (Standard)", 'de-at': "German (Austria)", 'de-de': "German (Germany)", 'de-li': "German (Liechtenstein)", 'de-lu': "German (Luxembourg)", 'de-ch': "German (Switzerland)", 'el': "Greek", 'gu': "Gujurati", 'ht': "Haitian", 'he': "Hebrew", 'hi': "Hindi", 'hu': "Hungarian", 'is': "Icelandic", 'id': "Indonesian", 'iu': "Inuktitut", 'ga': "Irish", 'it': "Italian (Standard)", 'it-ch': "Italian (Switzerland)", 'ja': "Japanese", 'kn': "Kannada", 'ks': "Kashmiri", 'kk': "Kazakh", 'km': "Khmer", 'ky': "Kirghiz", 'tlh': "Klingon", 'ko': "Korean", 'ko-kp': "Korean (North Korea)", 'ko-kr': "Korean (South Korea)", 'la': "Latin", 'lv': "Latvian", 'lt': "Lithuanian", 'lb': "Luxembourgish", 'mk': "FYRO Macedonian", 'ms': "Malay", 'ml': "Malayalam", 'mt': "Maltese", 'mi': "Maori", 'mr': "Marathi", 'mo': "Moldavian", 'nv': "Navajo", 'ng': "Ndonga", 'ne': "Nepali", 'no': "Norwegian", 'nb': "Norwegian (Bokmal)", 'nn': "Norwegian (Nynorsk)", 'oc': "Occitan", 'or': "Oriya", 'om': "Oromo", 'fa-ir': "Persian/Iran", 'pl': "Polish", 'pt': "Portuguese", 'pt-br': "Portuguese (Brazil)", 'pa': "Punjabi", 'pa-in': "Punjabi (India)", 'pa-pk': "Punjabi (Pakistan)", 'qu': "Quechua", 'rm': "Rhaeto-Romanic", 'ro': "Romanian", 'ro-mo': "Romanian (Moldavia)", 'ru': "Russian", 'ru-mo': "Russian (Moldavia)", 'sz': "Sami (Lappish)", 'sg': "Sango", 'sa': "Sanskrit", 'sc': "Sardinian", 'sd': "Sindhi", 'si': "Singhalese", 'sr': "Serbian", 'sk': "Slovak", 'sl': "Slovenian", 'so': "Somani", 'sb': "Sorbian", 'es': "Spanish", 'es-ar': "Spanish (Argentina)", 'es-bo': "Spanish (Bolivia)", 'es-cl': "Spanish (Chile)", 'es-co': "Spanish (Colombia)", 'es-cr': "Spanish (Costa Rica)", 'es-do': "Spanish (Dominican Republic)", 'es-ec': "Spanish (Ecuador)", 'es-sv': "Spanish (El Salvador)", 'es-gt': "Spanish (Guatemala)", 'es-hn': "Spanish (Honduras)", 'es-mx': "Spanish (Mexico)", 'es-ni': "Spanish (Nicaragua)", 'es-pa': "Spanish (Panama)", 'es-py': "Spanish (Paraguay)", 'es-pe': "Spanish (Peru)", 'es-pr': "Spanish (Puerto Rico)", 'es-es': "Spanish (Spain)", 'es-uy': "Spanish (Uruguay)", 'es-ve': "Spanish (Venezuela)", 'sx': "Sutu", 'sw': "Swahili", 'sv': "Swedish", 'sv-fi': "Swedish (Finland)", 'sv-sv': "Swedish (Sweden)", 'ta': "Tamil", 'tt': "Tatar", 'te': "Teluga", 'th': "Thai", 'tig': "Tigre", 'ts': "Tsonga", 'tn': "Tswana", 'tr': "Turkish", 'tk': "Turkmen", 'uk': "Ukrainian", 'hsb': "Upper Sorbian", 'ur': "Urdu", 've': "Venda", 'vi': "Vietnamese", 'vo': "Volapuk", 'wa': "Walloon", 'cy': "Welsh", 'xh': "Xhosa", 'ji': "Yiddish", 'zu': "Zulu" }; function account_showLocalizationSettings() { if (xxdialogMode) return false; var n = getstore('loctag', 0); - var x = ''; for (var i in loclist) { x += ''; } x += ''; - var y = addHtmlValue('Localization', x); + var y = addHtmlValue("Localization", x); setDialogMode(2, "Localization Settings", 3, account_showLocalizationSettingsEx, y); return false; } @@ -6775,10 +6775,10 @@ function account_showAccountNotifySettings() { if (xxdialogMode) return false; var x = ''; - x += '
'; - x += '
'; - x += '
'; - x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; setDialogMode(2, "Notification Settings", 3, account_showAccountNotifySettingsEx, x); var n = getstore('notifications', 0); Q('p2notifyPlayNotifySound').checked = (n & 1); @@ -6799,7 +6799,7 @@ function account_showVerifyEmail() { if (xxdialogMode || (userinfo.emailVerified == true) || (serverinfo.emailcheck != true)) return false; - var x = "Click ok to send a verification mail to:
" + EscapeHtml(userinfo.email) + "
Please wait a few minute to receive the verification."; + var x = "Click ok to send a verification mail to:" + '
' + EscapeHtml(userinfo.email) + '
' + "Please wait a few minute to receive the verification."; setDialogMode(2, "Email Verification", 3, account_showVerifyEmailEx, x); return false; } @@ -6810,7 +6810,7 @@ function account_showChangeEmail() { if (xxdialogMode) return false; - var x = "Change your account email address here.

"; + var x = "Change your account email address here." + '

'; x += addHtmlValue('Email', ''); setDialogMode(2, "Email Address Change", 3, account_changeEmail, x); if (userinfo.email != null) { Q('dp2email').value = userinfo.email; } @@ -6830,10 +6830,10 @@ function account_showDeleteAccount() { if (xxdialogMode) return false; - var x = "To delete this account, type in the account password in both boxes below and hit ok.

"; - x += "
"; - x += ""; - x += ""; + var x = "To delete this account, type in the account password in both boxes below and hit ok." + '

'; + x += '
Password:
Password:
'; + x += ''; + x += ''; x += '
' + "Password:" + '
' + "Password:" + '

'; x += ''; x += ''; @@ -6848,13 +6848,13 @@ if (xxdialogMode) return false; var x = "Change your account password by entering the old password and new password twice in the boxes below."; if (features & 0x00010000) { " Password hint can be used but is not recommanded."; } - x += "

"; + x += '

'; //x += ""; - x += ""; - x += ""; - x += ""; - x += ""; - if (features & 0x00010000) { x += ""; } + x += '
Old password:
New password:
New password:
Password hint:
'; + x += ''; + x += ''; + x += ''; + if (features & 0x00010000) { x += ''; } x += '
Old password:
New password:
New password:
' + "Password hint:" + '
' if (passRequirements) { var r = [], rc = 0; @@ -6893,10 +6893,10 @@ if ((features & 0x00040000) && !((userinfo.otpsecret == 1) || (userinfo.otphkeys > 0) || (userinfo.otpkeys > 0))) { setDialogMode(2, "Account Security", 1, null, "Unable to access a device until two-factor authentication is enabled. This is required for extra security. Go to the \"My Account\" tab and look at the \"Account Security\" section."); return false; } // We are allowed, let's prompt to information - var x = "Create a new device group using the options below.

"; - x += addHtmlValue('Name', ''); - x += addHtmlValue('Type', '
'); - x += addHtmlValue('Description', '
'); + var x = "Create a new device group using the options below." + '

'; + x += addHtmlValue("Name", ''); + x += addHtmlValue("Type", '
'); + x += addHtmlValue("Description", '
'); setDialogMode(2, "New Device Group", 3, account_createMeshEx, x); account_validateMeshCreate(); Q('dp2meshname').focus(); @@ -6924,11 +6924,11 @@ if (passRequirements == null || passRequirements == '') { // No password requirements, display password strength var passStrength = checkPasswordStrength(Q('apassword1').value); - if (passStrength >= 80) { r = 'Strong'; } else if (passStrength >= 60) { r = 'Good'; } else { r = 'Weak'; } + if (passStrength >= 80) { r = '' + "Strong" + ''; } else if (passStrength >= 60) { r = '' + "Good" + ''; } else { r = '' + "Weak" + ''; } } else { // Password requirements provided, use that var passReq = checkPasswordRequirements(Q('apassword1').value, passRequirements); - if (passReq == false) { ok = false; r = 'Policy' } + if (passReq == false) { ok = false; r = '' + "Policy" + '' } } } QH('dxPassWarn', r); @@ -6976,8 +6976,8 @@ // Mesh rights var meshrights = 0; if (meshes[i].links[userinfo._id]) { meshrights = meshes[i].links[userinfo._id].rights; } - var rights = 'Partial Rights'; - if (meshrights == 0xFFFFFFFF) rights = 'Full Administrator'; else if (meshrights == 0) rights = 'No Rights'; + var rights = "Partial Rights"; + if (meshrights == 0xFFFFFFFF) rights = "Full Administrator"; else if (meshrights == 0) rights = "No Rights"; // Print the mesh information r += '
' + EscapeHtml(meshes[i].name) + '
' + rights + '
'; @@ -6997,12 +6997,12 @@ function server_showRestoreDlg() { if (xxdialogMode) return false; - var x = 'Restore the server using a backup, this will delete the existing server data. Only do this if you know what you are doing.

'; + var x = "Restore the server using a backup, this will delete the existing server data. Only do this if you know what you are doing." + '

'; x += '
'; x += ''; x += ''; - x += ''; - x += ''; + x += ''; + x += ''; x += '


'; setDialogMode(2, "Restore Server", 0, null, x); account_validateServerRestore(); @@ -7031,7 +7031,7 @@ } function server_showErrorsDlgUpdate() { QE('idx_dlgOkButton', Q('d2updateCheck').checked); } function server_showErrorsDlgEx() { meshserver.send({ action: 'serverclearerrorlog' }); } - function d2CopyServerErrorsToClip() { saveAs(new Blob([Q('d2ServerErrorsLogPre').innerText], { type: "application/octet-stream" }), "servererrors.txt"); } + function d2CopyServerErrorsToClip() { saveAs(new Blob([Q('d2ServerErrorsLogPre').innerText], { type: 'application/octet-stream' }), "servererrors.txt"); } // // MY MESHS @@ -7041,30 +7041,30 @@ function p20updateMesh() { if (currentMesh == null) return; QH('p20meshName', EscapeHtml(currentMesh.name)); - var meshtype = 'Unknown #' + currentMesh.mtype; + var meshtype = format("Unknown #{0}", currentMesh.mtype); var meshrights = 0; try { meshrights = currentMesh.links[userinfo._id].rights; } catch (ex) { } - if (currentMesh.mtype == 1) meshtype = 'Intel® AMT only, no agent'; - if (currentMesh.mtype == 2) meshtype = 'Managed using a software agent'; + if (currentMesh.mtype == 1) meshtype = "Intel® AMT only, no agent"; + if (currentMesh.mtype == 2) meshtype = "Managed using a software agent"; var x = ''; - x += addHtmlValue('Name', addLinkConditional(EscapeHtml(currentMesh.name), 'p20editmesh(1)', (meshrights & 1) != 0)); - x += addHtmlValue('Description', addLinkConditional(((currentMesh.desc && currentMesh.desc != '')?EscapeHtml(currentMesh.desc):'None'), 'p20editmesh(2)', (meshrights & 1) != 0)); + x += addHtmlValue("Name", addLinkConditional(EscapeHtml(currentMesh.name), 'p20editmesh(1)', (meshrights & 1) != 0)); + x += addHtmlValue("Description", addLinkConditional(((currentMesh.desc && currentMesh.desc != '')?EscapeHtml(currentMesh.desc):('' + "None" + '')), 'p20editmesh(2)', (meshrights & 1) != 0)); // Display group type - x += addHtmlValue('Type', meshtype); + x += addHtmlValue("Type", meshtype); //x += addHtmlValue('Identifier', currentMesh._id.split('/')[2]); // Display features if (currentMesh.mtype == 2) { var meshFeatures = []; if (currentMesh.flags) { - if (currentMesh.flags & 1) { meshFeatures.push('Auto-Remove'); } - if (currentMesh.flags & 2) { meshFeatures.push('Hostname Sync'); } + if (currentMesh.flags & 1) { meshFeatures.push("Auto-Remove"); } + if (currentMesh.flags & 2) { meshFeatures.push("Hostname Sync"); } } meshFeatures = meshFeatures.join(', '); - if (meshFeatures == '') { meshFeatures = 'None'; } - x += addHtmlValue('Features', addLinkConditional(meshFeatures, 'p20editmeshfeatures()', meshrights & 1)); + if (meshFeatures == '') { meshFeatures = '' + "None" + ''; } + x += addHtmlValue("Features", addLinkConditional(meshFeatures, 'p20editmeshfeatures()', meshrights & 1)); } // Display user consent @@ -7073,64 +7073,64 @@ var consent = 0; if (currentMesh.consent) { consent = currentMesh.consent; } if (serverinfo.consent) { consent |= serverinfo.consent; } - if ((consent & 0x0040) && (consent & 0x0008)) { meshFeatures.push('Desktop Prompt+Toolbar'); } else if (consent & 0x0040) { meshFeatures.push('Desktop Toolbar'); } else if (consent & 0x0008) { meshFeatures.push('Desktop Prompt'); } else { if (consent & 0x0001) { meshFeatures.push('Desktop Notify'); } } - if (consent & 0x0010) { meshFeatures.push('Terminal Prompt'); } else { if (consent & 0x0002) { meshFeatures.push('Terminal Notify'); } } - if (consent & 0x0020) { meshFeatures.push('Files Prompt'); } else { if (consent & 0x0004) { meshFeatures.push('Files Notify'); } } - if (consent == 7) { meshFeatures = ['Always Notify']; } - if ((consent & 56) == 56) { meshFeatures = ['Always Prompt']; } + if ((consent & 0x0040) && (consent & 0x0008)) { meshFeatures.push("Desktop Prompt+Toolbar"); } else if (consent & 0x0040) { meshFeatures.push("Desktop Toolbar"); } else if (consent & 0x0008) { meshFeatures.push("Desktop Prompt"); } else { if (consent & 0x0001) { meshFeatures.push("Desktop Notify"); } } + if (consent & 0x0010) { meshFeatures.push("Terminal Prompt"); } else { if (consent & 0x0002) { meshFeatures.push("Terminal Notify"); } } + if (consent & 0x0020) { meshFeatures.push("Files Prompt"); } else { if (consent & 0x0004) { meshFeatures.push("Files Notify"); } } + if (consent == 7) { meshFeatures = ["Always Notify"]; } + if ((consent & 56) == 56) { meshFeatures = ["Always Prompt"]; } meshFeatures = meshFeatures.join(', '); - if (meshFeatures == '') { meshFeatures = 'None'; } - x += addHtmlValue('User Consent', addLinkConditional(meshFeatures, 'p20editmeshconsent()', meshrights & 1)); + if (meshFeatures == '') { meshFeatures = '' + "None" + ''; } + x += addHtmlValue("User Consent", addLinkConditional(meshFeatures, 'p20editmeshconsent()', meshrights & 1)); } // Display user consent var meshNotify = 0, meshNotifyStr = []; if (userinfo.links && userinfo.links[currentMesh._id] && userinfo.links[currentMesh._id].notify) { meshNotify = userinfo.links[currentMesh._id].notify; } - if (meshNotify & 2) { meshNotifyStr.push('Connect'); } - if (meshNotify & 4) { meshNotifyStr.push('Disconnect'); } - if (meshNotify & 8) { meshNotifyStr.push('Intel® AMT'); } - if (meshNotifyStr.length == 0) { meshNotifyStr.push('None'); } - x += addHtmlValue('Notifications', addLink(meshNotifyStr.join(', '), 'p20editMeshNotify()')); + if (meshNotify & 2) { meshNotifyStr.push("Connect"); } + if (meshNotify & 4) { meshNotifyStr.push("Disconnect"); } + if (meshNotify & 8) { meshNotifyStr.push("Intel® AMT"); } + if (meshNotifyStr.length == 0) { meshNotifyStr.push("None"); } + x += addHtmlValue("Notifications", addLink(meshNotifyStr.join(', '), 'p20editMeshNotify()')); // Intel AMT setup - var intelAmtPolicy = 'No Policy'; + var intelAmtPolicy = "No Policy"; if (currentMesh.amt) { if (currentMesh.amt.type == 1) { intelAmtPolicy = 'Deactivate Client Control Mode (CCM)'; } else if (currentMesh.amt.type == 2) { - intelAmtPolicy = 'Simple Client Control Mode (CCM)'; - if (currentMesh.amt.cirasetup == 2) { intelAmtPolicy += ' + CIRA'; } + intelAmtPolicy = "Simple Client Control Mode (CCM)"; + if (currentMesh.amt.cirasetup == 2) { intelAmtPolicy += " + CIRA"; } } else if (currentMesh.amt.type == 3) { - intelAmtPolicy = 'Simple Admin Control Mode (ACM)'; - if (currentMesh.amt.cirasetup == 2) { intelAmtPolicy += ' + CIRA'; } + intelAmtPolicy = "Simple Admin Control Mode (ACM)"; + if (currentMesh.amt.cirasetup == 2) { intelAmtPolicy += " + CIRA"; } } } - x += addHtmlValue('Intel® AMT', addLinkConditional(intelAmtPolicy, 'p20editMeshAmt()', meshrights & 1)); + x += addHtmlValue("Intel® AMT", addLinkConditional(intelAmtPolicy, 'p20editMeshAmt()', meshrights & 1)); // Display group note support - if (meshrights & 1) { x += '
'; } + if (meshrights & 1) { x += '
'; } x += '

'; var currentMeshLinks = currentMesh.links[userinfo._id]; - if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += ' Add Users'; } + if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += ' ' + "Add Users" + ''; } if ((meshrights & 4) != 0) { if (currentMesh.mtype == 1) { - x += ' Install CIRA'; - x += ' Install local'; + x += ' ' + "Install CIRA" + ''; + x += ' ' + "Install local" + ''; if (currentMesh.amt && (currentMesh.amt.type == 2)) { // CCM activation - x += ' Activation'; + x += ' ' + "Activation" + ''; } else if (currentMesh.amt && (currentMesh.amt.type == 3) && ((features & 0x00100000) != 0)) { // ACM activation - x += ' Activation'; + x += ' ' + "Activation" + ''; } } if (currentMesh.mtype == 2) { - x += ' Install'; - x += ' Invite'; + x += ' ' + "Install" + ''; + x += ' ' + "Invite" + ''; } } - x += ''; + x += '
User Authorizations
'; // Sort the users for this mesh var count = 1, sortedusers = []; @@ -7144,8 +7144,8 @@ // Display all users for this mesh for (var i in sortedusers) { - var trash = '', rights = 'Partial Rights', r = sortedusers[i].rights; - if (r == 0xFFFFFFFF) rights = 'Full Administrator'; else if (r == 0) rights = 'No Rights'; + var trash = '', rights = "Partial Rights", r = sortedusers[i].rights; + if (r == 0xFFFFFFFF) rights = "Full Administrator"; else if (r == 0) rights = "No Rights"; if ((sortedusers[i].id != userinfo._id) && (meshrights == 0xFFFFFFFF || (((meshrights & 2) != 0)))) { trash = ''; } x += ''; ++count; @@ -7154,7 +7154,7 @@ x += '
' + "User Authorizations" + '
 ' + EscapeHtml(decodeURIComponent(sortedusers[i].name)) + '
' + trash + '
' + rights + '
'; // If we are full administrator on this mesh, allow deletion of the mesh - if (meshrights == 0xFFFFFFFF) { x += ''; } + if (meshrights == 0xFFFFFFFF) { x += ''; } QH('p20info', x); } @@ -7162,11 +7162,11 @@ function p20editMeshAmt() { if (xxdialogMode) return; var x = '', acmoption = ''; - if ((features & 0x100000) != 0) { acmoption = ''; } + if ((features & 0x100000) != 0) { acmoption = ''; } if (currentMesh.mtype == 1) { - x += addHtmlValue('Type', ''); + x += addHtmlValue("Type", ''); } else { - x += addHtmlValue('Type', ''); + x += addHtmlValue("Type", ''); } x += '
'; setDialogMode(2, "Intel® AMT Policy", 3, p20editMeshAmtEx, x); @@ -7186,23 +7186,23 @@ function p20editMeshAmtChange() { var ptype = Q('dp20amtpolicy').value, x = ''; if (ptype >= 2) { - x = addHtmlValue('Password*', '') - x += addHtmlValue('Password*', '') - if ((ptype == 2) && (currentMesh.mtype == 2)) { x += addHtmlValue('Password mismatch', ""); } + x = addHtmlValue("Password*", '') + x += addHtmlValue("Password*", '') + if ((ptype == 2) && (currentMesh.mtype == 2)) { x += addHtmlValue("Password mismatch", ''); } if ((features & 0x400) == 0) { if (ptype == 2) { - x += addHtmlValue('CIRA', ""); + x += addHtmlValue('' + "CIRA" + '', ''); } else { - x += addHtmlValue('CIRA', ""); + x += addHtmlValue('' + "CIRA" + '', ''); } } - x += '
* Leave blank to assign a random password to each device.
'; + x += '
' + "* Leave blank to assign a random password to each device." + '
'; if (currentMesh.mtype == 2) { if (ptype == 2) { - x += 'This policy will not impact devices with Intel® AMT in ACM mode.
'; - x += 'This is not a secure policy as agents will be performing activation.'; + x += '' + "This policy will not impact devices with Intel® AMT in ACM mode." + '
'; + x += '' + "This is not a secure policy as agents will be performing activation." + ''; } else { - x += 'During activation, the agent will have access to admin password infomation.'; + x += '' + "During activation, the agent will have access to admin password infomation." + ''; } } } @@ -7234,8 +7234,8 @@ function p20showDeleteMeshDialog() { if (xxdialogMode) return false; - var x = "Are you sure you want to delete group \"" + EscapeHtml(currentMesh.name) + "\"? Deleting the device group will also delete all information about devices within this group.

"; - x += ""; + var x = format("Are you sure you want to delete group {0}? Deleting the device group will also delete all information about devices within this group.", EscapeHtml(currentMesh.name)) + '

'; + x += ''; setDialogMode(2, "Delete Group", 3, p20showDeleteMeshDialogEx, x); p20validateDeleteMeshDialog(); return false; @@ -7272,16 +7272,16 @@ function p20editmeshconsent() { if (xxdialogMode) return; var x = '', consent = (currentMesh.consent) ? currentMesh.consent : 0; - x += '
Desktop
'; - x += "
"; - x += "
"; - if (debugmode) { x += "
"; } - x += '
Terminal
'; - x += "
"; - x += "
"; - x += '
Files
'; - x += "
"; - x += "
"; + x += '
' + "Desktop" + '
'; + x += "
'; + x += "
'; + if (debugmode) { x += "
'; } + x += '
' + "Terminal" + '
'; + x += "
'; + x += "
'; + x += '
' + "Files" + '
'; + x += "
'; + x += "
'; setDialogMode(2, "Edit Device Group User Consent", 3, p20editmeshconsentEx, x); if (serverinfo.consent) { if (serverinfo.consent & 0x0001) { Q('d20flag1').checked = true; } @@ -7316,8 +7316,8 @@ function p20editmeshfeatures() { if (xxdialogMode) return; var flags = (currentMesh.flags)?currentMesh.flags:0; - var x = "

"; - x += "

"; + var x = '

'; + x += '

'; setDialogMode(2, "Edit Device Group Features", 3, p20editmeshfeaturesEx, x); } @@ -7334,34 +7334,34 @@ if (userid == null) { x += "Allow users to manage this device group and devices in this group."; if (features & 0x00080000) { x += " Users need to login to this server once before they can be added to a device group." } - x += "

"; - x += addHtmlValue('User Names', ''); - x += ""; + x += '

'; + x += addHtmlValue("User Names", ''); + x += '
'; x += '

'; } else { userid = decodeURIComponent(userid); var uname = userid.split('/')[2]; if (users && users[userid]) { uname = users[userid].name; } if (userinfo._id == userid) { uname = userinfo.name; } - x += "Group permissions for user " + uname + ".

"; + x += format("Group permissions for user {0}.", uname) + '

'; } x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; x += '
'; if (userid == null) { setDialogMode(2, "Add Users to Device Group", 3, p20showAddMeshUserDialogEx, x); @@ -7494,33 +7494,32 @@ if (((userinfo._id) != xuserid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) { p20showAddMeshUserDialog(userid); } else { - var r = '' - if (meshrights == 0xFFFFFFFF) r = ', Full Administrator (all rights)'; else { - if ((meshrights & 1) != 0) r += ', Edit Device Group'; - if ((meshrights & 2) != 0) r += ', Manage Device Group Users'; - if ((meshrights & 4) != 0) r += ', Manage Device Group Computers'; - if ((meshrights & 8) != 0) r += ', Remote Control'; - if ((meshrights & 16) != 0) r += ', Agent Console'; - if ((meshrights & 32) != 0) r += ', Server Files'; - if ((meshrights & 64) != 0) r += ', Wake Devices'; - if ((meshrights & 128) != 0) r += ', Edit Notes'; - if (((meshrights & 8) != 0) && (meshrights & 256) != 0) r += ', Remote View Only'; - if (((meshrights & 8) != 0) && (meshrights & 512) != 0) r += ', No Terminal'; - if (((meshrights & 8) != 0) && (meshrights & 1024) != 0) r += ', No Files'; - if (((meshrights & 8) != 0) && (meshrights & 2048) != 0) r += ', No Intel® AMT'; - if (((meshrights & 8) != 0) && ((meshrights & 4096) != 0) && ((meshrights & 256) == 0)) r += ', Limited Input'; - if ((meshrights & 8192) != 0) r += ', Self Events Only'; - if ((meshrights & 16384) != 0) r += ', Chat & Notify'; + var r = []; + if (meshrights == 0xFFFFFFFF) r.push("Full Administrator (all rights)"); else { + if ((meshrights & 1) != 0) r.push("Edit Device Group"); + if ((meshrights & 2) != 0) r.push("Manage Device Group Users"); + if ((meshrights & 4) != 0) r.push("Manage Device Group Computers"); + if ((meshrights & 8) != 0) r.push("Remote Control"); + if ((meshrights & 16) != 0) r.push("Agent Console"); + if ((meshrights & 32) != 0) r.push("Server Files"); + if ((meshrights & 64) != 0) r.push("Wake Devices"); + if ((meshrights & 128) != 0) r.push("Edit Notes"); + if (((meshrights & 8) != 0) && (meshrights & 256) != 0) r.push("Remote View Only"); + if (((meshrights & 8) != 0) && (meshrights & 512) != 0) r.push("No Terminal"); + if (((meshrights & 8) != 0) && (meshrights & 1024) != 0) r.push("No Files"); + if (((meshrights & 8) != 0) && (meshrights & 2048) != 0) r.push("No Intel® AMT"); + if (((meshrights & 8) != 0) && ((meshrights & 4096) != 0) && ((meshrights & 256) == 0)) r.push("Limited Input"); + if ((meshrights & 8192) != 0) r.push("Self Events Only"); + if ((meshrights & 16384) != 0) r.push("Chat & Notify"); } - r = r.substring(2); - if (r == '') { r = 'No Rights'; } + if (r.length == 0) { r.push("No Rights"); } var uname = xuserid.split('/')[2]; if (users && users[xuserid]) { uname = users[xuserid].name; } if (userinfo._id == xuserid) { uname = userinfo.name; } - var buttons = 1, x = addHtmlValue('User Name', EscapeHtml(decodeURIComponent(uname))); - if (xuserid.split('/')[2] != uname) { x += addHtmlValue('User Identifier', EscapeHtml(xuserid.split('/')[2])); } + var buttons = 1, x = addHtmlValue("User Name", EscapeHtml(decodeURIComponent(uname))); + if (xuserid.split('/')[2] != uname) { x += addHtmlValue("User Identifier", EscapeHtml(xuserid.split('/')[2])); } - x += addHtmlValue('Permissions', r); + x += addHtmlValue("Permissions", r); if (((userinfo._id) != xuserid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4; setDialogMode(2, "Device Group User", buttons, p20viewuserEx, x, xuserid); } @@ -7531,7 +7530,7 @@ var uname = userid.split('/')[2]; if (users && users[userid]) { uname = users[userid].name; } if (userinfo._id == userid) { uname = userinfo.name; } - setDialogMode(2, "Remote Mesh User", 3, p20viewuserEx2, "Confirm removal of user " + EscapeHtml(decodeURIComponent(uname)) + "?", userid); + setDialogMode(2, "Remote Mesh User", 3, p20viewuserEx2, format("Confirm removal of user {0}?", EscapeHtml(decodeURIComponent(uname))), userid); } function p20deleteUser(e, userid) { haltEvent(e); p20viewuserEx(2, decodeURIComponent(userid)); return false; } function p20viewuserEx2(button, userid) { meshserver.send({ action: 'removemeshuser', meshid: currentMesh._id, meshname: currentMesh.name, userid: userid }); } @@ -7596,7 +7595,7 @@ } } filetreelocation = filetreelocation2; // In case we could not go down the full path, we set the new path location here. - var publicfolder = fullPath.toLowerCase().startsWith("root / " + userinfo._id + " / public"); + var publicfolder = fullPath.toLowerCase().startsWith('root / ' + userinfo._id + ' / public'); // Sort the files var filetreexx = p5sort_files(filetreex.f); @@ -7611,7 +7610,7 @@ // Figure out the date var fdatestr = ''; - if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + " "; } + if (f.d != null) { var fdate = new Date(f.d), fdatestr = printDateTime(fdate) + ' '; } // Figure out the size var fsize = ''; @@ -7620,12 +7619,12 @@ var h = ''; if (f.t < 3 || f.t == 4) { var right = (f.t == 1 || f.t == 4)?p5getQuotabar(f):'', title = ''; - h = "
 " + right + "
" + shortname + "
"; + h = '
 ' + right + '
' + shortname + '
'; } else { var link = shortname, publiclink = ''; - if (publicfolder) { publiclink = ' (Link)'; } - if (f.s > 0) { link = "" + shortname + "" + publiclink; } - h = "
 " + fdatestr + "" + fsize + "
" + link + "
"; + if (publicfolder) { publiclink = ' (' + "Link" + ')'; } + if (f.s > 0) { link = '' + shortname + '' + publiclink; } + h = '
 ' + fdatestr + '' + fsize + '
' + link + '
'; } if (f.t < 3) { html1 += h; } else { html2 += h; } @@ -7642,28 +7641,26 @@ // Re-check all boxes if needed if (oldlinkpath == filetreelinkpath) { checkboxes = document.getElementsByName('fc'); - for (var i = 0; i < checkboxes.length; i++) { - checkboxes[i].checked = (checkedBoxes.indexOf(checkboxes[i].value) >= 0); - } + for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = (checkedBoxes.indexOf(checkboxes[i].value) >= 0); } } p5setActions(); } function getNiceSize(bytes) { - if (bytes <= 0) return 'Storage limit exceed'; - if (bytes < 2048) return bytes + ' bytes remaining'; - if (bytes < 2097152) return Math.round(bytes / 1024) + ' kilobytes remaining'; - if (bytes < 2147483648) return Math.round(bytes / 1024 / 1024) + ' megabytes remaining'; - return Math.round(bytes / 1024 / 1024 / 1024) + ' gigabytes remaining'; + if (bytes <= 0) return "Storage limit exceed"; + if (bytes < 2048) return format("{0} bytes remaining", bytes); + if (bytes < 2097152) return format('{0} kilobytes remaining', Math.round(bytes / 1024)); + if (bytes < 2147483648) return format('{0} megabytes remaining', Math.round(bytes / 1024 / 1024)); + return format('{0} gigabytes remaining', Math.round(bytes / 1024 / 1024 / 1024)); } function getNiceSize2(bytes) { - if (bytes <= 0) return 'None'; - if (bytes < 2048) return bytes + ' b'; - if (bytes < 2097152) return Math.round(bytes / 1024) + ' Kb'; - if (bytes < 2147483648) return Math.round(bytes / 1024 / 1024) + ' Mb'; - return Math.round(bytes / 1024 / 1024 / 1024) + ' Gb'; + if (bytes <= 0) return "None"; + if (bytes < 2048) return format("{0} b", bytes); + if (bytes < 2097152) return format("{0} Kb", Math.round(bytes / 1024)); + if (bytes < 2147483648) return format("{0} Mb", Math.round(bytes / 1024 / 1024)); + return format("{0} Gb", Math.round(bytes / 1024 / 1024 / 1024)); } function p5getQuotabar(f) { @@ -7699,7 +7696,7 @@ QE('p5RenameFileButton', (cc == 1) && (filetreelocation.length > 0)); //QE('p5ViewFileButton', (cc == 1) && (sfc == 1) && (filetreelocation.length > 0)); QE('p5SelectAllButton', tc > 0); - Q('p5SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All'); + Q('p5SelectAllButton').value = (cc > 0 ? "Select None" : "Select All"); QE('p5CutButton', (sfc > 0) && (cc == sfc)); QE('p5CopyButton', (sfc > 0) && (cc == sfc)); QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0) && (filetreelocation.length > 0)); @@ -7710,12 +7707,12 @@ function getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fc'); return checkboxes.length; } function p5selectallfile() { var nv = (getFileSelCount() == 0), checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p5setActions(); } function setupBackPointers(x) { if (x.f != null) { var fs = 0, fc = 0; for (var i in x.f) { setupBackPointers(x.f[i]); x.f[i].parent = x; if (x.f[i].s) { fs += x.f[i].s; } if (x.f[i].c) { fc += x.f[i].c; } if (x.f[i].t == 3) { fc++; } } x.s = fs; x.c = fc; } return x; } - function getFileSizeStr(size) { if (size == 1) return "1 byte"; return "" + size + " bytes"; } + function getFileSizeStr(size) { if (size == 1) return "1 byte"; return format("{0} bytes", size); } function p5folderup(x) { if (x == null) { filetreelocation.pop(); } else { while (filetreelocation.length > x) { filetreelocation.pop(); } } updateFiles(); return false; } function p5folderset(x) { filetreelocation.push(decodeURIComponent(x)); updateFiles(); return false; } function p5createfolder() { setDialogMode(2, "New Folder", 3, p5createfolderEx, ''); focusTextBox('p5renameinput'); p5fileNameCheck(); } function p5createfolderEx() { meshserver.send({ action: 'fileoperation', fileop: 'createfolder', path: filetreelocation, newfolder: Q('p5renameinput').value}); } - function p5deletefile() { var cc = getFileSelCount(), rec = (getFileSelDirCount() > 0) ? "


" : ""; setDialogMode(2, "Delete", 3, p5deletefileEx, (cc > 1) ? ('Delete ' + cc + ' selected items?' + rec) : ('Delete selected item?' + rec)); } + function p5deletefile() { var cc = getFileSelCount(), rec = (getFileSelDirCount() > 0) ? '


' : ''; setDialogMode(2, "Delete", 3, p5deletefileEx, (cc > 1) ? (format("Delete {0} selected items?", cc) + rec) : ("Delete selected item?" + rec)); } function p5deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(checkboxes[i].value); } } meshserver.send({ action: 'fileoperation', fileop: 'delete', path: filetreelocation, delfiles: delfiles, rec: Q('p5recdeleteinput').checked }); } function p5renamefile() { var renamefile, checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = checkboxes[i].value; } } setDialogMode(2, "Rename", 3, p5renamefileEx, '', { action: 'fileoperation', fileop: 'rename', path: filetreelocation, oldname: renamefile}); focusTextBox('p5renameinput'); p5fileNameCheck(); } function p5renamefileEx(b, t) { t.newname = Q('p5renameinput').value; meshserver.send(t); } @@ -7738,9 +7735,9 @@ var p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; function p5copyFile(cut) { var checkboxes = document.getElementsByName('fc'); p5clipboard = []; p5clipboardCut = cut, p5clipboardFolder = Clone(filetreelocation); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "3")) { p5clipboard.push(checkboxes[i].value); } } p5updateClipview(); } - function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = 'Confim ' + (p5clipboardCut == 0?'copy':'move') + ' of ' + p5clipboard.length + ' entrie' + ((p5clipboard.length > 1)?'s':'') + ' to this location?' } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); } + function p5pasteFile() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Confim {0} of {1} entrie{2} to this location?", (p5clipboardCut == 0?'copy':'move'), p5clipboard.length, ((p5clipboard.length > 1)?'s':'')) } setDialogMode(2, "Paste", 3, p5pasteFileEx, x); } function p5pasteFileEx() { meshserver.send({ action: 'fileoperation', fileop: (p5clipboardCut == 0?'copy':'move'), scpath: p5clipboardFolder, path: filetreelocation, names: p5clipboard }); p5folderup(999); if (p5clipboardCut == 1) { p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; p5updateClipview(); } } - function p5updateClipview() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = 'Holding ' + p5clipboard.length + ' entrie' + ((p5clipboard.length > 1)?'s':'') + ' for ' + (p5clipboardCut == 0?'copy':'move') + ', Clear.' } QH('p5bottomstatus', x); p5setActions(); } + function p5updateClipview() { var x = ''; if ((p5clipboard != null) && (p5clipboard.length > 0)) { x = format("Holding {0} entrie{1} for {2}", p5clipboard.length, ((p5clipboard.length > 1)?'s':''), (p5clipboardCut == 0?"copy":"move")) + ', ' + "Clear" + '.' } QH('p5bottomstatus', x); p5setActions(); } function p5clearClip() { p5clipboard = null; p5clipboardFolder = null; p5clipboardCut = 0; p5updateClipview(); return false; } function p5fileDragDrop(e) { @@ -7773,7 +7770,7 @@ p5PerformUpload(1, files); } else { // Otherwise, prompt for confirmation - setDialogMode(2, "Upload File", 3, p5PerformUpload, 'Upload will overwrite ' + overWriteCount + ' file' + addLetterS(overWriteCount) + '. Continue?', files); + setDialogMode(2, "Upload File", 3, p5PerformUpload, format('Upload will overwrite {0} file{1}. Continue?', overWriteCount, addLetterS(overWriteCount)), files); } } @@ -7892,7 +7889,7 @@ } } if (dateHeader != null) x += ''; - if (x == '') x = "
No Events Found

"; + if (x == '') x = '
' + "No Events Found" + '

'; QH('p3events', x); } @@ -7902,9 +7899,9 @@ function p3showDownloadEventsDialog(mode) { if (xxdialogMode) return; - var x = 'Download the list of events with one of the file formats below.

'; - x += addHtmlValue('CSV Format', 'eventslist.csv'); - x += addHtmlValue('JSON Format', 'eventslist.json'); + var x = "Download the list of events with one of the file formats below." + '

'; + x += addHtmlValue("CSV Format", '' + "eventslist.csv" + ''); + x += addHtmlValue("JSON Format", '' + "eventslist.json" + ''); setDialogMode(2, "Event List Export", 1, null, x, mode); } @@ -7913,9 +7910,9 @@ if (mode == 1) { eventList = currentDeviceEvents; } if (mode == 2) { eventList = events; } if (mode == 3) { eventList = currentUserEvents; } - csv = "time, type, action, user, message\r\n" + csv = "time, type, action, user, message" + '\r\n'; for (var i in eventList) { csv += '\"' + eventList[i].time + '\",\"' + eventList[i].etype + '\",\"' + ((eventList[i].action != null) ? eventList[i].action : '') + '\",\"' + ((eventList[i].username != null) ? eventList[i].username : '') + '\",\"' + ((eventList[i].msg != null) ? eventList[i].msg : '') + '\"\r\n'; } - saveAs(new Blob([csv], { type: "application/octet-stream" }), "eventslist.csv"); + saveAs(new Blob([csv], { type: 'application/octet-stream' }), "eventslist.csv"); return false; } @@ -7925,7 +7922,7 @@ if (mode == 2) { eventList = events; } if (mode == 3) { eventList = currentUserEvents; } for (var i in eventList) { r.push(events[i]); } - saveAs(new Blob([JSON.stringify(r)], { type: "application/octet-stream" }), "eventslist.json"); + saveAs(new Blob([JSON.stringify(r)], { type: 'application/octet-stream' }), "eventslist.json"); return false; } @@ -7954,7 +7951,7 @@ // Display the users using the sorted list var x = '', addHeader = true; - x += '
NameGroupsLast AccessPermissions'; + x += '' + "Name" + 'Groups' + "Last Access" + '' + "Permissions"; // Online users for (var i in sortedUserIds) { @@ -7965,7 +7962,7 @@ ((emailSearch != null) && ((user.email != null) && (user.email.toLowerCase().indexOf(emailSearch) >= 0)))) ) { if (maxUsers > 0) { - if (addHeader) { x += '
Online Users'; addHeader = false; } + if (addHeader) { x += '
' + "Online Users"; addHeader = false; } x += addUserHtml(user, sessions); maxUsers--; } else { @@ -7983,7 +7980,7 @@ ((emailSearch != null) && ((user.email != null) && (user.email.toLowerCase().indexOf(emailSearch) >= 0)))) ) { if (maxUsers > 0) { - if (addHeader) { x += '
Offline Users'; addHeader = false; } + if (addHeader) { x += '
' + "Offline Users"; addHeader = false; } x += addUserHtml(user, sessions); maxUsers--; } else { @@ -7992,9 +7989,9 @@ } } x += '
'; - if (hiddenUsers == 1) { x += '
1 more user not shown, use search box to look for users...
'; } - else if (hiddenUsers > 1) { x += '
' + hiddenUsers + ' more users not shown, use search box to look for users...
'; } - if (maxUsers == 100) { x += '
No users found.
'; } + if (hiddenUsers == 1) { x += '
' + "1 more user not shown, use search box to look for users..." + '
'; } + else if (hiddenUsers > 1) { x += '
' + format("{0} more users not shown, use search box to look for users...", hiddenUsers) + '
'; } + if (maxUsers == 100) { x += '
' + "No users found." + '
'; } QH('p3users', x); // Update current user panel if needed @@ -8006,16 +8003,16 @@ if (sessions != null) { gray = ''; if (self) { - msg = ""; - msg += ""; + msg = ''; + msg += ''; } - if (sessions == 1) { lastAccess += '1 session'; } else { lastAccess += sessions + ' sessions'; } + if (sessions == 1) { lastAccess += "1 session"; } else { lastAccess += format("{0} sessions", sessions); } } else { - if (user.login) { lastAccess += '' + printDate(new Date(user.login * 1000)) + ''; } + if (user.login) { lastAccess += '' + printDate(new Date(user.login * 1000)) + ''; } } if (self) { permissions += ""; } - if ((user.siteadmin != null) && ((user.siteadmin & 32) != 0) && (user.siteadmin != 0xFFFFFFFF)) { permissions += "Locked, "; } - permissions += ""; + if ((user.siteadmin != null) && ((user.siteadmin & 32) != 0) && (user.siteadmin != 0xFFFFFFFF)) { permissions += "Locked" + ', '; } + permissions += ''; var urights = user.siteadmin & (0xFFFFFFFF - 224); if ((user.siteadmin == null) || (urights == 0)) { @@ -8047,7 +8044,6 @@ // Username & email are the same username += ' ' + emailVerified; } - } if ((user.otpsecret > 0) || (user.otphkeys > 0)) { username += ' '; } @@ -8082,7 +8078,7 @@ function showUserAlertDialog(e, userid) { if (xxdialogMode) return; haltEvent(e); - setDialogMode(2, "Notify " + EscapeHtml(users[decodeURIComponent(userid)].name), 3, showUserAlertDialogEx, 'Send a text notification to this user.', userid); + setDialogMode(2, format("Notify {0}", EscapeHtml(users[decodeURIComponent(userid)].name)), 3, showUserAlertDialogEx, "Send a text notification to this user." + '', userid); Q('d2notifyText').focus(); return false; } @@ -8092,13 +8088,13 @@ function doemail(e, addr) { if (xxdialogMode) return false; haltEvent(e); - window.open("mailto:" + addr); + window.open('mailto:' + addr); return false; } function p4batchAccountCreate() { if (xxdialogMode) return; - var x = 'Create many accounts at once by importing a JSON file with the following format:
[\r\n {"user":"x1","pass":"x","email":"x1@x"},\r\n {"user":"x2","pass":"x","resetNextLogin":true}\r\n]
'; + var x = "Create many accounts at once by importing a JSON file with the following format:" + '
[\r\n {"user":"x1","pass":"x","email":"x1@x"},\r\n {"user":"x2","pass":"x","resetNextLogin":true}\r\n]
'; setDialogMode(2, "User Account Import", 3, p4batchAccountCreateEx, x); QE('idx_dlgOkButton', false); } @@ -8111,7 +8107,7 @@ var fr = new FileReader(); fr.onload = function (r) { var j = null; - try { j = JSON.parse(r.target.result); } catch (ex) { setDialogMode(2, "User Account Import", 1, null, "Invalid JSON file: " + ex + "."); return; } + try { j = JSON.parse(r.target.result); } catch (ex) { setDialogMode(2, "User Account Import", 1, null, format("Invalid JSON file: {0}.", ex)); return; } if ((j != null) && (Array.isArray(j))) { var ok = true; for (var i in j) { @@ -8128,38 +8124,38 @@ function p4downloadUserInfo() { if (xxdialogMode) return; - var x = 'Download the list of users with one of the file formats below.

'; - x += addHtmlValue('CSV Format', 'userlist.csv'); - x += addHtmlValue('JSON Format', 'userlist.json'); + var x = "Download the list of users with one of the file formats below." + '

'; + x += addHtmlValue("CSV Format", '' + "userlist.csv" + ''); + x += addHtmlValue("JSON Format", '' + "userlist.json" + ''); setDialogMode(2, "User List Export", 1, null, x); } function p4downloadUserInfoCSV() { - var csv = "id, name, email, creation, lastlogin, groups, authfactors\r\n"; + var csv = "id, name, email, creation, lastlogin, groups, authfactors" + '\r\n'; for (var i in users) { var multiFactor = false, factors = []; if ((users[i].otpsecret > 0) || (users[i].otphkeys > 0)) { multiFactor = true; - if (users[i].otpsecret > 0) { factors.push('AuthApp'); } - if (users[i].otphkeys > 0) { factors.push('SecurityKey'); } - if (users[i].otpkeys > 0) { factors.push('BackupCodes'); } + if (users[i].otpsecret > 0) { factors.push("AuthApp"); } + if (users[i].otphkeys > 0) { factors.push("SecurityKey"); } + if (users[i].otpkeys > 0) { factors.push("BackupCodes"); } } csv += '\"' + users[i]._id + '\",\"' + users[i].name + '\",\"' + (users[i].email ? users[i].email : '') + '\",\"' + (users[i].creation ? new Date(users[i].creation * 1000) : '') + '\",\"' + (users[i].login ? new Date(users[i].login * 1000) : '') + '\",\"' + (users[i].groups ? users[i].groups.join(',') : '') + '\",\"' + (multiFactor ? factors.join(',') : '') + '\"\r\n'; } - saveAs(new Blob([csv], { type: "application/octet-stream" }), "userlist.csv"); + saveAs(new Blob([csv], { type: 'application/octet-stream' }), "userlist.csv"); return false; } function p4downloadUserInfoJSON() { var r = [] for (var i in users) { r.push(users[i]); } - saveAs(new Blob([JSON.stringify(r)], { type: "application/octet-stream" }), "userlist.json"); + saveAs(new Blob([JSON.stringify(r)], { type: 'application/octet-stream' }), "userlist.json"); return false; } function showUserBroadcastDialog() { if (xxdialogMode) return; - var x = 'Broadcast a message to all connected users.'; + var x = "Broadcast a message to all connected users." + ''; setDialogMode(2, "Broadcast Message", 3, showUserBroadcastDialogEx, x); Q('broadcastMessage').focus(); } @@ -8171,21 +8167,21 @@ function showCreateNewAccountDialog() { if (xxdialogMode) return; var x = ''; - if ((features & 0x200000) == 0) { x += addHtmlValue('Name', ''); } - x += addHtmlValue('Email', ''); - x += addHtmlValue('Password', ''); - x += addHtmlValue('Password', ''); - x += '
'; - x += '
'; + if ((features & 0x200000) == 0) { x += addHtmlValue("Name", ''); } + x += addHtmlValue("Email", ''); + x += addHtmlValue("Password", ''); + x += addHtmlValue("Password", ''); + x += '
'; + x += '
'; if (serverinfo.emailcheck) { - x += '
'; - x += '
'; + x += '
'; + x += '
'; } if (passRequirements) { var r = [], rc = 0; for (var i in passRequirements) { if ((i != 'reset') && (i != 'hint')) { r.push(i + ':' + passRequirements[i]); rc++; } } - if (rc > 0) { x += '
Requirements: ' + r.join(', ') + '.
'; } + if (rc > 0) { x += '
' + format("Requirements: {0}.", r.join(', ')) + '
'; } } setDialogMode(2, "Create Account", 3, showCreateNewAccountDialogEx, x); @@ -8228,8 +8224,8 @@ userid = decodeURIComponent(userid); var user = users[userid.toLowerCase()], groups = ""; if (user.groups != null) { groups = user.groups.join(', ') } - var x = 'Enter a comma seperate list of administrative realms names.

'; - x += addHtmlValue('Realms', ''); + var x = "Enter a comma seperate list of administrative realms names." + '

'; + x += addHtmlValue("Realms", ''); setDialogMode(2, "Administrative Realms", 3, showUserGroupDialogEx, x, user); focusTextBox('dp4usergroups'); p4validateUserGroups(); @@ -8255,15 +8251,15 @@ haltEvent(e); userid = decodeURIComponent(userid); var x = '
'; - x += ', k max, blank for default

'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '
'; - x += '

'; - x += '
'; - x += '
'; + x += ', k max, blank for default

'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '

'; + x += '
'; + x += '
'; x += '
'; var user = users[userid.toLowerCase()]; setDialogMode(2, "Server Permissions", 3, showUserAdminDialogEx, x, user); @@ -8353,51 +8349,51 @@ // Show user attributes var x = '
'; - var email = user.email?EscapeHtml(user.email):'Not set', everify = ''; - if (serverinfo.emailcheck) { everify = ((user.emailVerified == true) ? ' ' : ' '); } - if (user.name.toLowerCase() != user._id.split('/')[2]) { x += addDeviceAttribute('User Identifier', user._id.split('/')[2]); } + var email = user.email?EscapeHtml(user.email):'' + "Not set" + '', everify = ''; + if (serverinfo.emailcheck) { everify = ((user.emailVerified == true) ? ' ' : ' '); } + if (user.name.toLowerCase() != user._id.split('/')[2]) { x += addDeviceAttribute("User Identifier", user._id.split('/')[2]); } if (((features & 0x200000) == 0) && ((user.siteadmin != 0xFFFFFFFF) || (userinfo.siteadmin == 0xFFFFFFFF))) { // If we are not site admin, we can't change a admin email. - x += addDeviceAttribute('Email', everify + "" + email + ''); + x += addDeviceAttribute("Email", everify + "" + email + ''); } else { - x += addDeviceAttribute('Email', everify + email + ' '); + x += addDeviceAttribute("Email", everify + email + ' '); } - x += addDeviceAttribute('Server Rights', premsg + "" + msg.join(', ') + ""); - if (user.quota) x += addDeviceAttribute('Server Quota', EscapeHtml(parseInt(user.quota) / 1024) + ' k'); - x += addDeviceAttribute('Creation', printDateTime(new Date(user.creation * 1000))); - if (user.login) x += addDeviceAttribute('Last Login', printDateTime(new Date(user.login * 1000))); - if (user.passchange == -1) { x += addDeviceAttribute('Password', 'Will be changed on next login.'); } - else if (user.passchange) { x += addDeviceAttribute('Password', 'Last changed: ' + printDateTime(new Date(user.passchange * 1000))); } + x += addDeviceAttribute("Server Rights", premsg + "" + msg.join(', ') + ""); + if (user.quota) x += addDeviceAttribute("Server Quota", EscapeHtml(parseInt(user.quota) / 1024) + ' k'); + x += addDeviceAttribute("Creation", printDateTime(new Date(user.creation * 1000))); + if (user.login) x += addDeviceAttribute("Last Login", printDateTime(new Date(user.login * 1000))); + if (user.passchange == -1) { x += addDeviceAttribute("Password", "Will be changed on next login."); } + else if (user.passchange) { x += addDeviceAttribute("Password", format("Last changed: {0}", printDateTime(new Date(user.passchange * 1000)))); } // Device Groups - var linkCount = 0, linkCountStr = 'None'; + var linkCount = 0, linkCountStr = '' + "None" + ''; if (user.links) { for (var i in user.links) { linkCount++; } - if (linkCount == 1) { linkCountStr = '1 group'; } else if (linkCount > 1) { linkCountStr = linkCount + ' groups'; } + if (linkCount == 1) { linkCountStr = "1 group"; } else if (linkCount > 1) { linkCountStr = format("{0} groups", linkCount); } } - x += addDeviceAttribute('Device Groups', linkCountStr); + x += addDeviceAttribute("Device Groups", linkCountStr); // Administrative Realms if ((userinfo.siteadmin == 0xFFFFFFFF) || (userinfo.siteadmin & 2)) { - var userGroups = 'None'; + var userGroups = '' + "None" + ''; if (user.groups) { userGroups = ''; for (var i in user.groups) { userGroups += '' + user.groups[i] + ''; } } - x += addDeviceAttribute('Admin Realms', addLinkConditional(userGroups, 'showUserGroupDialog(event,\"' + userid + '\")', (userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.groups == null) && (userinfo._id != user._id) && (user.siteadmin != 0xFFFFFFFF)))); + x += addDeviceAttribute("Admin Realms", addLinkConditional(userGroups, 'showUserGroupDialog(event,\"' + userid + '\")', (userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.groups == null) && (userinfo._id != user._id) && (user.siteadmin != 0xFFFFFFFF)))); } var multiFactor = 0; if ((user.otpsecret > 0) || (user.otphkeys > 0)) { multiFactor = 1; var factors = []; - if (user.otpsecret > 0) { factors.push('Authentication App'); } - if (user.otphkeys > 0) { factors.push('Security Key'); } - if (user.otpkeys > 0) { factors.push('Backup Codes'); } - x += addDeviceAttribute('Security', ' ' + factors.join(', ')); + if (user.otpsecret > 0) { factors.push("Authentication App"); } + if (user.otphkeys > 0) { factors.push("Security Key"); } + if (user.otpkeys > 0) { factors.push("Backup Codes"); } + x += addDeviceAttribute("Security", ' ' + factors.join(', ')); } x += '

'; // Add action buttons - x += ''; - if (!self && (activeSessions > 0)) { x += ''; } + x += ''; + if (!self && (activeSessions > 0)) { x += ''; } // Setup the panel QH('p30html', x); @@ -8420,7 +8416,7 @@ // Update user's connection state x = ''; - if (activeSessions == 1) { x = '1 active session'; } else if (activeSessions > 1) { x = activeSessions + ' active sessions'; } + if (activeSessions == 1) { x = "1 active session"; } else if (activeSessions > 1) { x = format(" active sessions", activeSessions); } QH('MainUserState', x); go(30); @@ -8434,9 +8430,9 @@ function p30showUserEmailChangeDialog(event) { if (xxdialogMode) return false; var x = ''; - x += addHtmlValue('Email', ''); - if (serverinfo.emailcheck) { x += addHtmlValue('Status', ''); } - setDialogMode(2, "Change Email for " + EscapeHtml(currentUser.name), 3, p30showUserEmailChangeDialogEx, x); + x += addHtmlValue("Email", ''); + if (serverinfo.emailcheck) { x += addHtmlValue("Status", ''); } + setDialogMode(2, format("Change Email for {0}", EscapeHtml(currentUser.name)), 3, p30showUserEmailChangeDialogEx, x); Q('dp30email').focus(); Q('dp30email').value = (currentUser.email?currentUser.email:''); if (serverinfo.emailcheck) { Q('dp30verified').value = currentUser.emailVerified?1:0; } @@ -8462,19 +8458,19 @@ function p30showUserChangePassDialog(multiFactor) { if (xxdialogMode) return; var x = ''; - x += addHtmlValue('Password', ''); - x += addHtmlValue('Password', ''); - if (features & 0x00010000) { x += addHtmlValue('Password hint', ''); } + x += addHtmlValue("Password", ''); + x += addHtmlValue("Password", ''); + if (features & 0x00010000) { x += addHtmlValue("Password hint", ''); } if (passRequirements) { var r = [], rc = 0; for (var i in passRequirements) { if ((i != 'reset') && (i != 'hint')) { r.push(i + ':' + passRequirements[i]); rc++; } } - if (rc > 0) { x += '
Requirements: ' + r.join(', ') + '.
'; } + if (rc > 0) { x += '
' + format("Requirements: {0}.", r.join(', ')) + '
'; } } - x += '
'; - if (multiFactor == 1) { x += '
'; } - setDialogMode(2, "Change Password for " + EscapeHtml(currentUser.name), 3, p30showUserChangePassDialogEx, x, multiFactor); + x += '
'; + if (multiFactor == 1) { x += '
'; } + setDialogMode(2, format("Change Password for {0}", EscapeHtml(currentUser.name)), 3, p30showUserChangePassDialogEx, x, multiFactor); p30showUserChangePassDialogValidate(); Q('p4pass1').focus(); if (currentUser.passchange == -1) { Q('p4resetNextLogin').checked = true; } @@ -8502,7 +8498,7 @@ function p30showDeleteUserDialog() { if (xxdialogMode) return; - setDialogMode(2, "Delete User " + EscapeHtml(currentUser.name), 3, p30showDeleteUserDialogEx, 'Confirm deletion of user ' + EscapeHtml(currentUser.name) + '?'); + setDialogMode(2, format("Delete User {0}", EscapeHtml(currentUser.name)), 3, p30showDeleteUserDialogEx, format('Confirm deletion of user {0}?', EscapeHtml(currentUser.name))); } function p30showDeleteUserDialogEx() { @@ -8598,7 +8594,7 @@ } } if (dateHeader != null) x += ''; - if (x == '') x = "
No Events Found

"; + if (x == '') x = '
' + "No Events Found" + '

'; QH('p31events', x); } @@ -8670,11 +8666,11 @@ var h = ''; if (f.t < 3) { var title = ''; - h = ""; + h = ''; } else { var link = shortname; //if (f.s > 0) { link = "" + shortname + ""; } - h = "
 " + fsize + "
" + link + "
"; + h = '
 ' + fsize + '
' + link + '
'; } if (f.t < 3) { html1 += h; } else { html2 += h; } @@ -8722,7 +8718,7 @@ function drawNotifications() { var r = ''; if (notifications.length == 0) { - r = '
There are currently no notifications
'; + r = '
' + "There are currently no notifications" + '
'; } else { for (var i in notifications) { var n = notifications[i]; @@ -8735,7 +8731,7 @@ if (node != null) { icon = node.icon; t = '' + node.name + ': ' } } - r += '
'; + r += '
'; if (icon) { r += '
'; } r += '
X
' + t + n.text + '
'; } @@ -8807,16 +8803,16 @@ // If web notifications are granted, use it. var notification = null; - if (Notification && (Notification.permission == "granted")) { + if (Notification && (Notification.permission == 'granted')) { var text = n.text.split('®').join('').split('').join('').split('').join('').split('
').join('\r\n'); // Clean up any HTML codes if (n.nodeid) { var node = getNodeFromId(n.nodeid); - if (node) { notification = new Notification("{{{title}}} - " + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' }); } + if (node) { notification = new Notification('{{{title}}} - ' + node.name, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + node.icon + '.png' }); } } else { if (n.icon == null) { n.icon = 0; } var title = n.title; if (title == null) { title = ''; } else { title = ' - ' + n.title; } - notification = new Notification("{{{title}}}" + title, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + n.icon + '.png' }); + notification = new Notification('{{{title}}}' + title, { tag: n.tag, body: text, icon: '/images/notify/icons128-' + n.icon + '.png' }); } notification.id = n.id; notification.xtag = n.tag; @@ -8861,13 +8857,13 @@ if (typeof message.cpuavg == 'object') { var m = Math.min(message.cpuavg[0], 1); window.serverStatCpu.config.data.datasets[0].data = [m, 1 - m]; - QH('serverCpuChartText', '
CPU Load
' + (Math.round(message.cpuavg[0] * 100.0) / 100.0) + ', ' + (Math.round(message.cpuavg[1] * 100.0) / 100.0) + ', ' + (Math.round(message.cpuavg[2] * 100.0) / 100.0) + '
'); + QH('serverCpuChartText', '
CPU Load
' + (Math.round(message.cpuavg[0] * 100.0) / 100.0) + ', ' + (Math.round(message.cpuavg[1] * 100.0) / 100.0) + ', ' + (Math.round(message.cpuavg[2] * 100.0) / 100.0) + '
'); QS('serverCpuChartView')['display'] = 'inline-block'; window.serverStatCpu.update(); } if ((typeof message.totalmem == 'number') && (typeof message.freemem == 'number')) { window.serverStatMemory.config.data.datasets[0].data = [message.totalmem - message.freemem, message.freemem]; - QH('serverMemoryChartText', '
Memory
' + getNiceSize2(message.freemem) + ' free, ' + getNiceSize2(message.totalmem) + ' total
'); + QH('serverMemoryChartText', '
Memory
' + getNiceSize2(message.freemem) + ' ' + "free" + ', ' + getNiceSize2(message.totalmem) + ' ' + "total" + '
'); QS('serverMemoryChartView')['display'] = 'inline-block'; window.serverStatMemory.update(); } @@ -8943,7 +8939,7 @@ var data, chartType = Q('p40type').value, timeAfter = pastDate(Q('p40time').value); serverTimelineConfig.options.scales.xAxes[0].time = { min: timeAfter }; if (chartType == 0) { // Connections - serverTimelineConfig.options.scales.yAxes[0].scaleLabel.labelString = 'Connection Count'; + serverTimelineConfig.options.scales.yAxes[0].scaleLabel.labelString = "Connection Count"; data = { labels: [pastDate(0), timeAfter], datasets: [ @@ -8965,7 +8961,7 @@ } } } else if (chartType == 1) { // Memory - serverTimelineConfig.options.scales.yAxes[0].scaleLabel.labelString = 'Megabytes'; + serverTimelineConfig.options.scales.yAxes[0].scaleLabel.labelString = "Megabytes"; data = { labels: [pastDate(0), timeAfter], datasets: [ @@ -9004,13 +9000,13 @@ } function p40downloadEvents() { - var csv = "time, conn.agent, conn.users, conn.usersessions, conn.relaysession, conn.intelamt, mem.external, mem.heapused, mem.heaptotal, mem.rss\r\n"; + var csv = "time, conn.agent, conn.users, conn.usersessions, conn.relaysession, conn.intelamt, mem.external, mem.heapused, mem.heaptotal, mem.rss" + '\r\n'; for (var i = 0; i < serverTimelineStats.length; i++) { if (serverTimelineStats[i].conn && serverTimelineStats[i].mem) { csv += new Date(serverTimelineStats[i].time) + ', ' + serverTimelineStats[i].conn.ca + ', ' + serverTimelineStats[i].conn.cu + ', ' + serverTimelineStats[i].conn.us + ', ' + serverTimelineStats[i].conn.rs + ', ' + (serverTimelineStats[i].conn.am ? serverTimelineStats[i].conn.am : '') + ', ' + serverTimelineStats[i].mem.external + ', ' + serverTimelineStats[i].mem.heapUsed + ', ' + serverTimelineStats[i].mem.heapTotal + ', ' + serverTimelineStats[i].mem.rss + '\r\n'; } } - saveAs(new Blob([csv], { type: "application/octet-stream" }), "ServerStats.csv"); + saveAs(new Blob([csv], { type: 'application/octet-stream' }), "ServerStats.csv"); } // @@ -9031,23 +9027,23 @@ function setServerTracing() { var x = ''; - x += '
Core Server
'; - x += "
"; - x += "
"; - x += "
"; - x += "
"; - x += '
Web Server
'; - x += "
"; - x += "
"; - x += "
"; - //x += "
"; - x += '
Intel AMT
'; - x += "
"; - x += "
"; - x += "
"; + x += '
' + "Core Server" + '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
'; + x += '
' + "Web Server" + '
'; + x += '
'; + x += '
'; + x += '
'; + //x += '
'; + x += '
' + "Intel AMT" + '
'; + x += '
'; + x += '
'; + x += '
'; //x += '
Legacy
'; - //x += "
"; - //x += "
"; + //x += '
"; + //x += '
"; setDialogMode(2, "Server Tracing", 7, setServerTracingEx, x); } @@ -9058,9 +9054,9 @@ } function p41downloadServerTrace() { - var csv = "time, source, message\r\n"; + var csv = "time, source, message" + '\r\n'; for (var i in serverTrace) { csv += '\"' + new Date(serverTrace[i].time).toLocaleTimeString() + '\",\"' + serverTrace[i].source + '\",\"' + serverTrace[i].args.join(', ') + '\"\r\n'; } - saveAs(new Blob([csv], { type: "application/octet-stream" }), "servertrace.csv"); + saveAs(new Blob([csv], { type: 'application/octet-stream' }), "servertrace.csv"); return false; } @@ -9226,9 +9222,9 @@ // Update the web page title if ((currentNode) && (x >= 10) && (x < 20)) { - document.title = decodeURIComponent("{{{extitle}}}") + ' - ' + currentNode.name + ' - ' + meshes[currentNode.meshid].name; + document.title = decodeURIComponent('{{{extitle}}}') + ' - ' + currentNode.name + ' - ' + meshes[currentNode.meshid].name; } else { - document.title = decodeURIComponent("{{{extitle}}}"); + document.title = decodeURIComponent('{{{extitle}}}'); } } @@ -9236,27 +9232,26 @@ function joinPaths() { var x = []; for (var i in arguments) { var w = arguments[i]; if ((w != null) && (w != '')) { while (w.endsWith('/') || w.endsWith('\\')) { w = w.substring(0, w.length - 1); } while (w.startsWith('/') || w.startsWith('\\')) { w = w.substring(1); } x.push(w); } } return x.join('/'); } function putstore(name, val) { try { if ((typeof (localStorage) === 'undefined') || (localStorage.getItem(name) == val)) return; if (val == null) { localStorage.removeItem(name); } else { localStorage.setItem(name, val); } } catch (e) { } if (name[0] != '_') { var s = {}; for (var i = 0, len = localStorage.length; i < len; ++i) { var k = localStorage.key(i); if (k[0] != '_') { s[k] = localStorage.getItem(k); } } meshserver.send({ action: 'userWebState', state: JSON.stringify(s) }); } } function getstore(name, val) { try { if (typeof (localStorage) === 'undefined') return val; var v = localStorage.getItem(name); if ((v == null) || (v == null)) return val; return v; } catch (e) { return val; } } - //function addLink(x, f) { return "♦ " + x + ""; } - function addLink(x, f) { return "" + x + " "; } + function addLink(x, f) { return '' + x + ' '; } function addLinkConditional(x, f, c) { if (c) return addLink(x, f); return x; } function haltEvent(e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; } - function addOption(q, t, i) { var option = document.createElement("option"); option.text = t; option.value = i; Q(q).add(option); } + function addOption(q, t, i) { var option = document.createElement('option'); option.text = t; option.value = i; Q(q).add(option); } function passwordcheck(p) { return (p.length > 7) && (/\d/.test(p)) && (/[a-z]/.test(p)) && (/[A-Z]/.test(p)) && (/\W/.test(p)); } - function methodcheck(r) { if (r && r != null && r.Body && r.Body.ReturnValueStr != "SUCCESS") { messagebox("Call Error", r.Header.Method + ": " + r.Body.ReturnValueStr.replace("_", " ")); return true; } return false; } - function TableStart() { return "

"; } - function TableStart2() { return "

"; } + function methodcheck(r) { if (r && r != null && r.Body && r.Body.ReturnValueStr != 'SUCCESS') { messagebox("Call Error", r.Header.Method + ': ' + r.Body.ReturnValueStr.replace('_', ' ')); return true; } return false; } + function TableStart() { return '

'; } + function TableStart2() { return '

'; } function TableEntry(n, v) { return "

" + n + "

" + v; } function FullTable(x, e) { var r = TableStart(); for (i in x) { if (i && x[i]) r += TableEntry(i, x[i]); } return r + TableEnd(e); } - function TableEnd(n) { return "

" + (n?n:'') + "

"; } - function AddButton(v, f) { return ""; } - function AddButton2(v, f) { return ""; } - function AddRefreshButton(f) { return ""; } - function MoreStart() { return "▼ More"; }; + function TableEnd(n) { return '

' + (n?n:'') + '

'; } + function AddButton(v, f) { return ''; } + function AddButton2(v, f) { return ''; } + function AddRefreshButton(f) { return ''; } + function MoreStart() { return '▼ ' + "More" + ''; }; function getSelectedOptions(sel) { var opts = [], opt; for (var i = 0, len = sel.options.length; i < len; i++) { opt = sel.options[i]; if (opt.selected) { opts.push(opt.value); } } return opts; } - function getInstance(x, y) { for (var i in x) { if (x[i]["InstanceID"] == y) return x[i]; } return null; } + function getInstance(x, y) { for (var i in x) { if (x[i]['InstanceID'] == y) return x[i]; } return null; } function getItem(x, y, z) { for (var i in x) { if (x[i][y] == z) return x[i]; } return null; } - function guidToStr(g) { return g.substring(6, 8) + g.substring(4, 6) + g.substring(2, 4) + g.substring(0, 2) + "-" + g.substring(10, 12) + g.substring(8, 10) + "-" + g.substring(14, 16) + g.substring(12, 14) + "-" + g.substring(16, 20) + "-" + g.substring(20); } + function guidToStr(g) { return g.substring(6, 8) + g.substring(4, 6) + g.substring(2, 4) + g.substring(0, 2) + '-' + g.substring(10, 12) + g.substring(8, 10) + '-' + g.substring(14, 16) + g.substring(12, 14) + '-' + g.substring(16, 20) + '-' + g.substring(20); } function getUrlVars() { var j, hash, vars = [], hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { j = hashes[i].indexOf('='); if (j > 0) { vars[hashes[i].substring(0, j)] = hashes[i].substring(j + 1, hashes[i].length); } } return vars; } //function getDocWidth() { if (window.innerWidth) return window.innerWidth; if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientWidth != 0) return document.documentElement.clientWidth; return document.getElementsByTagName('body')[0].clientWidth; } //function addHtmlValue(t, v) { return '
' + v + '
' + t + '
'; } @@ -9275,9 +9270,9 @@ function printDate(d) { return d.toLocaleDateString(args.locale); } function printTime(d) { return d.toLocaleTimeString(args.locale); } function printDateTime(d) { return d.toLocaleString(args.locale); } - function addDetailItem(title, value, state) { - return '
' + value + '' + title + '
'; - } + function addDetailItem(title, value, state) { return '
' + value + '' + title + '
'; } + function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; + diff --git a/views/error404.handlebars b/views/error404.handlebars index 5e0cf578..3d3c564a 100644 --- a/views/error404.handlebars +++ b/views/error404.handlebars @@ -57,8 +57,8 @@ var webPageFullScreen = true; var nightMode = (getstore('_nightMode', '0') == '1'); - var terms = "{{{terms}}}"; - if (terms != "") { QH('column_l', decodeURIComponent(terms)); } + var terms = '{{{terms}}}'; + if (terms != '') { QH('column_l', decodeURIComponent(terms)); } QV('column_l', true); userInterfaceSelectMenu(); @@ -94,15 +94,15 @@ var hide = 0; //if (args.hide) { hide = parseInt(args.hide); } if (webPageFullScreen == false) { - QC('body').remove("menu_stack"); - QC('body').remove("fullscreen"); - QC('body').remove("arg_hide"); + QC('body').remove('menu_stack'); + QC('body').remove('fullscreen'); + QC('body').remove('arg_hide'); //if (xxcurrentView >= 10) QC('column_l').add('room4submenu'); //QV('UserDummyMenuSpan', false); //QV('page_leftbar', false); } else { - QC('body').add("fullscreen"); - if (hide & 16) QC('body').add("arg_hide"); // This is replacement for QV('page_leftbar', !(hide & 16)); + QC('body').add('fullscreen'); + if (hide & 16) QC('body').add('arg_hide'); // This is replacement for QV('page_leftbar', !(hide & 16)); //QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen); //QV('page_leftbar', true); } @@ -117,9 +117,9 @@ putstore('webPageStackMenu', webPageStackMenu); } if (webPageStackMenu == false) { - QC('body').remove("menu_stack"); + QC('body').remove('menu_stack'); } else { - QC('body').add("menu_stack"); + QC('body').add('menu_stack'); //if (xxcurrentView >= 10) QC('column_l').remove('room4submenu'); } } diff --git a/views/login-mobile.handlebars b/views/login-mobile.handlebars index 8d7fd12f..2ce21002 100644 --- a/views/login-mobile.handlebars +++ b/views/login-mobile.handlebars @@ -267,12 +267,12 @@ diff --git a/views/login.handlebars b/views/login.handlebars index 386ed528..28b25cbb 100644 --- a/views/login.handlebars +++ b/views/login.handlebars @@ -259,15 +259,15 @@ diff --git a/views/messenger.handlebars b/views/messenger.handlebars index 271496fd..8c6931a2 100644 --- a/views/messenger.handlebars +++ b/views/messenger.handlebars @@ -55,7 +55,7 @@ var userMediaSupport = 0; var notification = null; getUserMediaSupport(function (x) { userMediaSupport = x; }) - var webrtcconfiguration = "{{{webrtconfig}}}"; + var webrtcconfiguration = '{{{webrtconfig}}}'; if (webrtcconfiguration == '') { webrtcconfiguration = null; } else { try { webrtcconfiguration = JSON.parse(decodeURIComponent(webrtcconfiguration)); } catch (ex) { console.log('Invalid WebRTC config: \"' + webrtcconfiguration + '\".'); webrtcconfiguration = null; } } // File transfer state @@ -165,10 +165,10 @@ // If web notifications are granted, use it. if (Notification) { QV('notifyButton', Notification.permission != 'granted'); } - if (Notification && (Notification.permission == "granted")) { + if (Notification && (Notification.permission == 'granted')) { if (notification != null) { notification.close(); notification = null; } if (args.title) { - notification = new Notification("MeshMessenger - " + args.title, { body: msg }); + notification = new Notification("MeshMessenger" + ' - ' + args.title, { body: msg }); } else { notification = new Notification("MeshMessenger", { body: msg }); } @@ -243,7 +243,7 @@ // Initiate the WebRTC offer or handle the offer from the peer. if (startDataChannel == true) { - webchannel = webrtc.createDataChannel("DataChannel", {}); // { ordered: false, maxRetransmits: 2 } + webchannel = webrtc.createDataChannel('DataChannel', {}); // { ordered: false, maxRetransmits: 2 } webchannel.onmessage = function (event) { processMessage(event.data, 2); }; webchannel.onopen = function () { webchannel.ok = true; updateControls(); sendws({ action: 'rtcSwitch', v: 0 }); }; webchannel.onclose = function (event) { if (webchannel && webchannel.ok) { disconnect(); } else { hangUpButtonClick(0); } } @@ -276,7 +276,7 @@ // Disconnect everything function disconnect() { - if (state > 0) { displayControl('Connection closed.'); } + if (state > 0) { displayControl("Connection closed."); } if (state > 1) { setTimeout(start, 500); } cancelAllFileTransfers(); hangUpButtonClick(0, true); // Data channel @@ -369,9 +369,9 @@ // File sharing button function fileButtonClick() { var chooser = Q('uploadFileInput'); - if (chooser.getAttribute("eventset") != 1) { - chooser.setAttribute("eventset", "1"); - chooser.addEventListener("change", fileSelect, false); + if (chooser.getAttribute('eventset') != 1) { + chooser.setAttribute('eventset', '1'); + chooser.addEventListener('change', fileSelect, false); } chooser.value = null; chooser.click(); @@ -382,7 +382,7 @@ if (state != 2) return; var x = Q('uploadFileInput'); if (x.files.length > 10) { - displayControl('Limit of 10 file uploads at the same time.'); + displayControl("Limit of 10 file uploads at the same time."); } else { for (var i = 0; i < x.files.length; i++) { if (x.files[i].size > 0) { @@ -400,7 +400,7 @@ haltEvent(e); if ((state != 2) || (e.dataTransfer == null)) return; if (e.dataTransfer.files.length > 10) { - displayControl('Limit of 10 file uploads at the same time.'); + displayControl("Limit of 10 file uploads at the same time."); } else { for (var i = 0; i < e.dataTransfer.files.length; i++) { if (e.dataTransfer.files[i].size > 0) { @@ -515,7 +515,7 @@ // Toggle notification function enableNotificationsButtonClick() { - if (Notification) { Notification.requestPermission().then(function (permission) { QV('notifyButton', permission != "granted"); }); } + if (Notification) { Notification.requestPermission().then(function (permission) { QV('notifyButton', permission != 'granted'); }); } return false; } @@ -559,13 +559,13 @@ } if (id == 1) { - localVideo.removeAttribute("src"); - localVideo.removeAttribute("srcObject"); + localVideo.removeAttribute('src'); + localVideo.removeAttribute('srcObject'); if (localStream != null) { localStream = null; } displayLocalVideo(false); } else if (id == 2) { - remoteVideo.removeAttribute("src"); - remoteVideo.removeAttribute("srcObject"); + remoteVideo.removeAttribute('src'); + remoteVideo.removeAttribute('srcObject'); displayRemoteVideo(false); } @@ -605,10 +605,10 @@ // Get started updateControls(); if ((typeof args.id == 'string') && (args.id.length > 0)) { - var url = window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + '/meshrelay.ashx?id=' + args.id; + var url = window.location.protocol.replace('http', 'ws') + '//' + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + '/meshrelay.ashx?id=' + args.id; if ((args.auth != null) && (args.auth != '')) { url += '&auth=' + args.auth; } socket = new WebSocket(url); - socket.onopen = function () { state = 1; displayControl('Waiting for other user...'); } + socket.onopen = function () { state = 1; displayControl("Waiting for other user..."); } socket.onerror = function (e) { /*console.error(e);*/ } socket.onclose = function () { disconnect(); } socket.onmessage = function (msg) { @@ -616,7 +616,7 @@ hangUpButtonClick(0, true); hangUpButtonClick(1, true); hangUpButtonClick(2, true); - displayControl('Connected.'); + displayControl("Connected."); state = 2; updateControls(); sendws({ action: 'random', random: random }); // Send a random number. Higher number starts the WebRTC session. @@ -625,7 +625,7 @@ if (state == 2) { processMessage(msg.data, 1); } } } else { - displayControl('Error: No connection key specified.'); + displayControl("Error: No connection key specified."); } }