Stability improvements.

This commit is contained in:
Ylian Saint-Hilaire 2018-02-13 12:28:11 -08:00
parent 0c3c0973bc
commit 205c7d96e0
13 changed files with 28 additions and 29 deletions

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -660,17 +660,10 @@ function createMeshCore(agent) {
while (sendNextBlock > 0) { while (sendNextBlock > 0) {
sendNextBlock--; sendNextBlock--;
var buf = new Buffer(4096); var buf = new Buffer(4096);
buf.writeInt32BE(0x01020304, 0);
var len = fs.readSync(this.filedownload.f, buf, 4, 4092, null); var len = fs.readSync(this.filedownload.f, buf, 4, 4092, null);
this.filedownload.ptr += len; this.filedownload.ptr += len;
if (len > 0) { if (len < 4092) { buf.writeInt32BE(0x01000001, 0); fs.closeSync(this.filedownload.f); delete this.filedownload; sendNextBlock = 0; } else { buf.writeInt32BE(0x01000000, 0); }
this.write(buf.slice(0, len + 4)); // Write as binary this.write(buf.slice(0, len + 4)); // Write as binary
} else {
fs.closeSync(this.filedownload.f);
this.write({ action: 'download', sub: 'done', id: this.filedownload.id });
delete this.filedownload;
sendNextBlock = 0;
}
} }
break; break;
} }

View File

