Added option to remove guest sharing links.

This commit is contained in:
Ylian Saint-Hilaire 2021-01-20 00:26:53 -08:00
parent 67fb1081b0
commit ceedd0c756
7 changed files with 12 additions and 4 deletions

View File

@ -12,7 +12,7 @@ var agents = {
'meshagent_osx-x86-64': 16,
'meshagent_poky64': 18,
'meshagent_x86_nokvm': 19,
'meshagent_x86-64_nokvm': 20,
'meshagent_x86-64_nokvm': 20,
'meshagent_arm-linaro': 24,
'meshagent_armhf': 25,
'meshagent_arm64': 26,

View File

@ -979,7 +979,7 @@ function createMeshCore(agent) {
}
case 'setclip': {
// Set the load clipboard to a user value
//sendConsoleText('setClip: ' + JSON.stringify(data));
sendConsoleText('setClip: ' + JSON.stringify(data));
if (typeof data.data == 'string') {
MeshServerLogEx(22, [data.data.length], "Setting clipboard content, " + data.data.length + " byte(s)", data);
if (require('MeshAgent').isService) { require('clipboard').dispatchWrite(data.data); } else { require("clipboard")(data.data); } // Set the clipboard

View File

@ -167,7 +167,7 @@
"meshQuota": { "type": "integer" },
"loginKey": { "type": [ "string", "array" ], "items": { "type": "string" }, "default": null, "description": "Requires that users add the value ?key=xxx in the URL in order to see the web site." },
"minify": { "type": "boolean", "default": false, "description": "When enabled, the server will send reduced sided web pages." },
"newAccounts": { "type": "boolean" },
"newAccounts": { "type": "boolean", "default": false, "description": "When set to true, allow new user accounts to be created from the login page." },
"newAccountsUserGroups": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
"userNameIsEmail": { "type": "boolean", "default": false, "description": "When enabled, the username of each account is also the email address of the account." },
"newAccountEmailDomains": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
@ -177,6 +177,7 @@
"hide": { "type": "integer", "default": 0 },
"footer": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is logged in." },
"loginfooter": { "type": "string", "default": null, "description": "This is a HTML string displayed at the bottom of the web page when a user is not logged in." },
"guestDeviceSharing": { "type": "boolean", "default": true, "description": "When set to false, the desktop/terminal sharing link feature is not available." },
"certUrl": {
"type": "string",
"format": "uri",

View File

@ -460,6 +460,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
}
serverinfo.https = true;
serverinfo.redirport = args.redirport;
if (domain.guestdevicesharing === false) { serverinfo.guestdevicesharing = false; }
if (typeof domain.userconsentflags == 'number') { serverinfo.consent = domain.userconsentflags; }
if ((typeof domain.usersessionidletimeout == 'number') && (domain.usersessionidletimeout > 0)) { serverinfo.timeout = (domain.usersessionidletimeout * 60 * 1000); }
if (user.siteadmin === SITERIGHT_ADMIN) {
@ -4682,6 +4683,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
break;
}
case 'deviceShares': {
if (domain.guestdevicesharing === false) return; // This feature is not allowed.
var err = null;
// Argument validation
@ -4733,6 +4735,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
break;
}
case 'removeDeviceShare': {
if (domain.guestdevicesharing === false) return; // This feature is not allowed.
var err = null;
// Argument validation
@ -4797,6 +4800,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
break;
}
case 'createDeviceShareLink': {
if (domain.guestdevicesharing === false) return; // This feature is not allowed.
var err = null;
// Argument validation

View File

@ -127,6 +127,7 @@
"_userQuota": 1048576,
"_meshQuota": 248576,
"minify": true,
"_guestDeviceSharing" : false,
"_loginKey": [ "abc", "123" ],
"_newAccounts": true,
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],

View File

@ -5961,7 +5961,7 @@
x += '<input type=button value="' + "Log Event" + '" title="' + "Write an event for this device" + '" onclick=writeDeviceEvent("' + encodeURIComponentEx(node._id) + '") />';
if ((connectivity & 1) && (meshrights & 8) && (node.agent.id != 14)) { x += '<input type=button value="' + "Message" + '" title="' + "Display a text message on the remote device" + '" onclick=deviceMessageFunction() />'; }
//if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += '<input type=button value=Toast title="' + "Display a text message of the remote device" + '" onclick=deviceToastFunction() />'; }
if ((node.agent!=null) && (node.agent.caps & 3) && (connectivity & 1) && (meshrights & 8) && ((meshrights == 0xFFFFFFFF) || ((meshrights & 4352) == 0))) { x += '<input type=button value="' + "Share" + '" title="' + "Create a link to share this device with a guest" + '" onclick=showShareDevice() />'; }
if ((serverinfo.guestdevicesharing !== false) && (node.agent != null) && (node.agent.caps & 3) && (connectivity & 1) && (meshrights & 8) && ((meshrights == 0xFFFFFFFF) || ((meshrights & 4352) == 0))) { x += '<input type=button value="' + "Share" + '" title="' + "Create a link to share this device with a guest" + '" onclick=showShareDevice() />'; }
// Custom UI
if ((customui != null) && (customui.devicebuttons != null)) {

View File

@ -3033,6 +3033,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
const domain = getDomain(req, res);
if (domain == null) { return; }
if (req.query.c == null) { res.sendStatus(404); return; }
if (domain.guestdevicesharing === false) { res.sendStatus(404); return; } // This feature is not allowed.
// Check the inbound desktop sharing cookie
var c = obj.parent.decodeCookie(req.query.c, obj.parent.invitationLinkEncryptionKey, 60); // 60 minute timeout
@ -3071,6 +3072,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
const domain = getDomain(req, res);
if (domain == null) { return; }
if (req.query.c == null) { res.sendStatus(404); return; }
if (domain.guestdevicesharing === false) { res.sendStatus(404); return; } // This feature is not allowed.
// Check the inbound desktop sharing cookie
var c = obj.parent.decodeCookie(req.query.c, obj.parent.invitationLinkEncryptionKey, 60); // 60 minute timeout