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) {
sendNextBlock--;
var buf = new Buffer(4096);
buf.writeInt32BE(0x01020304, 0);
var len = fs.readSync(this.filedownload.f, buf, 4, 4092, null);
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
} else {
fs.closeSync(this.filedownload.f);
this.write({ action: 'download', sub: 'done', id: this.filedownload.id });
delete this.filedownload;
sendNextBlock = 0;
}
}
break;
}

View File

@ -107,7 +107,7 @@ DownloadAgent() {
# initd
wget $url/meshagents?script=2 -q --no-check-certificate -O /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
else
# upstart / others (???)

View File

@ -188,7 +188,7 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain) {
});
// 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
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 };
obj.parent.users[newuserid] = newuser;
// 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;
newuser.salt = salt;
newuser.hash = hash;

View File

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

View File

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

View File

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

View File

@ -649,8 +649,8 @@
var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}";
var amtScanResults = null;
var debugmode = false;
var clickOnce = detectClickOnce();
var attemptWebRTC = true;
var clickOnce = (((features & 256) != 0) && detectClickOnce());
var attemptWebRTC = ((features & 128) != 0);
function startup() {
if ((features & 32) == 0) {
@ -3565,17 +3565,22 @@
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 })); }
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
function p13gotDownloadBinaryData(data) {
if (!downloadFile || downloadFile.state == 0) return;
if (data.length > 4) {
downloadFile.tsize += (data.length - 4); // Add to the total bytes received
downloadFile.data += data.substring(4); // Append the data
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
}
}
/*
var downloadFile; // Global state for file download

View File

@ -680,6 +680,8 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
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 ((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
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