Alternate messaging system improvements (#4274)

This commit is contained in:
Ylian Saint-Hilaire 2022-07-15 14:23:01 -07:00
parent cd99f81064
commit ea977d8c0d
4 changed files with 91 additions and 47 deletions

View File

@ -395,14 +395,18 @@
}
}
},
"altMessenging": {
"type": "object",
"properties": {
"name": { "type": "string", "description": "Name of the alternative messaging service, for example: \"Jitsi\" " },
"url": { "type": "string", "description": "URL to the alternative messaging services, for example: \"https://meet.jit.si/myserver-{0}\"" },
"localurl": { "type": "string", "description": "If specified, this is the URL that is used on the administrator side, for example: \"https://meet.jit.si/myserver-{0}\"" }
},
"required": [ "name", "url" ]
"altMessenging": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string", "description": "Name of the alternative messaging service, for example: \"Jitsi\" " },
"url": { "type": "string", "description": "URL to the alternative messaging services, for example: \"https://meet.jit.si/myserver-{0}\", for a device {0}, {1}, {2}, {3} is the device id. For a user, {0} is the userid, {1} is full userid with dashes, {2} is real name with no spaces, {3} is real name with dash instead of spaces." },
"localurl": { "type": "string", "description": "If specified, this is the URL that is used on the administrator side, for example: \"https://meet.jit.si/myserver-{0}\", for a device {0}, {1}, {2}, {3} is the device id. For a user, {0} is the userid, {1} is full userid with dashes, {2} is real name with no spaces, {3} is real name with dash instead of spaces." },
"type": { "type": "string", "enum": [null, "user", "device"], "default": null, "description": "Indicate if this button should be shown in the user or device type. If obmitted, it will be displayed in both." }
},
"required": [ "name", "url" ]
}
},
"deviceMeshRouterLinks": {
"rdp": { "type": "boolean", "default": true, "description": "Display a RDP link in the device tab when supported." },

View File

@ -554,9 +554,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
}
if (matchingDomains.length > 0) { serverinfo.amtAcmFqdn = matchingDomains; }
}
if ((typeof domain.altmessenging == 'object') && (typeof domain.altmessenging.name == 'string') && (typeof domain.altmessenging.url == 'string')) { serverinfo.altmessenging = [{ name: domain.altmessenging.name, url: domain.altmessenging.url, localurl: domain.altmessenging.localurl }]; }
if (typeof domain.devicemeshrouterlinks == 'object') { serverinfo.devicemeshrouterlinks = domain.devicemeshrouterlinks; }
if (Array.isArray(domain.altmessenging)) { serverinfo.altmessenging = []; for (var i in domain.altmessenging) { if ((typeof domain.altmessenging[i] == 'object') && (typeof domain.altmessenging[i].name == 'string') && (typeof domain.altmessenging[i].url == 'string')) { serverinfo.altmessenging.push({ name: domain.altmessenging[i].name, url: domain.altmessenging[i].url }); } } }
if ((typeof domain.altmessenging == 'object') && (typeof domain.altmessenging.name == 'string') && (typeof domain.altmessenging.url == 'string')) { serverinfo.altmessenging = [{ name: domain.altmessenging.name, url: domain.altmessenging.url, localurl: domain.altmessenging.localurl, type: domain.altmessenging.type }]; }
if (Array.isArray(domain.altmessenging)) { serverinfo.altmessenging = []; for (var i in domain.altmessenging) { if ((typeof domain.altmessenging[i] == 'object') && (typeof domain.altmessenging[i].name == 'string') && (typeof domain.altmessenging[i].url == 'string')) { serverinfo.altmessenging.push({ name: domain.altmessenging[i].name, url: domain.altmessenging[i].url, type: domain.altmessenging[i].type }); } } }
serverinfo.https = true;
serverinfo.redirport = args.redirport;
if (parent.parent.webpush != null) { serverinfo.vapidpublickey = parent.parent.webpush.vapidPublicKey; } // Web push public key

View File

