Skip to content

Commit 710c2fd

Browse files
committed
Add macOS binary installer with ZIP support to default.handlebars
- Split combined Linux/macOS installer into separate options - Add macOS Binary Installer (value=9) to OS dropdown - Separate architecture lists: Linux and macOS - Add Installation Type dropdown for macOS with ZIP options (installflags 10, 11, 12) - Add deprecated .mpkg options (installflags 0, 1, 2) - Add macOS binary installer section with curl command - Update addAgentToMeshClick() to handle new option and separate dropdowns - Update copyAgentUrl() to use correct dropdown IDs This brings default.handlebars in line with default78.handlebars for macOS binary installer functionality, supporting the createMacOSZipPackage feature.
1 parent b1019a2 commit 710c2fd

File tree

1 file changed

+73
-26
lines changed

1 file changed

+73
-26
lines changed

views/default.handlebars

Lines changed: 73 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5624,7 +5624,7 @@
56245624
if (xxdialogMode) return false;
56255625
var mesh = meshes[meshid], x = '', installType = 0, moreoptions = '';
56265626

5627-
var opts = '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Windows" + '</option><option value=1>' + "Linux / BSD" + '</option><option value=5>' + "Linux / BSD / macOS Binary Installer" + '</option><option value=2>' + "Apple macOS" + '</option>';
5627+
var opts = '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Windows" + '</option><option value=1>' + "Linux / BSD" + '</option><option value=5>' + "Linux / BSD Binary Installer" + '</option><option value=2>' + "Apple macOS" + '</option><option value=9>' + "macOS Binary Installer" + '</option>';
56285628
if ((features & 2) == 0) { opts += '<option value=6>' + "Mobile device" + '</option>'; } // Don't display mobile setup in LAN mode.
56295629
opts += '<option value=7>' + "MeshCentral Assistant" + '</option>';
56305630
opts += '<option value=3>' + "Windows (UnInstall)" + '</option><option value=4>' + "Linux / BSD (UnInstall)" + '</option><option value=8>' + "Apple macOS (UnInstall)" + '</option></select>';
@@ -5635,17 +5635,32 @@
56355635
var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1), portStr = '';
56365636
if (serverinfo.https == true) { portStr = (serverinfo.port == 443)?'':(':' + serverinfo.port); } else { portStr = (serverinfo.port == 80) ? '' : (':' + serverinfo.port); }
56375637

5638-
// Add Linux/macOS binary installer option
5639-
var binaryInstallAgentsOrder = [ 6, 5, 10005, 25, 26, 28, 30, 32, 36, 37, 40, 41, 45, 16, 29 ];
5640-
var binaryInstallAgents = { 6 : 'Linux x86-64', 5 : 'Linux x86-32', 10005 : 'Apple OSX Universal', 25 : 'Linux ARM-HF, Rasberry Pi', 26 : 'Linux ARM64-HF', 28: 'Linux MIPS24KC (OpenWRT)', 30 : 'FreeBSD x86-64', 32: 'Linux ARM 64 bit (glibc/2.24 NOKVM)', 36: 'OpenWRT x86-64', 37: 'OpenBSD x86-64', 40: 'Linux MIPSEL24KC (OpenWRT)', 41: 'ARMADA/CORTEX-A53/MUSL (OpenWRT)', 45: 'RISC-V x86-64', 16: 'Apple macOS x86-64', 29: 'Apple macOS ARM-64' };
5641-
for (var i in binaryInstallAgentsOrder) { moreoptions += '<option value=' + binaryInstallAgentsOrder[i] + '>' + binaryInstallAgents[binaryInstallAgentsOrder[i]] + '</option>' }
5642-
x += '<div id=aginsSysTypeDiv>';
5643-
x += addHtmlValue("System Type", '<select id=aginsSysType onchange=addAgentToMeshClick() style=width:236px>' + moreoptions + '</select>');
5638+
// Add Linux binary installer option
5639+
var linuxBinaryInstallAgentsOrder = [6, 5, 41, 30, 32, 25, 26, 28, 40, 37, 36, 45];
5640+
var linuxBinaryInstallAgents = { 6 : 'Linux x86-64', 5 : 'Linux x86-32', 25 : 'Linux ARM-HF, Rasberry Pi', 26 : 'Linux ARM64-HF', 28: 'Linux MIPS24KC (OpenWRT)', 30 : 'FreeBSD x86-64', 32: 'Linux ARM 64 bit (glibc/2.24 NOKVM)', 36: 'OpenWRT x86-64', 37: 'OpenBSD x86-64', 40: 'Linux MIPSEL24KC (OpenWRT)', 41: 'ARMADA/CORTEX-A53/MUSL (OpenWRT)', 45: 'RISC-V 64bit' };
5641+
var linuxOptions = '';
5642+
for (var i in linuxBinaryInstallAgentsOrder) { linuxOptions += '<option value="' + linuxBinaryInstallAgentsOrder[i] + '"' + (i == 0 ? ' selected' : '') + '>' + linuxBinaryInstallAgents[linuxBinaryInstallAgentsOrder[i]] + '</option>' }
5643+
5644+
// Add macOS binary installer option
5645+
var macOSBinaryInstallAgentsOrder = [10005, 16, 29];
5646+
var macOSBinaryInstallAgents = { 10005 : 'macOS Universal', 16: 'macOS x86-64', 29: 'macOS ARM-64' };
5647+
var macOSOptions = '';
5648+
for (var i in macOSBinaryInstallAgentsOrder) { macOSOptions += '<option value="' + macOSBinaryInstallAgentsOrder[i] + '"' + (i == 0 ? ' selected' : '') + '>' + macOSBinaryInstallAgents[macOSBinaryInstallAgentsOrder[i]] + '</option>' }
5649+
5650+
x += '<div id="aginsSysTypeDiv_linux">';
5651+
x += addHtmlValue("System Type", '<select id="aginsSysType_linux" onchange="addAgentToMeshClick()" style="width:236px">' + linuxOptions + '</select>');
5652+
x += '</div>';
5653+
x += '<div id="aginsSysTypeDiv_macos">';
5654+
x += addHtmlValue("System Type", '<select id="aginsSysType_macos" onchange="addAgentToMeshClick()" style="width:236px">' + macOSOptions + '</select>');
56445655
x += '</div>';
56455656

56465657
// Add agent and assistant installation type option
5647-
x += '<div id=aginsTypeDiv>';
5648-
x += addHtmlValue("Installation Type", '<select id=aginsType onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Background & interactive" + '</option><option value=2>' + "Background only" + '</option><option value=1>' + "Interactive only" + '</option></select>');
5658+
x += '<div id="aginsTypeDiv_windows">';
5659+
x += addHtmlValue("Installation Type", '<select id="aginsType_windows" onchange="addAgentToMeshClick()" style="width:236px"><option value="0">' + "Background & interactive" + '</option><option value="2">' + "Background only" + '</option><option value="1">' + "Interactive only" + '</option></select>');
5660+
x += '</div><div id="aginsTypeDiv_binary_macos">';
5661+
x += addHtmlValue("Installation Type", '<select id="aginsType_macos" onchange="addAgentToMeshClick()" style="width:236px"><option value="10">' + "Background & interactive (ZIP)" + '</option><option value="12">' + "Background only (ZIP)" + '</option><option value="11">' + "Interactive only (ZIP)" + '</option><option value="0">' + "Background & interactive (Deprecated)" + '</option><option value="2">' + "Background only (Deprecated)" + '</option><option value="1">' + "Interactive only (Deprecated)" + '</option></select>');
5662+
x += '</div><div id="aginsTypeDiv_binary_other">';
5663+
x += addHtmlValue("Installation Type", '<select id="aginsType_other" onchange="addAgentToMeshClick()" style="width:236px"><option value="0">' + "Background & interactive" + '</option><option value="2">' + "Background only" + '</option><option value="1">' + "Interactive only" + '</option></select>');
56495664
x += '</div><div id=asinsTypeDiv>';
56505665
x += addHtmlValue("Installation Type", '<select id=asinsType onchange=addAgentToMeshClick() style=width:236px><option value=2>' + "Application, Connect on user request" + '</option><option value=3>' + "Application, Always connected" + '</option><option value=0>' + "System Tray, Connect on user request" + '</option><option value=1>' + "System Tray, Always connected" + '</option><option value=4>' + "System Tray, Monitor only" + '</option></select>');
56515666
x += '</div><hr>';
@@ -5711,9 +5726,15 @@
57115726
x += '</div>';
57125727

57135728
// Linux binary installer
5714-
x += '<div id=agins_linux_inst style=display:none>' + "This is a executable on OS's with graphical user interfaces" + '<br /><br />' + "Apple macOS executables will need to be removed from quarantine to run 'xattr -r -d com.apple.quarantine meshagent'" + '<br /><br />' + "You need to 'chmod +x meshagent' and run this file" + '<br /><br />';
5715-
x += addHtmlValue("Mesh Agent", '<a id=aginsbinlnk name="meshagents?id=' + meshid.split('/')[2] + '&installflags=0' + (urlargs.key?('&key=' + urlargs.key):'') + '">' + "meshagent" + '</a> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=' + meshid.split('/')[2] + '&installflags=",1)>');
5716-
x += addHtmlValue("Command", '<input id=aginsbincmd type=text style="width:216px" readonly value=\'wget -O meshagent' + (((features & 0x80000000) != 0)?' --no-check-certificate':'') + ' \"https://' + servername + portStr + domainUrl + 'meshagents?id=' + meshid.split('/')[2].split('$').join('%24').split('@').join('%40') + '\' /> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentIdValue("aginsbincmd")>');
5729+
x += '<div id=agins_linux_inst style=display:none>' + "This is a executable on OS's with graphical user interfaces" + '<br /><br />' + "You need to 'chmod +x meshagent' and run this file" + '<br /><br />';
5730+
x += addHtmlValue("Mesh Agent", '<a id=aginsbinlnk_linux name="meshagents?id=' + meshid.split('/')[2] + '&installflags=0' + (urlargs.key?('&key=' + urlargs.key):'') + '">' + "meshagent" + '</a> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=' + meshid.split('/')[2] + '&installflags=",1)>');
5731+
x += addHtmlValue("Command", '<input id=aginsbincmd_linux type=text style="width:216px" readonly value=\'wget -O meshagent' + (((features & 0x80000000) != 0)?' --no-check-certificate':'') + ' \"https://' + servername + portStr + domainUrl + 'meshagents?id=' + meshid.split('/')[2].split('$').join('%24').split('@').join('%40') + '\' /> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentIdValue("aginsbincmd_linux")>');
5732+
x += '</div>';
5733+
5734+
// macOS binary installer
5735+
x += '<div id=agins_macos_inst style=display:none>' + "This is an executable for macOS" + '<br /><br />' + "macOS executables will need to be removed from quarantine to run 'xattr -r -d com.apple.quarantine meshagent'" + '<br /><br />' + "You need to 'chmod +x meshagent' and run this file" + '<br /><br />';
5736+
x += addHtmlValue("Mesh Agent", '<a id=aginsbinlnk_macos name="meshagents?id=' + meshid.split('/')[2] + '&installflags=10' + (urlargs.key?('&key=' + urlargs.key):'') + '">' + "meshagent.zip" + '</a> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentUrl("meshagents?id=' + meshid.split('/')[2] + '&installflags=",1)>');
5737+
x += addHtmlValue("Command", '<input id=aginsbincmd_macos type=text style="width:216px" readonly value=\'curl -o meshagent.zip \"https://' + servername + portStr + domainUrl + 'meshagents?id=' + meshid.split('/')[2].split('$').join('%24').split('@').join('%40') + '&installflags=10&meshinstall=10005' + (urlargs.key?('&key=' + urlargs.key):'') + '\"' + '\' /> <img src=images/link4.png height=10 width=10 title="' + "Copy agent URL to clipboard" + '" style=cursor:pointer onclick=copyAgentIdValue("aginsbincmd_macos")>');
57175738
x += '</div>';
57185739

57195740
setDialogMode(2, "Add Mesh Agent", 2, null, x, 'fileDownload');
@@ -5748,10 +5769,16 @@
57485769
var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
57495770
var portStr = (serverinfo.port == 443) ? '' : (':' + serverinfo.port);
57505771
var c = 'https://' + servername + portStr + domainUrl + url;
5751-
if (addflag == 1) c += Q('aginsType').value;
5772+
var v = Q('aginsSelect').value;
5773+
if (addflag == 1) {
5774+
if (v == 0 || v == 3) { c += Q('aginsType_windows').value; }
5775+
else if (v == 9) { c += Q('aginsType_macos').value; }
5776+
else if (v == 5) { c += Q('aginsType_other').value; }
5777+
}
57525778
c += (urlargs.key?('&key=' + urlargs.key):'');
5753-
if (Q('aginsSelect').value == 5) { c += '&meshinstall=' + Q('aginsSysType').value; }
5754-
if (Q('aginsSelect').value == 7) { c += '&ac=' + Q('asinsType').value; }
5779+
if (v == 5) { c += '&meshinstall=' + Q('aginsSysType_linux').value; }
5780+
if (v == 9) { c += '&meshinstall=' + Q('aginsSysType_macos').value; }
5781+
if (v == 7) { c += '&ac=' + Q('asinsType').value; }
57555782
copyTextToClip(c);
57565783
}
57575784

@@ -5763,24 +5790,44 @@
57635790
QV('agins_windows_un', v == 3);
57645791
QV('agins_linux_un', v == 4);
57655792
QV('agins_linux_inst', v == 5);
5766-
QV('aginsSysTypeDiv', v == 5);
5793+
QV('aginsSysTypeDiv_linux', v == 5);
5794+
QV('aginsSysTypeDiv_macos', v == 9);
57675795
QV('agins_qrcode', v == 6);
57685796
QV('agins_assistant', (v == 7) && (Q('asinsType').value != 4));
57695797
QV('agins_assistant2', (v == 7) && (Q('asinsType').value == 4));
57705798
QV('agins_osx_un', v == 8);
5771-
Q('aginsbinlnk').onclick = function() { downloadFile((Q('aginsbinlnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):'') + '&meshinstall=' + Q('aginsSysType').value); };
5772-
Q('aginsbincmd').value = (Q('aginsbincmd').value.split('&installflags=')[0]) + '&installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):'') + '&meshinstall=' + Q('aginsSysType').value + '\"';
5773-
QV('aginsTypeDiv', (v == 0) || (v == 5));
5799+
QV('agins_macos_inst', v == 9);
5800+
5801+
// Update Installation Type div visibility
5802+
QV('aginsTypeDiv_windows', v == 0);
5803+
QV('aginsTypeDiv_binary_macos', v == 9);
5804+
QV('aginsTypeDiv_binary_other', v == 5);
57745805
QV('asinsTypeDiv', (v == 7));
57755806

5807+
// Update Linux binary installer
5808+
if (v == 5) {
5809+
Q('aginsbinlnk_linux').onclick = function() { downloadFile((Q('aginsbinlnk_linux').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_other').value + (urlargs.key?('&key=' + urlargs.key):'') + '&meshinstall=' + Q('aginsSysType_linux').value); };
5810+
Q('aginsbincmd_linux').value = (Q('aginsbincmd_linux').value.split('&installflags=')[0]) + '&installflags=' + Q('aginsType_other').value + (urlargs.key?('&key=' + urlargs.key):'') + '&meshinstall=' + Q('aginsSysType_linux').value + '\"';
5811+
}
5812+
5813+
// Update macOS binary installer
5814+
if (v == 9) {
5815+
Q('aginsbinlnk_macos').onclick = function() { downloadFile((Q('aginsbinlnk_macos').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_macos').value + (urlargs.key?('&key=' + urlargs.key):'') + '&meshinstall=' + Q('aginsSysType_macos').value); };
5816+
Q('aginsbincmd_macos').value = (Q('aginsbincmd_macos').value.split('&installflags=')[0]) + '&installflags=' + Q('aginsType_macos').value + (urlargs.key?('&key=' + urlargs.key):'') + '&meshinstall=' + Q('aginsSysType_macos').value + '\"';
5817+
}
5818+
57765819
// Fix the links if needed
5777-
Q('aginsw32lnk').onclick = function() { downloadFile((Q('aginsw32lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5778-
Q('aginsw64lnk').onclick = function() { downloadFile((Q('aginsw64lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5779-
Q('aginswa64lnk').onclick = function() { downloadFile((Q('aginswa64lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5780-
Q('aginsw32unlnk').onclick = function() { downloadFile((Q('aginsw32lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5781-
Q('aginsw64unlnk').onclick = function() { downloadFile((Q('aginsw64lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5782-
Q('aginswa64unlnk').onclick = function() { downloadFile((Q('aginswa64lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5783-
if (debugmode > 0) { Q('aginswmshlnk').onclick = function() { downloadFile((Q('aginswmshlnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); } }
5820+
if (v == 0) {
5821+
Q('aginsw32lnk').onclick = function() { downloadFile((Q('aginsw32lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_windows').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5822+
Q('aginsw64lnk').onclick = function() { downloadFile((Q('aginsw64lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_windows').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5823+
Q('aginswa64lnk').onclick = function() { downloadFile((Q('aginswa64lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_windows').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5824+
}
5825+
if (v == 3) {
5826+
Q('aginsw32unlnk').onclick = function() { downloadFile((Q('aginsw32lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_windows').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5827+
Q('aginsw64unlnk').onclick = function() { downloadFile((Q('aginsw64lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_windows').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5828+
Q('aginswa64unlnk').onclick = function() { downloadFile((Q('aginswa64lnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_windows').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); }
5829+
if (debugmode > 0) { Q('aginswmshlnk').onclick = function() { downloadFile((Q('aginswmshlnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType_windows').value + (urlargs.key?('&key=' + urlargs.key):''), null, true); } }
5830+
}
57845831
Q('asinslnk').onclick = function() { downloadFile(Q('asinslnk').name + '&ac=' + Q('asinsType').value, null, true); }
57855832
Q('asinslnk2').onclick = function() { downloadFile(Q('asinslnk').name + '&ac=' + Q('asinsType').value, null, true); }
57865833
if (v == 7) {

0 commit comments

Comments
 (0)