Updated French translation.

This commit is contained in:
Ylian Saint-Hilaire 2021-05-21 14:12:16 -07:00
parent 2416545aa4
commit e240d6da7d
6 changed files with 2209 additions and 2116 deletions

View File

@ -404,7 +404,6 @@ module.exports.CreateSshTerminalRelay = function (parent, db, ws, req, domain, u
// Save SSH credentials into device
function saveSshCredentials() {
console.log('Save SSH credentials', obj.username, obj.password, obj.nodeid);
parent.parent.db.Get(obj.nodeid, function (err, nodes) {
if ((err != null) || (nodes == null) || (nodes.length != 1)) return;
const node = nodes[0];

View File

@ -708,6 +708,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
// Remove push messaging token if present
if (docs[i].pmt != null) { docs[i].pmt = 1; }
// Remove SSH credentials if present
if (docs[i].ssh != null) { docs[i].ssh = 1; }
// Remove Intel AMT credential if present
if (docs[i].intelamt != null) {
if (docs[i].intelamt.pass != null) { docs[i].intelamt.pass = 1; }
@ -4213,6 +4216,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
}
}
if ((typeof command.ssh == 'number') && (command.ssh == 0)) {
if (node.ssh != null) { delete node.ssh; change = 1; changes.push('ssh'); } // Delete the SSH cendentials
}
if (domain.geolocation && command.userloc && ((node.userloc == null) || (command.userloc[0] != node.userloc[0]) || (command.userloc[1] != node.userloc[1]))) {
change = 1;
if ((command.userloc.length == 0) && (node.userloc)) {

View File

@ -1 +1 @@
function Q(n){return null==document.getElementById(n)&&console.log("Invalid element: "+n),document.getElementById(n)}function QS(n){try{return Q(n).style}catch(n){}}function QE(n,t){try{Q(n).disabled=!t}catch(n){}}function QV(n,t){try{QS(n).display=t?"":"none"}catch(n){}}function QA(n,t){Q(n).innerHTML+=t}function QH(n,t){Q(n).innerHTML=t}function QC(n){try{return Q(n).classList}catch(n){}}function inputBoxFocus(n){Q(n).focus();var t=Q(n).value;Q(n).value="",Q(n).value=t}function ReadShort(n,t){return(n.charCodeAt(t)<<8)+n.charCodeAt(t+1)}function ReadShortX(n,t){return(n.charCodeAt(t+1)<<8)+n.charCodeAt(t)}function ReadInt(n,t){return 16777216*n.charCodeAt(t)+(n.charCodeAt(t+1)<<16)+(n.charCodeAt(t+2)<<8)+n.charCodeAt(t+3)}function ReadSInt(n,t){return(n.charCodeAt(t)<<24)+(n.charCodeAt(t+1)<<16)+(n.charCodeAt(t+2)<<8)+n.charCodeAt(t+3)}function ReadIntX(n,t){return 16777216*n.charCodeAt(t+3)+(n.charCodeAt(t+2)<<16)+(n.charCodeAt(t+1)<<8)+n.charCodeAt(t)}function ShortToStr(n){return String.fromCharCode(n>>8&255,255&n)}function ShortToStrX(n){return String.fromCharCode(255&n,n>>8&255)}function IntToStr(n){return String.fromCharCode(n>>24&255,n>>16&255,n>>8&255,255&n)}function IntToStrX(n){return String.fromCharCode(255&n,n>>8&255,n>>16&255,n>>24&255)}function MakeToArray(n){return n&&null!=n&&"object"!=typeof n?[n]:n}function SplitArray(n){return n.split(",")}function Clone(n){return JSON.parse(JSON.stringify(n))}function EscapeHtml(n){return"string"==typeof n?n.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"):"boolean"==typeof n||"number"==typeof n?n:void 0}function EscapeHtmlBreaks(n){return"string"==typeof n?n.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;"):"boolean"==typeof n||"number"==typeof n?n:void 0}function ArrayElementMove(n,t,e){n.splice(e,0,n.splice(t,1)[0])}function ObjectToStringEx(n,t){var e="";if(0!=n&&(!n||null==n))return"(Null)";if(n instanceof Array)for(var r in n)e+="<br />"+gap(t)+"Item #"+r+": "+ObjectToStringEx(n[r],t+1);else if(n instanceof Object)for(var r in n)e+="<br />"+gap(t)+r+" = "+ObjectToStringEx(n[r],t+1);else e+=EscapeHtml(n);return e}function ObjectToStringEx2(n,t){var e="";if(0!=n&&(!n||null==n))return"(Null)";if(n instanceof Array)for(var r in n)e+="\r\n"+gap2(t)+"Item #"+r+": "+ObjectToStringEx2(n[r],t+1);else if(n instanceof Object)for(var r in n)e+="\r\n"+gap2(t)+r+" = "+ObjectToStringEx2(n[r],t+1);else e+=EscapeHtml(n);return e}function gap(n){for(var t="",e=0;e<4*n;e++)t+="&nbsp;";return t}function gap2(n){for(var t="",e=0;e<4*n;e++)t+=" ";return t}function ObjectToString(n){return ObjectToStringEx(n,0)}function ObjectToString2(n){return ObjectToStringEx2(n,0)}function hex2rstr(n){if("string"!=typeof n||0==n.length)return"";for(var t,e="",r=(""+n).match(/../g);t=r.shift();)e+=String.fromCharCode("0x"+t);return e}function char2hex(n){return(n+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(n){for(var t="",e=0;e<n.length;e++)t+=char2hex(n.charCodeAt(e));return t}function encode_utf8(n){return unescape(encodeURIComponent(n))}function decode_utf8(n){return decodeURIComponent(escape(n))}function data2blob(n){for(var t=new Array(n.length),e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return new Blob([new Uint8Array(t)])}function utf2blob(n){for(var t=[],e=unescape(encodeURIComponent(n)),r=0;r<e.length;r++)t.push(e.charCodeAt(r));return new Blob([new Uint8Array(t)])}function random(n){return Math.floor(Math.random()*n)}function trademarks(n){return n.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}function zeroPad(n,t){n="00000000"+n;return n.substr(n.length-(t=null==t?2:t))}function isAlphaNumeric(n){return"number"==typeof n||null!=n.match(/^[A-Za-z0-9]+$/)}function isSafeString(n){return"string"==typeof n&&-1==n.indexOf("<")&&-1==n.indexOf(">")&&-1==n.indexOf("&")&&-1==n.indexOf('"')&&-1==n.indexOf("'")&&-1==n.indexOf("+")&&-1==n.indexOf("(")&&-1==n.indexOf(")")&&-1==n.indexOf("#")&&-1==n.indexOf("%")&&-1==n.indexOf(":")}function isSafeString2(n){return"string"==typeof n&&-1==n.indexOf("<")&&-1==n.indexOf(">")&&-1==n.indexOf("&")&&-1==n.indexOf('"')&&-1==n.indexOf("'")&&-1==n.indexOf("+")&&-1==n.indexOf("(")&&-1==n.indexOf(")")&&-1==n.indexOf("#")&&-1==n.indexOf("%")}function parseUriArgs(){var n,t=window.document.location.href,e={},r=(t=t.endsWith("#")?t.substring(0,t.length-1):t).split(/[\?&|]/);for(n in r.splice(0,1),r){var o,i=r[n],c=i.indexOf("=");e[o=i.substring(0,c)]=i.substring(c+1),isSafeString(e[o])?(c=parseInt(e[o]))==e[o]&&(e[o]=c):delete e[o]}return e}String.prototype.startsWith||(String.prototype.startsWith=function(n){return 0===this.lastIndexOf(n,0)}),String.prototype.endsWith||(String.prototype.endsWith=function(n){return-1!==this.indexOf(n,this.length-n.length)})
function Q(n){return document.getElementById(n)}function QS(n){try{return Q(n).style}catch(n){}}function QE(n,t){try{Q(n).disabled=!t}catch(n){}}function QV(n,t){try{QS(n).display=t?"":"none"}catch(n){}}function QA(n,t){Q(n).innerHTML+=t}function QH(n,t){Q(n).innerHTML=t}function QC(n){try{return Q(n).classList}catch(n){}}function inputBoxFocus(n){Q(n).focus();var t=Q(n).value;Q(n).value="",Q(n).value=t}function ReadShort(n,t){return(n.charCodeAt(t)<<8)+n.charCodeAt(t+1)}function ReadShortX(n,t){return(n.charCodeAt(t+1)<<8)+n.charCodeAt(t)}function ReadInt(n,t){return 16777216*n.charCodeAt(t)+(n.charCodeAt(t+1)<<16)+(n.charCodeAt(t+2)<<8)+n.charCodeAt(t+3)}function ReadSInt(n,t){return(n.charCodeAt(t)<<24)+(n.charCodeAt(t+1)<<16)+(n.charCodeAt(t+2)<<8)+n.charCodeAt(t+3)}function ReadIntX(n,t){return 16777216*n.charCodeAt(t+3)+(n.charCodeAt(t+2)<<16)+(n.charCodeAt(t+1)<<8)+n.charCodeAt(t)}function ShortToStr(n){return String.fromCharCode(n>>8&255,255&n)}function ShortToStrX(n){return String.fromCharCode(255&n,n>>8&255)}function IntToStr(n){return String.fromCharCode(n>>24&255,n>>16&255,n>>8&255,255&n)}function IntToStrX(n){return String.fromCharCode(255&n,n>>8&255,n>>16&255,n>>24&255)}function MakeToArray(n){return n&&null!=n&&"object"!=typeof n?[n]:n}function SplitArray(n){return n.split(",")}function Clone(n){return JSON.parse(JSON.stringify(n))}function EscapeHtml(n){return"string"==typeof n?n.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"):"boolean"==typeof n||"number"==typeof n?n:void 0}function EscapeHtmlBreaks(n){return"string"==typeof n?n.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"<br />").replace(/\n/g,"").replace(/\t/g,"&nbsp;&nbsp;"):"boolean"==typeof n||"number"==typeof n?n:void 0}function ArrayElementMove(n,t,r){n.splice(r,0,n.splice(t,1)[0])}function ObjectToStringEx(n,t){var r="";if(0!=n&&(!n||null==n))return"(Null)";if(n instanceof Array)for(var e in n)r+="<br />"+gap(t)+"Item #"+e+": "+ObjectToStringEx(n[e],t+1);else if(n instanceof Object)for(var e in n)r+="<br />"+gap(t)+e+" = "+ObjectToStringEx(n[e],t+1);else r+=EscapeHtml(n);return r}function ObjectToStringEx2(n,t){var r="";if(0!=n&&(!n||null==n))return"(Null)";if(n instanceof Array)for(var e in n)r+="\r\n"+gap2(t)+"Item #"+e+": "+ObjectToStringEx2(n[e],t+1);else if(n instanceof Object)for(var e in n)r+="\r\n"+gap2(t)+e+" = "+ObjectToStringEx2(n[e],t+1);else r+=EscapeHtml(n);return r}function gap(n){for(var t="",r=0;r<4*n;r++)t+="&nbsp;";return t}function gap2(n){for(var t="",r=0;r<4*n;r++)t+=" ";return t}function ObjectToString(n){return ObjectToStringEx(n,0)}function ObjectToString2(n){return ObjectToStringEx2(n,0)}function hex2rstr(n){if("string"!=typeof n||0==n.length)return"";for(var t,r="",e=(""+n).match(/../g);t=e.shift();)r+=String.fromCharCode("0x"+t);return r}function char2hex(n){return(n+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(n){for(var t="",r=0;r<n.length;r++)t+=char2hex(n.charCodeAt(r));return t}function encode_utf8(n){return unescape(encodeURIComponent(n))}function decode_utf8(n){return decodeURIComponent(escape(n))}function data2blob(n){for(var t=new Array(n.length),r=0;r<n.length;r++)t[r]=n.charCodeAt(r);return new Blob([new Uint8Array(t)])}function utf2blob(n){for(var t=[],r=unescape(encodeURIComponent(n)),e=0;e<r.length;e++)t.push(r.charCodeAt(e));return new Blob([new Uint8Array(t)])}function random(n){return Math.floor(Math.random()*n)}function trademarks(n){return n.replace(/\(R\)/g,"&reg;").replace(/\(TM\)/g,"&trade;")}function zeroPad(n,t){n="00000000"+n;return n.substr(n.length-(t=null==t?2:t))}function isAlphaNumeric(n){return"number"==typeof n||null!=n.match(/^[A-Za-z0-9]+$/)}function isSafeString(n){return"string"==typeof n&&-1==n.indexOf("<")&&-1==n.indexOf(">")&&-1==n.indexOf("&")&&-1==n.indexOf('"')&&-1==n.indexOf("'")&&-1==n.indexOf("+")&&-1==n.indexOf("(")&&-1==n.indexOf(")")&&-1==n.indexOf("#")&&-1==n.indexOf("%")&&-1==n.indexOf(":")}function isSafeString2(n){return"string"==typeof n&&-1==n.indexOf("<")&&-1==n.indexOf(">")&&-1==n.indexOf("&")&&-1==n.indexOf('"')&&-1==n.indexOf("'")&&-1==n.indexOf("+")&&-1==n.indexOf("(")&&-1==n.indexOf(")")&&-1==n.indexOf("#")&&-1==n.indexOf("%")}function parseUriArgs(){var n,t=window.document.location.href,r={},e=(t=t.endsWith("#")?t.substring(0,t.length-1):t).split(/[\?&|]/);for(n in e.splice(0,1),e){var o,i=e[n],c=i.indexOf("=");r[o=i.substring(0,c)]=i.substring(c+1),isSafeString(r[o])?(c=parseInt(r[o]))==r[o]&&(r[o]=c):delete r[o]}return r}String.prototype.startsWith||(String.prototype.startsWith=function(n){return 0===this.lastIndexOf(n,0)}),String.prototype.endsWith||(String.prototype.endsWith=function(n){return-1!==this.indexOf(n,this.length-n.length)})

File diff suppressed because it is too large Load Diff

View File

@ -1873,6 +1873,7 @@
node.wifiloc = message.event.node.wifiloc;
node.gpsloc = message.event.node.gpsloc;
node.tags = message.event.node.tags;
node.ssh = message.event.node.ssh;
node.userloc = message.event.node.userloc;
node.rdpport = message.event.node.rdpport;
node.rfbport = message.event.node.rfbport;
@ -3426,6 +3427,15 @@
x += addDeviceAttribute("Tags", '<span style=color:black>' + groupingTags + '</span>');
}
// SSH Credentials
if (node.ssh != null) {
if ((meshrights & 4) != 0) {
x += addDeviceAttribute("Credentials", '<span onclick=showClearSshDialog(3) style=cursor:pointer>' + "SSH" + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>');
} else {
x += addDeviceAttribute("Credentials", "SSH");
}
}
x += '</table><br />';
// Show action button, only show if we have permissions 4, 8, 64
if (((meshrights & (4 + 8 + 64)) != 0) && (node.mtype != 3)) { x += '<input type=button value="' + "Actions" + '" onclick=deviceActionFunction() />'; }
@ -3827,6 +3837,9 @@
meshserver.send({ action: 'changedevice', nodeid: currentNode._id, icon: icon });
}
function showClearSshDialog() { setDialogMode(2, "Edit Device", 3, showClearSshDialogEx, "Clear SSH credentials?"); }
function showClearSshDialogEx(button, mode) { meshserver.send({ action: 'changedevice', nodeid: currentNode._id, ssh: 0 }); }
var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Description", "Tags"];
var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags'];
var showEditNodeValueDialog_modes3 = ['', '', '', "Group1, Group2, Group3"];
@ -4578,7 +4591,7 @@
var x = '';
x += addHtmlValue("Username", '<input id=dp2user style=width:190px maxlength=64 autocomplete=off onkeyup=sshAuthKeyUp(event) />');
x += addHtmlValue("Password", '<input type=password id=dp2pass style=width:190px maxlength=64 autocomplete=off onkeyup=sshAuthKeyUp(event) />');
x += addHtmlValue('', '<label><input id=dp2keep type=checkbox>' + "Remember credentials" + '</label>');
x += '<label><input id=dp2keep type=checkbox>' + "Remember credentials" + '</label>';
setDialogMode(2, "Authentication", 11, sshConnectEx, x, 'ssh');
setTimeout(sshAuthKeyUp, 50);
}

View File

@ -2951,6 +2951,7 @@
node.wifiloc = message.event.node.wifiloc;
node.gpsloc = message.event.node.gpsloc;
node.tags = message.event.node.tags;
node.ssh = message.event.node.ssh;
node.userloc = message.event.node.userloc;
node.rdpport = message.event.node.rdpport;
node.rfbport = message.event.node.rfbport;
@ -6425,6 +6426,15 @@
x += addDeviceAttribute("Tags", groupingTags);
}
// SSH Credentials
if (node.ssh != null) {
if ((meshrights & 4) != 0) {
x += addDeviceAttribute("Credentials", '<span onclick=showClearSshDialog(3) style=cursor:pointer>' + "SSH" + ' <img class=hoverButton src="images/link5.png" width=10 height=10 /></span>');
} else {
x += addDeviceAttribute("Credentials", "SSH");
}
}
x += '</table><br />';
// Show action button, only show if we have permissions 4, 8, 64
if (((meshrights & (4 + 8 + 64)) != 0) && (node.mtype != 3) && ((node.agent == null) || (node.agent.id != 34))) { x += '<input type=button value="' + "Actions" + '" title="' + "Perform power actions on the device" + '" onclick=deviceActionFunction() />'; }
@ -6503,6 +6513,7 @@
var r = serverinfo.devicemeshrouterlinks.extralinks[i], p = 0;
if (doesDeviceMatchFilterTags(node, r.filter)) {
if (typeof r.protocol == 'number') { p = r.protocol; } else if (r.protocol == 'http') { p = 1; } else if (r.protocol == 'https') { p = 2; } else if (r.protocol == 'rdp') { p = 3; } else if (r.protocol == 'ssh') { p = 4; } else if (r.protocol == 'scp') { p = 5; } else if (r.protocol == 'mcrdesktop') { p = 6; } else if (r.protocol == 'mcrfiles') { p = 7; }
if (((p == 6) || (p == 7)) && (node.mtype != 2)) continue; // If this is not an agent device, don't show MeshCentral Router desktop/file links.
x += '<a href=# onclick=p10MCRouter("' + node._id + '",' + p + ',' + r.port + (r.ip?(',\"' + r.ip + '\"'):',null') + ',' + (r.localport?r.localport:0) + ') title="' + "Requires installation of MeshCentral Router." + '">' + r.name + '</a>&nbsp;';
}
}
@ -7463,6 +7474,9 @@
meshserver.send({ action: 'changedevice', nodeid: currentNode._id, icon: icon });
}
function showClearSshDialog() { setDialogMode(2, "Edit Device", 3, showClearSshDialogEx, "Clear SSH credentials?"); }
function showClearSshDialogEx(button, mode) { meshserver.send({ action: 'changedevice', nodeid: currentNode._id, ssh: 0 }); }
var showEditNodeValueDialog_modes = ["Device Name", "Hostname", "Description", "Tags"];
var showEditNodeValueDialog_modes2 = ['name', 'host', 'desc', 'tags'];
var showEditNodeValueDialog_modes3 = ['', '', '', "Tag1, Tag2, Tag3"];