@ -107,7 +107,7 @@ DownloadAgent() {
# initd # initd
wget $url/meshagents?script=2 -q --no-check-certificate -O /etc/init.d/meshagent wget $url/meshagents?script=2 -q --no-check-certificate -O /etc/init.d/meshagent
chmod +x /etc/init.d/meshagent chmod +x /etc/init.d/meshagent
update-rc.d meshagent default # creates symlinks for rc.d update-rc.d meshagent defaults # creates symlinks for rc.d
service meshagent start service meshagent start
else else
# upstart / others (???) # upstart / others (???)

View File

@ -188,7 +188,7 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain) {
}); });
// If error, do nothing // If error, do nothing
ws.on('error', function (err) { console.log(err); }); ws.on('error', function (err) { /*console.log('Relay Error: ' + err);*/ });
// If the mesh relay web socket is closed // If the mesh relay web socket is closed
ws.on('close', function (req) { ws.on('close', function (req) {

View File

@ -366,7 +366,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
var newuser = { type: 'user', _id: newuserid, name: newusername, email: command.email, creation: Date.now(), domain: domain.id }; var newuser = { type: 'user', _id: newuserid, name: newusername, email: command.email, creation: Date.now(), domain: domain.id };
obj.parent.users[newuserid] = newuser; obj.parent.users[newuserid] = newuser;
// Create a user, generate a salt and hash the password // Create a user, generate a salt and hash the password
obj.parent.hash(command.pass, function (err, salt, hash) { require('./pass').hash(command.pass, function (err, salt, hash) {
if (err) throw err; if (err) throw err;
newuser.salt = salt; newuser.salt = salt;
newuser.hash = hash; newuser.hash = hash;

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.1.4-g", "version": "0.1.4-m",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

View File

@ -507,10 +507,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
function _keyevent(d, e) { function _keyevent(d, e) {
if (!e) { e = window.event; } if (!e) { e = window.event; }
var k = e.keyCode; var k = e.keyCode, kk = k;
if (k == 173) k = 189; // '-' key (Firefox)
if (k == 61) k = 187; // '=' key (Firefox)
var kk = k;
if (e.shiftKey == false && k >= 65 && k <= 90) kk = k + 32; if (e.shiftKey == false && k >= 65 && k <= 90) kk = k + 32;
if (k >= 112 && k <= 124) kk = k + 0xFF4E; if (k >= 112 && k <= 124) kk = k + 0xFF4E;
if (k == 8) kk = 0xff08; // Backspace if (k == 8) kk = 0xff08; // Backspace

View File

@ -9,7 +9,7 @@ This is a full computer management web site. With MeshCentral, you can run your
This version of MeshCentral that is completely rebuild of the original MeshCentral coded in C#. It's simpler and includes many other design improvements over the original. At some point in the future, [MeshCentral.com](http://meshcentral.com) that is still running the older code will switch to using this code base. For now, this is early software, preview quality at best. This version of MeshCentral that is completely rebuild of the original MeshCentral coded in C#. It's simpler and includes many other design improvements over the original. At some point in the future, [MeshCentral.com](http://meshcentral.com) that is still running the older code will switch to using this code base. For now, this is early software, preview quality at best.
Note that in this version, **the Mesh Agent works only on Windows**. This version is BETA and should not be used in production. This version is BETA and should not be used in production.
Installation Installation

View File

@ -6,7 +6,9 @@
"Port": 443, "Port": 443,
"RedirPort": 80, "RedirPort": 80,
"AllowLoginToken": true, "AllowLoginToken": true,
"AllowFraming": true "AllowFraming": true,
"WebRTC": false,
"ClickOnce": false
}, },
"_domains": { "_domains": {
"": { "": {

View File

@ -649,8 +649,8 @@
var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}"; var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}";
var amtScanResults = null; var amtScanResults = null;
var debugmode = false; var debugmode = false;
var clickOnce = detectClickOnce(); var clickOnce = (((features & 256) != 0) && detectClickOnce());
var attemptWebRTC = true; var attemptWebRTC = ((features & 128) != 0);
function startup() { function startup() {
if ((features & 32) == 0) { if ((features & 32) == 0) {
@ -3565,16 +3565,21 @@
if ((downloadFile == null) || (cmd.id != downloadFile.id)) return; if ((downloadFile == null) || (cmd.id != downloadFile.id)) return;
if (cmd.sub == 'start') { downloadFile.state = 1; files.send(JSON.stringify({ action: 'download', sub: 'startack', id: downloadFile.id })); } if (cmd.sub == 'start') { downloadFile.state = 1; files.send(JSON.stringify({ action: 'download', sub: 'startack', id: downloadFile.id })); }
else if (cmd.sub == 'cancel') { downloadFile = null; setDialogMode(0); } else if (cmd.sub == 'cancel') { downloadFile = null; setDialogMode(0); }
else if (cmd.sub == 'done') { saveAs(data2blob(downloadFile.data), downloadFile.file); downloadFile = null; setDialogMode(0); } // Save the file
} }
// Called by the transport when binary data is received // Called by the transport when binary data is received
function p13gotDownloadBinaryData(data) { function p13gotDownloadBinaryData(data) {
if (!downloadFile || downloadFile.state == 0) return; if (!downloadFile || downloadFile.state == 0) return;
downloadFile.tsize += (data.length - 4); // Add to the total bytes received if (data.length > 4) {
downloadFile.data += data.substring(4); // Append the data downloadFile.tsize += (data.length - 4); // Add to the total bytes received
Q('d2progressBar').value = downloadFile.tsize; // Change the progress bar downloadFile.data += data.substring(4); // Append the data
files.send(JSON.stringify({ action: 'download', sub: 'ack', id: downloadFile.id })); // Send the ACK Q('d2progressBar').value = downloadFile.tsize; // Change the progress bar
}
if ((ReadInt(data, 0) & 1) != 0) { // Check end flag
saveAs(data2blob(downloadFile.data), downloadFile.file); downloadFile = null; setDialogMode(0); // Save the file
} else {
files.send(JSON.stringify({ action: 'download', sub: 'ack', id: downloadFile.id })); // Send the ACK
}
} }
/* /*

View File

@ -680,7 +680,9 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
if (obj.args.tlsoffload == true) { features += 16; } // No mutual-auth CIRA if (obj.args.tlsoffload == true) { features += 16; } // No mutual-auth CIRA
if ((parent.config != null) && (parent.config.settings != null) && (parent.config.settings.allowframing == true)) { features += 32; } // Allow site within iframe if ((parent.config != null) && (parent.config.settings != null) && (parent.config.settings.allowframing == true)) { features += 32; } // Allow site within iframe
if ((obj.parent.mailserver != null) && (obj.parent.certificates.CommonName != null) && (obj.parent.certificates.CommonName != 'un-configured') && (obj.args.lanonly != true)) { features += 64; } // Email invites if ((obj.parent.mailserver != null) && (obj.parent.certificates.CommonName != null) && (obj.parent.certificates.CommonName != 'un-configured') && (obj.args.lanonly != true)) { features += 64; } // Email invites
if (obj.args.webrtc == true) { features += 128; } // Enable WebRTC (Default false for now)
if (obj.args.clickonce !== false) { features += 256; } // Enable ClickOnce (Default true)
// Send the master web application // Send the master web application
if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrol += ' <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>'; } // If a default user is in use or no user mode, don't display the logout button if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrol += ' <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>'; } // If a default user is in use or no user mode, don't display the logout button
res.render(obj.path.join(__dirname, 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: args.port, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer }); res.render(obj.path.join(__dirname, 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: args.port, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer });