master
handlebars 539 lines 35.6 KB
Raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html lang="en">
3 <head>
4 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
5 <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
6 <meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0" />
7 <meta name="apple-mobile-web-app-capable" content="yes" />
8 <meta name="format-detection" content="telephone=no" />
9 <meta name="robots" content="noindex,nofollow" />
10 <link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS" />
11 {{{customCSSTags}}}
12 <link rel="apple-touch-icon" href="/favicon-303x303.png" />
13 <script type="text/javascript" src="scripts/common-0.0.1{{min}}.js"></script>
14 <script type="text/javascript" src="scripts/qrcode.min.js"></script>
15 {{{customJSTags}}}
16 <title>Agent Installation</title>
17 <style>
18 .tab {
19 overflow: hidden;
20 border: 1px solid #ccc;
21 background-color: #f1f1f1;
22 }
23
24 .tab button {
25 background-color: inherit;
26 float: left;
27 border: none;
28 outline: none;
29 cursor: pointer;
30 padding: 14px 16px;
31 transition: 0.3s;
32 }
33
34 .tab button:hover {
35 background-color: #ddd;
36 }
37
38 .tab button.active {
39 background-color: #8f8;
40 }
41
42 .tabcontent {
43 display: none;
44 padding: 6px 12px;
45 border: 1px solid #ccc;
46 border-top: none;
47 }
48 </style>
49 </head>
50 <body id="body" onload="if (typeof(startup) !== 'undefined') startup();" style="display:none;overflow:hidden">
51 <div id="container">
52 <!-- Begin Masthead -->
53 <div id="masthead" class="noselect AgentInviteMasthead">
54 <div style="float:left;text-shadow: 1px 1px 2px #000">{{{titlehtml}}}</div>
55 <div style="float:left; height: 66px; color:#c8c8c8; padding-left:14px; padding-top:7px">
56 <strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;text-shadow: 1px 1px 2px #000">{{{title1}}}</font></strong>
57 </div>
58 <div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px">
59 <strong><font style="font-size:14px; font-family: Arial, Helvetica, sans-serif;text-shadow: 1px 1px 2px #000">{{{title2}}}</font></strong>
60 </div>
61 <p id="logoutControl" style="color:white;font-size:11px;margin: 10px 10px 0;">{{{logoutControl}}}</p>
62 </div>
63 <div id="page_leftbar">
64 <div style="height:16px"></div>
65 </div>
66 <div id=topbar class="noselect style3" style="height:24px;position:relative">
67 <div id=uiMenuButton title="User interface selection" onclick="showUserInterfaceSelectMenu()">
68 &diams;
69 <div id=uiMenu style="display:none">
70 <div id=uiViewButton1 class=uiSelector onclick=userInterfaceSelectMenu(1) title="Left bar interface"><div class="uiSelector1"></div></div>
71 <div id=uiViewButton2 class=uiSelector onclick=userInterfaceSelectMenu(2) title="Top bar interface"><div class="uiSelector2"></div></div>
72 <div id=uiViewButton3 class=uiSelector onclick=userInterfaceSelectMenu(3) title="Fixed width interface"><div class="uiSelector3"></div></div>
73 <div id=uiViewButton4 class=uiSelector onclick=toggleNightMode() title="Toggle night mode"><div class="uiSelector4"></div></div>
74 </div>
75 </div>
76 </div>
77 <div id="column_l" style="overflow-y:auto">
78 <h1><span id="groupname">Remote Agent Installation</span></h1>
79 <p>
80 You have been invited to install an application that will allow a remote operator to securely access your computer including the desktop and files. Only follow the instructions below if this invitation was expected and you know who will be accessing your computer. Select your operating system and follow the instructions below for installation.
81 </p>
82 <div>
83 <div class="tab">
84 <button id="twintab64" class="tablinks" onclick="openTab(event, 'wintab64')">Windows 64bit</button>
85 <button id="twintab32" class="tablinks" onclick="openTab(event, 'wintab32')">Windows 32bit</button>
86 <button id="twintabarm64" class="tablinks" onclick="openTab(event, 'wintabarm64')">Windows ARM 64bit</button>
87 <button id="tlinuxtab" class="tablinks" onclick="openTab(event, 'linuxtab')">Linux / BSD Scripts</button>
88 <button id="tlinuxbinarytab" class="tablinks" onclick="openTab(event, 'linuxbinarytab')">Linux / BSD / macOS Binary Installer</button>
89 <button id="tmacostab64" class="tablinks" onclick="openTab(event, 'macostab64')">macOS x86-64bit</button>
90 <button id="tmacostabarm64" class="tablinks" onclick="openTab(event, 'macostabarm64')">macOS ARM (64bit)</button>
91 <button id="tmacostab" class="tablinks" onclick="openTab(event, 'macostab')">macOS (Universal)</button>
92 <button id="tandrotab" class="tablinks" onclick="openTab(event, 'androtab')">Android</button>
93 <button id="tassistab" class="tablinks" onclick="openTab(event, 'assistab')">Assistant</button>
94 </div>
95
96 <div id="wintab64" class="tabcontent" style="background-color:white;color:black">
97 <h3>Microsoft&trade; Windows 64bit</h3>
98 <p><a id="win64url">Download the software here</a>, run it and press "Install" or "Connect".</p>
99 <div style="text-align:center">
100 <a id="win64url2"><img class="winagent-img" src="images/winagent.png" /></a>
101 </div>
102 </div>
103
104 <div id="wintab32" class="tabcontent" style="background-color:white;color:black">
105 <h3>Microsoft&trade; Windows 32bit</h3>
106 <p><a id="win32url">Download the software here</a>, run it and press "Install" or "Connect".</p>
107 <div style="text-align:center">
108 <a id="win32url2"><img class="winagent-img" src="images/winagent.png" /></a>
109 </div>
110 </div>
111
112 <div id="wintabarm64" class="tabcontent" style="background-color:white;color:black">
113 <h3>Microsoft&trade; Windows ARM 64bit</h3>
114 <p><a id="winarm64url">Download the software here</a>, run it and press "Install" or "Connect".</p>
115 <div style="text-align:center">
116 <a id="winarm64url2"><img class="winagent-img" src="images/winagent.png" /></a>
117 </div>
118 </div>
119
120 <div id="linuxtab" class="tabcontent" style="background-color:white;color:black">
121 <h3>Linux</h3>
122 <p>To install, cut and paste the following command in a root terminal.</p>
123 <div id="linuxinstall" style="font-family:courier,'courier new',monospace;margin-left:30px"></div>
124 <input type="button" value="Copy to clipboard" style="margin-left:30px;margin-top:4px" onclick="copyToClipLinuxInstall()" />
125 <p>To uninstall, cut and paste the following command as root.</p>
126 <div id="unlinuxinstall" style="font-family:courier,'courier new',monospace;margin-left:30px"></div>
127 <input type="button" value="Copy to clipboard" style="margin-left:30px;margin-top:4px" onclick="copyToClipLinuxUnInstall()" />
128 <br /><br />
129 </div>
130
131 <div id="linuxbinarytab" class="tabcontent" style="background-color:white;color:black"></div>
132
133 <div id="macostab64" class="tabcontent" style="background-color:white;color:black">
134 <h3>Apple&trade; MacOS x86-64bit</h3>
135 <p><a id="macos64url">Download the installer here</a>, right click on it or press "control" and click on the file. Then select "Open" and follow the instructions.</p>
136 <div style="text-align:center">
137 <a id="macos64url2"><img src="images/macosagent.png" /></a>
138 </div>
139 </div>
140
141 <div id="macostabarm64" class="tabcontent" style="background-color:white;color:black">
142 <h3>Apple&trade; MacOS ARM 64bit</h3>
143 <p><a id="macosarm64url">Download the installer here</a>, right click on it or press "control" and click on the file. Then select "Open" and follow the instructions.</p>
144 <div style="text-align:center">
145 <a id="macosarm64url2"><img src="images/macosagent.png" /></a>
146 </div>
147 </div>
148
149 <div id="macostab" class="tabcontent" style="background-color:white;color:black">
150 <h3>Apple&trade; MacOS Universal</h3>
151 <p><a id="macosurl">Download the installer here</a>, right click on it or press "control" and click on the file. Then select "Open" and follow the instructions.</p>
152 <div style="text-align:center">
153 <a id="macosurl2"><img src="images/macosagent.png" /></a>
154 </div>
155 </div>
156
157 <div id="androtab" class="tabcontent" style="background-color:white;color:black">
158 <h3>Android</h3>
159 <div id=agins_qrcode style=min-height:220px;min-width:220px;float:right>
160 <a id=android_qrimage2 href="{{{magenturl}}}" rel="noreferrer noopener" target=_blank>
161 <div id=android_qrimage style=float:right;margin-left:10px;width:220px;height:220px;cursor:pointer;margin-left:25px></div>
162 </a>
163 </div>
164 <div style="min-height:220px">
165 <p>Download the agent software using the Google Play store or APK file, install it and use the QR code on the right or the pairing link below to setup your device on this server.</p>
166 <p>
167 <a rel="noreferrer noopener" target=_blank href="https://play.google.com/store/apps/details?id=com.meshcentral.agent2"><img style=cursor:pointer src="images/google-play-140.png" width=140 srcset="images/google-play-280.png 2x" /></a>
168 </p>
169 <p>
170 <a rel="noreferrer noopener" target=_blank href="https://www.amazon.co.uk/gp/product/B097Z4Q7SK/"><img style=cursor:pointer src="images/amazon-appstore-140.png" width=140 srcset="images/amazon-appstore-280.png 2x" /></a>
171 </p>
172 <p>
173 <a id="androidurl">Android APK Download</a>
174 </p>
175 <p>
176 <a rel="noreferrer noopener" target=_blank href="{{{magenturl}}}">Server Pairing Link</a>
177 </p>
178 </div>
179 </div>
180
181 <div id="assistab" class="tabcontent" style="background-color:white;color:black">
182 <h3>Assistant</h3>
183 <div style="min-height:220px">
184 <img src="images/assistant-200.png" srcset="images/assistant-400.png 2x" style="float:right;margin-left:8px" width="148" height="200" />
185 <p>Assistant is a Windows system tray tool that can be used when help is needed. This is not an agent that runs in the background of the managed computer, instead, it's a tool that connects to the server only when requested.</p>
186 <p>
187 <a id="assisturl" rel="noreferrer noopener" target=_blank>Download Assistant for Windows</a>
188 </p>
189 </div>
190 <br style="clear:both" />
191 </div>
192 </div>
193 </div>
194 <div id="footer">
195 <table cellpadding="0" cellspacing="10" style="width: 100%">
196 <tr>
197 <td style="text-align:left"></td>
198 <td style="text-align:right"></td>
199 </tr>
200 </table>
201 </div>
202 </div>
203 <script>
204 'use strict';
205
206 var random = '{{{randomlength}}}' // Random length string for BREACH mitigation
207 var uiMode = parseInt(getstore('uiMode', 1));
208 var webPageStackMenu = false;
209 var webPageFullScreen = true;
210 var nightMode = (getstore('_nightMode', '0') == '1');
211 var domain = '{{{domain}}}';
212 var domainUrl = '{{{domainurl}}}';
213 var meshid = '{{{meshid}}}';
214 var title = decodeURIComponent('{{{extitle}}}');
215 var serverPort = '{{{serverport}}}';
216 var serverHttps = '{{{serverhttps}}}';
217 var serverNoProxy = '{{{servernoproxy}}}';
218 var installFlags = '{{{installflags}}}';
219 var showAgents = parseInt('{{{showagents}}}'); // 0 = Show all agents, 1 = Windows only, 2 = Linux only, 4 = MacOS only, 8 = Assistant only, 16 = Android
220 var magenturl = '{{{magenturl}}}';
221 var groupName = decodeURIComponent('{{{meshname}}}');
222 var urlargs = parseUriArgs();
223
224 function startup() {
225 // Setup page visuals
226 var hide = 0;
227 var globalHide = parseInt('{{{hide}}}');
228 if (globalHide || urlargs.hide) {
229 if (urlargs.hide) { hide = parseInt(urlargs.hide); }
230 if (globalHide) { hide = (hide | globalHide); }
231 }
232 urlargs.hide = hide;
233 QV('masthead', !(hide & 1));
234 QV('topbar', !(hide & 2));
235 QV('footer', !(hide & 4));
236 if ((hide & 4) != 0) { QC('body').add('nofooter'); } else { QC('body').remove('nofooter'); }
237 if (hide != 0) {
238 // Fix the main grid to zero-height elements we want to hide.
239 if (uiMode == 2) {
240 QS('container')['grid-template-rows'] = ((hide & 1) ? '0' : '66') + 'px fit-content(48px) auto ' + ((hide & 4) ? '0' : '45') + 'px';
241 QS('container')['-ms-grid-rows'] = ((hide & 1) ? '0' : '66') + 'px fit-content(48px) auto ' + ((hide & 4) ? '0' : '45') + 'px';
242 } else {
243 QS('container')['grid-template-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
244 QS('container')['-ms-grid-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
245 }
246 }
247
248 if (groupName != '') {
249 QH('groupname', format("Remote Agent Installation for {0}", escapeHtml(groupName)));
250 document.title = format("{0} - Agent Installation", groupName);
251 } else {
252 document.title = "Agent Installation";
253 }
254
255 // Setup visible tabs
256 var tabcount = 0, tabselect = null;
257 var tab1 = (showAgents == 0) || (showAgents & 1); //win64
258 var tab2 = (showAgents == 0) || (showAgents & 1); //win32
259 var tab3 = (showAgents == 0) || (showAgents & 1); //winarm64
260 var tab4 = (showAgents == 0) || (showAgents & 2); //linux
261 var tab5 = (showAgents == 0) || (showAgents & 2); //linuxbinary
262 var tab6 = (showAgents == 0) || (showAgents & 4); //macos64
263 var tab7 = (showAgents == 0) || (showAgents & 4); //macosarm64
264 var tab8 = (showAgents == 0) || (showAgents & 4); //macos
265 var tab9 = (showAgents == 0) || (showAgents & 16); //android
266 var tab10 = (showAgents == 0) || (showAgents & 8); //assistant
267 if (tab10) { tabcount++; tabselect = 'assistab'; }
268 if (tab9) { tabcount++; tabselect = 'androtab'; }
269 if (tab8) { tabcount++; tabselect = 'macostab'; }
270 if (tab7) { tabcount++; tabselect = 'macostabarm64'; }
271 if (tab6) { tabcount++; tabselect = 'macostab64'; }
272 if (tab5) { tabcount++; tabselect = 'linuxbinarytab'; }
273 if (tab4) { tabcount++; tabselect = 'linuxtab'; }
274 if (tab3) { tabcount++; tabselect = 'wintabarm64'; }
275 if (tab2) { tabcount++; tabselect = 'wintab32'; }
276 if (tab1) { tabcount++; tabselect = 'wintab64'; }
277 QV('twintab64', tab1 && (tabcount > 1));
278 QV('twintab32', tab2 && (tabcount > 1));
279 QV('twintabarm64', tab3 && (tabcount > 1));
280 QV('tlinuxtab', tab4 && (tabcount > 1));
281 QV('tlinuxbinarytab', tab5 && (tabcount > 1));
282 QV('tmacostab64', tab6 && (tabcount > 1));
283 QV('tmacostabarm64', tab7 && (tabcount > 1));
284 QV('tmacostab', tab8 && (tabcount > 1));
285 QV('tandrotab', tab9 && (tabcount > 1));
286 QV('tassistab', tab10 && (tabcount > 1));
287
288 userInterfaceSelectMenu();
289 setup();
290 openTab(null, tabselect);
291 }
292
293 function linuxBinarySetup() {
294 var x = '<h3>' + "Linux / BSD / macOS Binary Installer" + '</h3>', moreoptions = '';
295 var opts = '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px>';
296 opts += '<option value=5 selected>' + "Linux / BSD / macOS Binary Installer" + '</option>';
297 opts += '</select>';
298 x += '<table style=display:none><td style=width:120px><td><b>' + opts + '</b></table>';
299 var servername = window.location.hostname;
300 if ((servername.indexOf('.') == -1)) { 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.
301 var portStr = (serverPort == 443) ? '' : (':' + serverPort);
302 var binaryInstallAgentsOrder = [ 6, 5, 10005, 25, 26, 28, 30, 32, 36, 37, 40, 41, 45, 16, 29 ];
303 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', 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' };
304 for (var i in binaryInstallAgentsOrder) { moreoptions += '<option value=' + binaryInstallAgentsOrder[i] + '>' + binaryInstallAgents[binaryInstallAgentsOrder[i]] + '</option>' }
305 x += '<div id=aginsSysTypeDiv>';
306 x += addHtmlValue("System Type", '<select id=aginsSysType onchange=addAgentToMeshClick() style=width:236px>' + moreoptions + '</select>');
307 x += '</div>';
308 x += '<div id=aginsTypeDiv>';
309 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>');
310 x += '</div><hr>';
311 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 by running 'xattr -r -d com.apple.quarantine meshagent'." + '<br /><br />' + "You need to run 'chmod +x meshagent', and then run this file." + '<br /><br />';
312 x += addHtmlValue("Mesh Agent", '<a id=aginsbinlnk name="meshagents?id=' + meshid + '&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 + '&installflags=",1)>');
313 x += addHtmlValue("Command", '<input id=aginsbincmd type=text style="width:216px" readonly value=\'wget -O meshagent ' + ((serverNoProxy != 0) ?'--no-proxy':'') + ' --no-check-certificate \"https://' + servername + portStr + domainUrl + 'meshagents?id=' + meshid.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")>');
314 x += '</div>';
315 QH('linuxbinarytab', x);
316 addAgentToMeshClick();
317 }
318
319 function addAgentToMeshClick() {
320 if (installFlags != 0) { Q('aginsType').value = installFlags; }
321 var v = Q('aginsSelect').value;
322 QV('agins_linux_un', v == 4);
323 QV('agins_linux_inst', v == 5);
324 QV('aginsSysTypeDiv', v == 5);
325 Q('aginsbinlnk').onclick = function() { downloadFile((Q('aginsbinlnk').name.split('installflags=')[0]) + 'installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):'') + '&meshinstall=' + Q('aginsSysType').value); };
326 Q('aginsbincmd').value = (Q('aginsbincmd').value.split('&installflags=')[0]) + '&installflags=' + Q('aginsType').value + (urlargs.key?('&key=' + urlargs.key):'') + '&meshinstall=' + Q('aginsSysType').value + '\"';
327 QV('aginsTypeDiv', (installFlags != 0) ? false : ((v == 0) || (v == 5)));
328 QV('asinsTypeDiv', (v == 7));
329 }
330
331 // Create the QR code
332 new QRCode(Q('android_qrimage'), { text: magenturl, width: 220, height: 220, colorDark: '#000000', colorLight: '#FFF', correctLevel: QRCode.CorrectLevel.M });
333 Q('android_qrimage2').setAttribute('href', magenturl)
334
335 // Toggle user interface menu
336 function showUserInterfaceSelectMenu() {
337 Q('uiViewButton1').classList.remove('uiSelectorSel');
338 Q('uiViewButton2').classList.remove('uiSelectorSel');
339 Q('uiViewButton3').classList.remove('uiSelectorSel');
340 Q('uiViewButton4').classList.remove('uiSelectorSel');
341 try { Q('uiViewButton' + uiMode).classList.add('uiSelectorSel'); } catch (ex) { }
342 QV('uiMenu', (QS('uiMenu').display == 'none'));
343 if (nightMode) { Q('uiViewButton4').classList.add('uiSelectorSel'); }
344 }
345
346 function userInterfaceSelectMenu(s) {
347 if (s) { uiMode = s; putstore('uiMode', uiMode); }
348 webPageFullScreen = (uiMode < 3);
349 webPageStackMenu = true;//(uiMode > 1);
350 toggleFullScreen(0);
351 toggleStackMenu(0);
352 QC('column_l').add('room4submenu');
353 }
354
355 function toggleNightMode() {
356 nightMode = !nightMode;
357 if (nightMode) { QC('body').add('night'); } else { QC('body').remove('night'); }
358 putstore('_nightMode', nightMode ? '1' : '0');
359 }
360
361 // Toggle the web page to full screen
362 function toggleFullScreen(toggle) {
363 if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); }
364 var hide = 0;
365 //if (args.hide) { hide = parseInt(args.hide); }
366 if (webPageFullScreen == false) {
367 QC('body').remove('menu_stack');
368 QC('body').remove('fullscreen');
369 QC('body').remove('arg_hide');
370 //if (xxcurrentView >= 10) QC('column_l').add('room4submenu');
371 //QV('UserDummyMenuSpan', false);
372 //QV('page_leftbar', false);
373 } else {
374 QC('body').add('fullscreen');
375 if (hide & 16) QC('body').add('arg_hide'); // This is replacement for QV('page_leftbar', !(hide & 16));
376 //QV('UserDummyMenuSpan', (xxcurrentView < 10) && webPageFullScreen);
377 //QV('page_leftbar', true);
378 }
379 QV('body', true);
380 }
381
382 // If FullScreen, toggle menu to be horisontal or vertical
383 function toggleStackMenu(toggle) {
384 if (webPageFullScreen == true) {
385 if (toggle === 1) {
386 webPageStackMenu = !webPageStackMenu;
387 putstore('webPageStackMenu', webPageStackMenu);
388 }
389 if (webPageStackMenu == false) {
390 QC('body').remove('menu_stack');
391 } else {
392 QC('body').add('menu_stack');
393 //if (xxcurrentView >= 10) QC('column_l').remove('room4submenu');
394 }
395 }
396 }
397
398 function putstore(name, val) { try { if (typeof (localStorage) === 'undefined') return; localStorage.setItem(name, val); } catch (e) { } }
399 function getstore(name, val) { try { if (typeof (localStorage) === 'undefined') return val; var v = localStorage.getItem(name); if ((v == null) || (v == null)) return val; return v; } catch (e) { return val; } }
400
401 function openTab(evt, tabname) {
402 // Declare all variables
403 var i, tabcontent, tablinks;
404
405 // Get all elements with class="tabcontent" and hide them
406 tabcontent = document.getElementsByClassName('tabcontent');
407 for (i = 0; i < tabcontent.length; i++) {
408 tabcontent[i].style.display = 'none';
409 }
410
411 // Get all elements with class="tablinks" and remove the class "active"
412 tablinks = document.getElementsByClassName('tablinks');
413 for (i = 0; i < tablinks.length; i++) {
414 tablinks[i].className = tablinks[i].className.replace(' active', '');
415 }
416
417 // Show the current tab, and add an "active" class to the button that opened the tab
418 document.getElementById(tabname).style.display = 'block';
419 if (evt != null) { evt.currentTarget.className += ' active'; } else { document.getElementById('t' + tabname).className += ' active'; }
420 }
421
422 var linuxInstall, linuxUnInstall;
423 function setup() {
424 var servername = window.location.hostname;
425 var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
426
427 // Loginkey
428 var loginkey = '';
429 if (urlargs.key != null) { loginkey = ('&key=' + urlargs.key); }
430
431 // Windows 64bit Setup
432 var url = 'meshagents?id=4&meshid=' + meshid;
433 if (installFlags != 0) { url += ('&installflags=' + installFlags); }
434 Q('win64url').href = url;
435 Q('win64url2').href = url;
436
437 // Windows 32bit Setup
438 url = 'meshagents?id=3&meshid=' + meshid;
439 if (installFlags != 0) { url += ('&installflags=' + installFlags); }
440 Q('win32url').href = url;
441 Q('win32url2').href = url;
442
443 // Windows ARM64bit Setup
444 url = 'meshagents?id=43&meshid=' + meshid;
445 if (installFlags != 0) { url += ('&installflags=' + installFlags); }
446 Q('winarm64url').href = url;
447 Q('winarm64url2').href = url;
448
449 // MacOS Universal Setup
450 url = 'meshosxagent?id=10005&meshid=' + meshid;
451 Q('macosurl').href = url;
452 Q('macosurl2').href = url;
453
454 // MacOS ARM 64 Setup
455 url = 'meshosxagent?id=29&meshid=' + meshid;
456 Q('macosarm64url').href = url;
457 Q('macosarm64url2').href = url;
458
459 // MacOS x86-64 Setup
460 url = 'meshosxagent?id=16&meshid=' + meshid;
461 Q('macos64url').href = url;
462 Q('macos64url2').href = url;
463
464 // Linux Setup
465 if (serverHttps == 1) {
466 var portStr = (serverPort == 443) ? '' : (':' + serverPort);
467 if (serverNoProxy == 0) {
468 linuxInstall = '(wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-check-certificate -O ./meshinstall.sh || wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\'\r\n';
469 linuxUnInstall = '(wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-check-certificate -O ./meshinstall.sh || wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-proxy --no-check-certificate -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh uninstall https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\' || ./meshinstall.sh uninstall https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\'\r\n';
470 } else {
471 // Server asked that agent be installed to preferably not use a HTTP proxy.
472 linuxInstall = 'wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\' || ./meshinstall.sh https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\'\r\n';
473 linuxUnInstall = 'wget "https://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-proxy --no-check-certificate -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh uninstall https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\' || ./meshinstall.sh uninstall https://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\'\r\n';
474 }
475 } else {
476 var portStr = (serverPort == 80) ? '' : (':' + serverPort);
477 if (serverNoProxy == 0) {
478 linuxInstall = '(wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" -O ./meshinstall.sh || wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\' || ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\'\r\n';
479 linuxUnInstall = '(wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" -O ./meshinstall.sh || wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-proxy -O ./meshinstall.sh) && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh uninstall http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\' || ./meshinstall.sh uninstall http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\'\r\n';
480 } else {
481 // Server asked that agent be installed to preferably not use a HTTP proxy.
482 linuxInstall = 'wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\' || ./meshinstall.sh http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\'\r\n';
483 linuxUnInstall = 'wget "http://' + servername + portStr + domainUrl + 'meshagents?script=1' + loginkey + '" --no-proxy -O ./meshinstall.sh && chmod 755 ./meshinstall.sh && sudo -E ./meshinstall.sh uninstall http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\' || ./meshinstall.sh uninstall http://' + servername + portStr + domainUrlNoSlash + ' \'' + meshid + '\'\r\n';
484 }
485 }
486 QH('linuxinstall', linuxInstall);
487 QH('unlinuxinstall', linuxUnInstall);
488
489 // Linux Binary Setup
490 linuxBinarySetup();
491
492 // MeshCentral Assistant
493 url = 'meshagents?id=10006&meshid=' + meshid + '&ac={{{assistanttype}}}';
494 Q('assisturl').href = url;
495
496 // Android Setup
497 var url = 'meshagents?id=14&meshid=' + meshid;
498 if (installFlags != 0) { url += ('&installflags=' + installFlags); }
499 Q('androidurl').href = url;
500
501 // Attempt to detect the most likely operating system for this browser
502 if (navigator.userAgent.indexOf('Win64') >= 0) { openTab(null, 'wintab64'); }
503 else if (navigator.userAgent.indexOf('Windows') >= 0) { openTab(null, 'wintab32'); }
504 else if (navigator.userAgent.indexOf('Linux') >= 0) { openTab(null, 'linuxtab'); }
505 else if (navigator.userAgent.indexOf('Macintosh') >= 0) { openTab(null, 'macostab'); }
506 else if (navigator.userAgent.indexOf('Android') >= 0) { openTab(null, 'androtab'); }
507 else { openTab(null, 'wintab64'); }
508 }
509
510 function copyToClipLinuxInstall() { copyTextToClip(linuxInstall); }
511 function copyToClipLinuxUnInstall() { copyTextToClip(linuxUnInstall); }
512 function copyTextToClip(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = txt; document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
513 function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); };
514 function escapeHtml(string) { return String(string).replace(/[&<>"'`=\/]/g, function (s) { return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '/': '&#x2F;', '`': '&#x60;', '=': '&#x3D;' }[s]; }); };
515 function escapeHtmlBreaks(string) { return String(string).replace(/[&<>"'`=\/]/g, function (s) { return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', '/': '&#x2F;', '`': '&#x60;', '=': '&#x3D;', '\r': '<br />', '\n': '' }[s]; }); };
516 function addHtmlValue(t, v) { return '<table><td style=width:120px>' + t + '<td><b>' + v + '</b></table>'; }
517 function downloadFile(link, name, closeDialog) {
518 var element = document.createElement('iframe');
519 element.style.cssText = 'display:none;width:0;height:0;border:0;visibility:hidden;';
520 element.src = link;
521 document.body.appendChild(element);
522 setTimeout(function() { try { if (element.parentNode) { document.body.removeChild(element); } } catch(e) { } }, 10000);
523 if (closeDialog) { setDialogMode(0); }
524 }
525 function copyAgentUrl(url,addflag) {
526 var servername = window.location.hostname;
527 if ((servername.indexOf('.') == -1)) { 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.
528 var portStr = (serverPort == 443) ? '' : (':' + serverPort);
529 var c = 'https://' + servername + portStr + domainUrl + url;
530 if (addflag == 1) c += Q('aginsType').value;
531 c += (urlargs.key?('&key=' + urlargs.key):'');
532 if (Q('aginsSelect').value == 5) { c += '&meshinstall=' + Q('aginsSysType').value; }
533 if (Q('aginsSelect').value == 7) { c += '&ac=' + Q('asinsType').value; }
534 copyTextToClip(c);
535 }
536 function copyAgentIdValue(id) { copyTextToClip(Q(id).value); }
537 </script>
538 </body>
539 </html>