From fcb8caa86780e5d670269f3751e04f1954cb1d63 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 18 Feb 2019 16:12:39 -0800 Subject: [PATCH] Fixed CIRA script and MeshCmd downloads. --- views/default-min.handlebars | 2 +- views/default.handlebars | 47 +++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/views/default-min.handlebars b/views/default-min.handlebars index deb1b54b..166d2525 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - MeshCentral
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + MeshCentral
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index 0b7fa833..5b370df2 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2389,14 +2389,17 @@ // Setup CIRA using a MeshCommander script (Pretty Simple) x += "
To add a new Intel® AMT device to device group \"" + EscapeHtml(mesh.name) + "\" with CIRA, download the following script files and use MeshCommander to run the script to configure computers.

"; - x += addHtmlValue('Setup CIRA', 'cira_setup.mescript'); - x += addHtmlValue('Cleanup CIRA', 'cira_clean.mescript'); + //x += addHtmlValue('Setup CIRA', 'cira_setup.mescript'); + //x += addHtmlValue('Cleanup CIRA', 'cira_clean.mescript'); + x += addHtmlValue('Setup CIRA', 'cira_setup.mescript'); + x += addHtmlValue('Cleanup CIRA', 'cira_clean.mescript'); x += "
"; // Setup CIRA with user/pass authentication (Somewhat difficult) x += ""; // Linux agent uninstall @@ -2491,7 +2495,7 @@ x += ''; x += ""; - setDialogMode(2, "Add Mesh Agent", 2, null, x, 'agentDownload'); + setDialogMode(2, "Add Mesh Agent", 2, null, x, 'fileDownload'); var servername = serverinfo.name; if ((servername == 'un-configured') || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name. @@ -2511,16 +2515,23 @@ function fileDownload(path, name, appendFlag) { var xdr = null, flag = ''; - if (appendFlag == 1) { flag = Q('aginsType').value; } + if (appendFlag == 1) { + // Download a agent + flag = Q('aginsType').value; + } else if (appendFlag == 2) { + // Download meshcmd + flag = Q('aginsSelect').value; + if (parseInt(flag) >= 5) { name = name.toLowerCase(); } else { name += '.exe'; } + } try { xdr = new XDomainRequest(); } catch (e) { } if (!xdr) xdr = new XMLHttpRequest(); xdr.open("GET", window.location.href + path + flag); xdr.timeout = 15000; xdr.responseType = "blob"; xdr.onprogress = function (x) { console.log(x); }; - xdr.onload = function (e) { saveAs(new Blob([e.target.response], { type: "application/octet-stream" }), name); if (xxdialogTag == 'agentDownload') { setDialogMode(0); } }; - xdr.onerror = function () { if (xxdialogTag == 'agentDownload') { setDialogMode(0); } alert('Agent downloads timeout.'); }; - xdr.ontimeout = function () { if (xxdialogTag == 'agentDownload') { setDialogMode(0); } alert('Unable to download agent.'); }; + xdr.onload = function (e) { saveAs(new Blob([e.target.response], { type: "application/octet-stream" }), name); if (xxdialogTag == 'fileDownload') { setDialogMode(0); } }; + xdr.onerror = function () { if (xxdialogTag == 'fileDownload') { setDialogMode(0); } alert('Agent downloads timeout.'); }; + xdr.ontimeout = function () { if (xxdialogTag == 'fileDownload') { setDialogMode(0); } alert('Unable to download agent.'); }; xdr.send(); } @@ -3899,18 +3910,20 @@ 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.

'; } if (mode == 1) { x += '
Download "meshcmd" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.

'; } x += addHtmlValue('Operating System', y); - x += addHtmlValue('MeshCmd', ''); - if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); } - if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); } + //x += addHtmlValue('MeshCmd', ''); + //if (mode == 0) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); } + //if (mode == 1) { x += addHtmlValue('Action File', 'MeshAction (.txt)'); } + x += addHtmlValue('MeshCmd', ''); + 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); + setDialogMode(2, ["Download MeshCmd","Network Router"][mode], 9, null, x, "fileDownload"); meshCmdOsClick(); } function meshCmdOsClick() { var os = Q('aginsSelect').value, osn = ''; - 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)'; }