diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index 0d9d5ed7..6e10c53a 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -114,7 +114,7 @@ "meshErrorLogPath": { "type": "string" }, "npmPath": { "type": "string" }, "npmProxy": { "type": "string", "format": "uri" }, - "allowHighQualityDesktop": { "type": "boolean", "default": true }, + "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." }, "webPush": { "type": "object", "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.", diff --git a/views/sharing.handlebars b/views/sharing.handlebars index 85adb676..d0ffde93 100644 --- a/views/sharing.handlebars +++ b/views/sharing.handlebars @@ -307,6 +307,13 @@ QH('p13power', printFlexDateTime(new Date(parseInt(expire)))); } var features = parseInt('{{{features}}}'); + var features2 = parseInt('{{{features2}}}'); + + // Load desktop settings + var t = null; + try { t = localStorage.getItem('desktopsettings'); } catch (ex) { } + if (t != null) { try { desktopsettings = JSON.parse(t); } catch (ex) { } } + if (((features2 & 1) == 0) && (desktopsettings.quality > 60)) { desktopsettings.quality = 60; } // Terminal var terminal = null; @@ -771,7 +778,7 @@ } function applyDesktopSettings() { - var r = '', ops = [60, 50, 40, 30, 20, 10, 5, 1]; + var r = '', ops = (features2 & 1) ? [90, 80, 70, 60, 50, 40, 30, 20, 10, 5, 1] : [60, 50, 40, 30, 20, 10, 5, 1] for (var i in ops) { r += ''; } QH('d7bitmapquality', r); d7desktopmode.value = desktopsettings.encoding; diff --git a/webserver.js b/webserver.js index 33c0ec15..eb7c5636 100644 --- a/webserver.js +++ b/webserver.js @@ -3507,11 +3507,15 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { // Consent flags are 1 = Notify, 8 = Prompt, 64 = Privacy Bar. 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); + // Server features + var features2 = 0; + if (obj.args.allowhighqualitydesktop !== false) { features2 += 1; } // Enable AllowHighQualityDesktop (Default true) + // Lets respond by sending out the desktop viewer. var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified parent.debug('web', 'handleSharingRequest: Sending guest sharing page for \"' + c.uid + '\", guest \"' + c.gn + '\".'); res.set({ 'Cache-Control': 'no-store' }); - 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)); + 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)); }); }); }