@ -10,7 +10,7 @@
"_WANonly": true,
"_LANonly": true,
"_maintenanceMode": true,
"_certificatePrivateKeyPassword": ["password1", "password2"],
"_certificatePrivateKeyPassword": [ "password1", "password2" ],
"_sessionTime": 60,
"_sessionKey": "MyReallySecretPassword1",
"_sessionSameSite": "strict",
@ -83,9 +83,9 @@
"_agentAllowedIP": "192.168.0.100/24",
"_agentBlockedIP": "127.0.0.1,::1",
"_authLog": "c:\\temp\\auth.log",
"_InterUserMessaging": ["user//admin"],
"_manageAllDeviceGroups": ["user//admin"],
"_manageCrossDomain": ["user//admin"],
"_InterUserMessaging": [ "user//admin" ],
"_manageAllDeviceGroups": [ "user//admin" ],
"_manageCrossDomain": [ "user//admin" ],
"_localDiscovery": {
"name": "Local server name",
"info": "Information about this server"
@ -146,7 +146,10 @@
"count": 10,
"coolofftime": 10
},
"watchDog": { "interval": 100, "timeout": 400 },
"watchDog": {
"interval": 100,
"timeout": 400
},
"_AmtProvisioningServer": {
"port": 9971,
"deviceGroup": "mesh//xxxxxxxxxxxxxxxxxxxxx",
@ -179,15 +182,15 @@
"_nightMode": 1,
"_userQuota": 1048576,
"_meshQuota": 248576,
"_loginKey": ["abc", "123"],
"_agentKey": ["abc", "123"],
"_loginKey": [ "abc", "123" ],
"_agentKey": [ "abc", "123" ],
"_ipkvm": false,
"minify": true,
"_newAccounts": true,
"_newAccountsUserGroups": ["ugrp//xxxxxxxxxxxxxxxxx"],
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"_userNameIsEmail": true,
"_newAccountEmailDomains": ["sample.com"],
"_newAccountsRights": ["nonewgroups", "notools"],
"_newAccountEmailDomains": [ "sample.com" ],
"_newAccountsRights": [ "nonewgroups", "notools" ],
"_welcomeText": "Sample Text on Login Page.",
"_welcomePicture": "mainwelcome.jpg",
"_welcomePictureFullScreen": false,
@ -202,13 +205,23 @@
"_AutoRemoveInactiveDevices": 37,
"_DeviceSearchBarServerAndClientName": false,
"_agentSelfGuestSharing": {
"expire": 120
},
"_certUrl": "https://192.168.2.106:443/",
"_altMessenging": {
"name": "Jitsi",
"url": "https://meet.jit.si/myserver-{0}"
"expire": 120
},
"_certUrl": "https://192.168.2.106:443/",
"_altMessenging": [
{
"name": "Jitsi",
"url": "https://meet.jit.si/myserver-{0}",
"localurl": "https://meet.jit.si/myserver-local-{0}",
"type": "device"
},
{
"name": "Jitsi",
"url": "https://meet.jit.si/myserver-{0}-{1}-{2}-{3}",
"localurl": "https://meet.jit.si/myserver-local-{0}-{1}-{2}-{3}",
"type": "user"
}
],
"_deviceMeshRouterLinks": {
"rdp": true,
"ssh": true,
@ -219,7 +232,7 @@
"protocol": "http",
"port": 80,
"_ip": "192.168.1.100",
"_filter": ["mesh/(domainid)/(meshid)", "node/(domainid)/(nodeid)"]
"_filter": [ "mesh/(domainid)/(meshid)", "node/(domainid)/(nodeid)" ]
},
{
"name": "HTTPS",
@ -364,7 +377,12 @@
}
},
"_amtManager": {
"adminAccounts": [{ "user": "admin", "pass": "MyP@ssw0rd" }],
"adminAccounts": [
{
"user": "admin",
"pass": "MyP@ssw0rd"
}
],
"environmentDetection": [
"domain1.com",
"domain2.com",
@ -393,8 +411,8 @@
"Strict-Transport-Security": "max-age=360000",
"x-frame-options": "SAMEORIGIN"
},
"_agentConfig": ["webSocketMaskOverride=1", "coreDumpEnabled=1"],
"_assistantConfig": ["disableUpdate=1"],
"_agentConfig": [ "webSocketMaskOverride=1", "coreDumpEnabled=1" ],
"_assistantConfig": [ "disableUpdate=1" ],
"_sessionRecording": {
"_onlySelectedUsers": true,
"_onlySelectedUserGroups": true,
@ -405,42 +423,42 @@
"_maxRecordingDays": 15,
"_maxRecordingSizeMegabytes": 3,
"__protocols__": "Is an array: 1 = Terminal, 2 = Desktop, 5 = Files, 100 = Intel AMT WSMAN, 101 = Intel AMT Redirection, 200 = Messenger",
"protocols": [1, 2, 101]
"protocols": [ 1, 2, 101 ]
},
"_authStrategies": {
"__comment__": "This section is used to allow users to login using other accounts. You will need to get an API key from the services and register callback URL's",
"twitter": {
"_callbackurl": "https://server/auth-twitter-callback",
"newAccounts": true,
"_newAccountsUserGroups": ["ugrp//xxxxxxxxxxxxxxxxx"],
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"clientid": "xxxxxxxxxxxxxxxxxxxxxxx",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"google": {
"_callbackurl": "https://server/auth-google-callback",
"newAccounts": true,
"_newAccountsUserGroups": ["ugrp//xxxxxxxxxxxxxxxxx"],
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"clientid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxx"
},
"github": {
"_callbackurl": "https://server/auth-github-callback",
"newAccounts": true,
"_newAccountsUserGroups": ["ugrp//xxxxxxxxxxxxxxxxx"],
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"clientid": "xxxxxxxxxxxxxxxxxxxxxxx",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"reddit": {
"_callbackurl": "https://server/auth-reddit-callback",
"newAccounts": true,
"_newAccountsUserGroups": ["ugrp//xxxxxxxxxxxxxxxxx"],
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"clientid": "xxxxxxxxxxxxxxxxxxxxxxx",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"azure": {
"_callbackurl": "https://server/auth-azure-callback",
"newAccounts": true,
"_newAccountsUserGroups": ["ugrp//xxxxxxxxxxxxxxxxx"],
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"clientid": "00000000-0000-0000-0000-000000000000",
"clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tenantid": "00000000-0000-0000-0000-000000000000"
@ -448,7 +466,7 @@
"jumpcloud": {
"_callbackurl": "https://server/auth-jumpcloud-callback",
"newAccounts": true,
"_newAccountsUserGroups": ["ugrp//xxxxxxxxxxxxxxxxx"],
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"entityid": "meshcentral",
"idpurl": "https://sso.jumpcloud.com/saml2/saml2",
"cert": "jumpcloud-saml.pem"
@ -457,8 +475,8 @@
"_callbackurl": "https://server/auth-saml-callback",
"_disableRequestedAuthnContext": true,
"newAccounts": true,
"_newAccountsUserGroups": ["ugrp//xxxxxxxxxxxxxxxxx"],
"_newAccountsRights": ["nonewgroups", "notools"],
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"_newAccountsRights": [ "nonewgroups", "notools" ],
"entityid": "meshcentral",
"idpurl": "https://server/saml2",
"cert": "saml.pem"
@ -494,7 +512,7 @@
"uid": "anneonyme",
"mail": "anneonyme@example.com",
"email": "anneonyme@example.com",
"otherMail": ["other.anneonyme@example.com", "anneonyme@example.com"]
"otherMail": [ "other.anneonyme@example.com", "anneonyme@example.com" ]
},
"so": {
"displayName": "Sticker Sophie",
@ -502,7 +520,7 @@
"uid": "ssticker",
"mail": "ssticker@example.com",
"email": "ssticker@example.com",
"otherMail": ["other.ssticker@example.com", "ssticker@example.com"]
"otherMail": [ "other.ssticker@example.com", "ssticker@example.com" ]
}
},
"__LDAPOptions": {
@ -551,7 +569,7 @@
"_sendmail": {
"newline": "unix",
"path": "/usr/sbin/sendmail",
"_args": ["-f", "foo@example.com"]
"_args": [ "-f", "foo@example.com" ]
},
"_sms": {
"provider": "twilio",

View File

@ -7144,7 +7144,12 @@
//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 ((meshrights & 8) && (connectivity & 1) || ((node.pmt == 1) && ((features2 & 2) != 0))) { x += '<input type=button value="' + "Chat" + '" title="' + "Open chat window to this computer" + '" onclick=deviceChat(event) />'; }
if ((serverinfo != null) && (serverinfo.altmessenging != null) && (meshrights & 8) && (connectivity & 1)) {
for (var i in serverinfo.altmessenging) { x += '<input type=button value="' + EscapeHtml(serverinfo.altmessenging[i].name) + '" onclick=altDeviceChat(event,' + i + ') />'; }
for (var i in serverinfo.altmessenging) {
var am = serverinfo.altmessenging[i];
if ((am.type == null) || (am.type == 'device')) {
x += '<input type=button value="' + EscapeHtml(serverinfo.altmessenging[i].name) + '" onclick=altDeviceChat(event,' + i + ') />';
}
}
}
if ((serverinfo.guestdevicesharing !== false) && (node.agent != null) && (node.agent.caps & 3) && (connectivity & 1) && ((meshrights & 0x80008) == 0x80008) && ((meshrights == 0xFFFFFFFF) || ((meshrights & 0x1000) == 0))) {
x += '<input type=button value="' + "Share" + '" title="' + "Create a link to share this device with a guest" + '" onclick=showShareDevice() />';
@ -7633,9 +7638,9 @@
function altDeviceChat(e, i) {
if (xxdialogMode) return;
var url = serverinfo.altmessenging[i].url.split('{0}').join(currentNode._id.split('/').join('-'));
var url = serverinfo.altmessenging[i].url.split('{0}').join(currentNode._id.split('/')[2]).split('{1}').join(currentNode._id.split('/')[2]).split('{2}').join(currentNode._id.split('/')[2]).split('{3}').join(currentNode._id.split('/')[2]);
var localurl = url;
if (typeof serverinfo.altmessenging[i].localurl == 'string') { localurl = serverinfo.altmessenging[i].localurl.split('{0}').join(currentNode._id.split('/').join('-')); }
if (typeof serverinfo.altmessenging[i].localurl == 'string') { localurl = serverinfo.altmessenging[i].localurl.split('{0}').join(currentNode._id.split('/')[2]).split('{1}').join(currentNode._id.split('/')[2]).split('{2}').join(currentNode._id.split('/')[2]).split('{3}').join(currentNode._id.split('/')[2]); }
if (url != '') { meshserver.send({ action: 'msg', type: 'openUrl', nodeid: currentNode._id, url: url }); }
if (localurl != '') { safeNewWindow(localurl, 'altmessenger:' + currentNode._id, 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=560'); }
}
@ -14429,7 +14434,17 @@
function altUserChat(e, userid, name, i) {
if (xxdialogMode) return;
haltEvent(e);
var url = serverinfo.altmessenging[i].url.split('{0}').join(userid.split('/').join('-'));
var url = serverinfo.altmessenging[i].url;
var ruserid = decodeURIComponent(userid);
var userid1 = encodeURIComponentEx(ruserid.split('/')[2]); // userid
var userid2 = encodeURIComponentEx(ruserid.split('/').join('-')); // user-domain-userid
var userid3 = userid1, userid4 = userid2;
var ruser = users[ruserid];
if ((ruser != null) && (ruser.realname != null)) {
userid3 = encodeURIComponentEx(ruser.realname.split(' ').join('')); // real name with no empty spaces
userid4 = encodeURIComponentEx(ruser.realname.split(' ').join('-')); // real name with - instead of spaces
}
url = url.split('{0}').join(userid1).split('{1}').join(userid2).split('{2}').join(userid3).split('{3}').join(userid4);
if (urlargs.key) { url += '&key=' + urlargs.key; }
safeNewWindow(url, 'altmessenger:' + userid);
meshserver.send({ action: 'notifyuser', userid: decodeURIComponent(userid), msg: serverinfo.altmessenging[i].name, msgid: 11, url: url });
@ -15429,7 +15444,14 @@
if (!self && ((activeSessions > 0) || ((features2 & 8) && (user.webpush)))) {
x += '<input type=button value="' + "Notify" + '" title="' + "Send user notification" + '" onclick=showUserAlertDialog(event,"' + encodeURIComponentEx(user._id) + '") />';
x += '<input type=button value="' + "Chat" + '" title="' + "Chat" + '" onclick=userChat(event,"' + encodeURIComponentEx(user._id) + '","' + encodeURIComponentEx(user.name) + '") />';
if ((activeSessions > 0) && (serverinfo != null) && (serverinfo.altmessenging != null)) { for (var i in serverinfo.altmessenging) { x += '<input type=button value="' + EscapeHtml(serverinfo.altmessenging[i].name) + '" onclick=altUserChat(event,"' + encodeURIComponentEx(user._id) + '","' + encodeURIComponentEx(user.name) + '",' + i + ') />'; } }
if ((activeSessions > 0) && (serverinfo != null) && (serverinfo.altmessenging != null)) {
for (var i in serverinfo.altmessenging) {
var am = serverinfo.altmessenging[i];
if ((am.type == null) || (am.type == 'user')) {
x += '<input type=button value="' + EscapeHtml(am.name) + '" onclick=altUserChat(event,"' + encodeURIComponentEx(user._id) + '","' + encodeURIComponentEx(user.name) + '",' + i + ') />';
}
}
}
}
// Setup the panel