Added ?hide=x support to agent invite pages.

Ylian Saint-Hilaire committed Jan 24, 2022 at 18:23 UTC 18c2bf4d73efd13fa8f8ae0c16895cbeb0497ffd
4 files changed +57 -12
views/agentinvite.handlebars
+35 -8
@@ -73,7 +73,7 @@
73 </div>
74 </div>
75 </div>
76 - <div id="column_l" style="max-height:calc(100vh - 135px);overflow-y:auto">
76 + <div id="column_l" style="overflow-y:auto">
77 <h1><span id="groupname">Remote Agent Installation</span></h1>
78 <p>
79 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.
@@ -183,14 +183,41 @@
183 var magenturl = '{{{magenturl}}}';
184 var groupName = decodeURIComponent('{{{meshname}}}');
185 var urlargs = parseUriArgs();
186 - if (groupName != '') {
187 - QH('groupname', format("Remote Agent Installation for {0}", escapeHtml(groupName)));
188 - document.title = format("{0} - Agent Installation", groupName);
189 - } else {
190 - document.title = "Agent Installation";
186 +
187 + function startup() {
188 + // Setup page visuals
189 + var hide = 0;
190 + var globalHide = parseInt('{{{hide}}}');
191 + if (globalHide || urlargs.hide) {
192 + if (urlargs.hide) { hide = parseInt(urlargs.hide); }
193 + if (globalHide) { hide = (hide | globalHide); }
194 + }
195 + urlargs.hide = hide;
196 + QV('masthead', !(hide & 1));
197 + QV('topbar', !(hide & 2));
198 + QV('footer', !(hide & 4));
199 + if ((hide & 4) != 0) { QC('body').add('nofooter'); } else { QC('body').remove('nofooter'); }
200 + if (hide != 0) {
201 + // Fix the main grid to zero-height elements we want to hide.
202 + if (uiMode == 2) {
203 + QS('container')['grid-template-rows'] = ((hide & 1) ? '0' : '66') + 'px fit-content(48px) auto ' + ((hide & 4) ? '0' : '45') + 'px';
204 + QS('container')['-ms-grid-rows'] = ((hide & 1) ? '0' : '66') + 'px fit-content(48px) auto ' + ((hide & 4) ? '0' : '45') + 'px';
205 + } else {
206 + QS('container')['grid-template-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
207 + QS('container')['-ms-grid-rows'] = ((hide & 1) ? '0' : '66') + 'px ' + ((hide & 2) ? '0' : '24') + 'px auto ' + ((hide & 4) ? '0' : '45') + 'px';
208 + }
209 + }
210 +
211 + if (groupName != '') {
212 + QH('groupname', format("Remote Agent Installation for {0}", escapeHtml(groupName)));
213 + document.title = format("{0} - Agent Installation", groupName);
214 + } else {
215 + document.title = "Agent Installation";
216 + }
217 +
218 + userInterfaceSelectMenu();
219 + setup();
220 }
192 - userInterfaceSelectMenu();
193 - setup();
221
222 // Create the QR code
223 new QRCode(Q('android_qrimage'), { text: magenturl, width: 220, height: 220, colorDark: '#000000', colorLight: '#FFF', correctLevel: QRCode.CorrectLevel.M });
views/default-mobile.handlebars
+2 -2
@@ -657,10 +657,10 @@
657 <div id=masthead style="background:url(logo.png) 0px 0px;background-size:341px 50px;background-color:#036;background-repeat:no-repeat;height:50px;width:100%;overflow:hidden">
658 <div style="width:calc(100% - 50px);overflow:hidden">
659 <div style="float:left;height:66px;color:#c8c8c8;padding-left:10px;padding-top:6px">
660 - <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif">{{{title1}}}</font></strong>
660 + <strong><font style="font-size:36px;font-family:Arial,Helvetica,sans-serif;text-shadow: 1px 1px 2px #000;">{{{title1}}}</font></strong>
661 </div>
662 <div style="float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:10px">
663 - <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif">{{{title2}}}</font></strong>
663 + <strong><font style="font-size:12px;font-family:Arial,Helvetica,sans-serif;text-shadow: 1px 1px 2px #000;">{{{title2}}}</font></strong>
664 </div>
665 </div>
666 <div id=notificationCount onclick="clickNotificationIcon()" class="unselectable" style="position:absolute;right:50px;top:0px;font-size:28px;width:50px;height:50px;cursor:pointer;display:none" title="Click to view current notifications"><div id="notificationCount2" style="padding-top:8px">0</div></div>
views/invite.handlebars
+19 -1
@@ -72,7 +72,7 @@
72 </div>
73 </div>
74 </div>
75 - <div id="column_l" style="max-height:calc(100vh - 135px);overflow-y:auto">
75 + <div id="column_l" style="overflow-y:auto">
76 <h1>Welcome</h1>
77 <p>
78 This is a portal for computer remote management and support.
@@ -117,6 +117,24 @@
117 function start() {
118 if (urlargs.c != null) { Q('inviteCode').value = urlargs.c; }
119
120 + // Setup page visuals
121 + var hide = 0;
122 + var globalHide = parseInt('{{{hide}}}');
123 + if (globalHide || urlargs.hide) {
124 + if (urlargs.hide) { hide = parseInt(urlargs.hide); }
125 + if (globalHide) { hide = (hide | globalHide); }
126 + }
127 + urlargs.hide = hide;
128 + QV('masthead', !(hide & 1));
129 + QV('topbar', !(hide & 2));
130 + QV('footer', !(hide & 4));
131 + if ((hide & 4) != 0) { QC('body').add('nofooter'); } else { QC('body').remove('nofooter'); }
132 + if (hide != 0) {
133 + // Fix the main grid to zero-height elements we want to hide.
134 + QS('container')['grid-template-rows'] = ((hide & 1) ? '0' : '66') + 'px fit-content(48px) auto ' + ((hide & 4) ? '0' : '45') + 'px';
135 + QS('container')['-ms-grid-rows'] = ((hide & 1) ? '0' : '66') + 'px fit-content(48px) auto ' + ((hide & 4) ? '0' : '45') + 'px';
136 + }
137 +
138 var messageid = parseInt('{{{messageid}}}');
139 var okmessages = [''];
140 var failmessages = ["Invalid invitation code."];
webserver.js
+1 -1
@@ -1893,7 +1893,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
1893 for (var i in obj.meshes) {
1894 if ((obj.meshes[i].domain == domain.id) && (obj.meshes[i].deleted == null) && (obj.meshes[i].invite != null) && (obj.meshes[i].invite.codes.indexOf(req.body.inviteCode) >= 0)) {
1895 // Send invitation link, valid for 1 minute.
1896 - res.redirect(domain.url + 'agentinvite?c=' + parent.encodeCookie({ a: 4, mid: i, f: obj.meshes[i].invite.flags, expire: 1 }, parent.invitationLinkEncryptionKey) + (req.query.key ? ('&key=' + req.query.key) : ''));
1896 + res.redirect(domain.url + 'agentinvite?c=' + parent.encodeCookie({ a: 4, mid: i, f: obj.meshes[i].invite.flags, expire: 1 }, parent.invitationLinkEncryptionKey) + (req.query.key ? ('&key=' + req.query.key) : '') + (req.query.hide ? ('&hide=' + req.query.hide) : ''));
1897 return;
1898 }
1899 }