Fixed guest sharing desktop quality.
Ylian Saint-Hilaire committed
Sep 2, 2021 at 14:10 UTC
fb6acd901b85c0322ed0eb24ba3e3a8a04f60f0c
3 files changed
+14
-3
meshcentral-config-schema.json
+1
-1
@@ -114,7 +114,7 @@
114
"meshErrorLogPath": { "type": "string" },
115
"npmPath": { "type": "string" },
116
"npmProxy": { "type": "string", "format": "uri" },
117
- "allowHighQualityDesktop": { "type": "boolean", "default": true },
117
+ "allowHighQualityDesktop": { "type": "boolean", "default": true, "description": "When false, users will only be able to set remote desktop image quality to 60%, this can reduce server bandwidth usage." },
118
"webPush": {
119
"type": "object",
120
"description": "When set with a valid email address, enables the MeshCentral web push notification feature. Allows administrators to send browser notifications to users even if they are not looking at the MeshCentral web site.",
views/sharing.handlebars
+8
-1
@@ -307,6 +307,13 @@
307
QH('p13power', printFlexDateTime(new Date(parseInt(expire))));
308
}
309
var features = parseInt('{{{features}}}');
310
+ var features2 = parseInt('{{{features2}}}');
311
+
312
+ // Load desktop settings
313
+ var t = null;
314
+ try { t = localStorage.getItem('desktopsettings'); } catch (ex) { }
315
+ if (t != null) { try { desktopsettings = JSON.parse(t); } catch (ex) { } }
316
+ if (((features2 & 1) == 0) && (desktopsettings.quality > 60)) { desktopsettings.quality = 60; }
317
318
// Terminal
319
var terminal = null;
@@ -771,7 +778,7 @@
778
}
779
780
function applyDesktopSettings() {
774
- var r = '', ops = [60, 50, 40, 30, 20, 10, 5, 1];
781
+ var r = '', ops = (features2 & 1) ? [90, 80, 70, 60, 50, 40, 30, 20, 10, 5, 1] : [60, 50, 40, 30, 20, 10, 5, 1]
782
for (var i in ops) { r += '<option value=' + ops[i] + '>' + ops[i] + '%</option>'; }
783
QH('d7bitmapquality', r);
784
d7desktopmode.value = desktopsettings.encoding;
webserver.js
+5
-1
@@ -3507,11 +3507,15 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3507
// Consent flags are 1 = Notify, 8 = Prompt, 64 = Privacy Bar.
3508
const authCookie = obj.parent.encodeCookie({ userid: c.uid, domainid: domain.id, nid: c.nid, ip: req.clientIp, p: c.p, gn: c.gn, cf: c.cf, r: 8, expire: c.expire, pid: c.pid, vo: c.vo }, obj.parent.loginCookieEncryptionKey);
3509
3510
+ // Server features
3511
+ var features2 = 0;
3512
+ if (obj.args.allowhighqualitydesktop !== false) { features2 += 1; } // Enable AllowHighQualityDesktop (Default true)
3513
+
3514
// Lets respond by sending out the desktop viewer.
3515
var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
3516
parent.debug('web', 'handleSharingRequest: Sending guest sharing page for \"' + c.uid + '\", guest \"' + c.gn + '\".');
3517
res.set({ 'Cache-Control': 'no-store' });
3514
- render(req, res, getRenderPage('sharing', req, domain), getRenderArgs({ authCookie: authCookie, authRelayCookie: '', domainurl: encodeURIComponent(domain.url).replace(/'/g, '%27'), nodeid: c.nid, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, expire: c.expire, viewOnly: (c.vo == 1) ? 1 : 0, nodeName: encodeURIComponent(node.name).replace(/'/g, '%27'), features: c.p }, req, domain));
3518
+ render(req, res, getRenderPage('sharing', req, domain), getRenderArgs({ authCookie: authCookie, authRelayCookie: '', domainurl: encodeURIComponent(domain.url).replace(/'/g, '%27'), nodeid: c.nid, serverDnsName: obj.getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, expire: c.expire, viewOnly: (c.vo == 1) ? 1 : 0, nodeName: encodeURIComponent(node.name).replace(/'/g, '%27'), features: c.p, features2: features2 }, req, domain));
3519
});
3520
});
3521
}