mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-26 23:25:53 -05:00
Added notification settings feature
This commit is contained in:
parent
89bfce1dc6
commit
fd53a3d9c7
@ -34,7 +34,7 @@ stop() {
|
|||||||
pid=$( cat "$PIDFILE" )
|
pid=$( cat "$PIDFILE" )
|
||||||
if kill -0 $pid 2>/dev/null; then
|
if kill -0 $pid 2>/dev/null; then
|
||||||
echo 'Stopping service…' >&2
|
echo 'Stopping service…' >&2
|
||||||
kill -16 $pid
|
kill -15 $pid
|
||||||
echo 'Service stopped' >&2
|
echo 'Service stopped' >&2
|
||||||
else
|
else
|
||||||
echo 'Service not running'
|
echo 'Service not running'
|
||||||
|
@ -110,7 +110,7 @@ function AmtManager(agent, db, isdebug) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sent to the entire group, no sessionid or userid specified.
|
// Sent to the entire group, no sessionid or userid specified.
|
||||||
if (notify != null) { agent.SendCommand({ "action": "msg", "type": "notify", "value": notify, "tag": "general" }); }
|
if (notify != null) { agent.SendCommand({ "action": "msg", "type": "notify", "value": notify, "tag": "general", "amtMessage": amtMessage }); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Launch LMS
|
// Launch LMS
|
||||||
|
@ -310,6 +310,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
|||||||
// Send user information to web socket, this is the first thing we send
|
// Send user information to web socket, this is the first thing we send
|
||||||
try { ws.send(JSON.stringify({ action: 'userinfo', userinfo: parent.CloneSafeUser(parent.users[user._id]) })); } catch (ex) { }
|
try { ws.send(JSON.stringify({ action: 'userinfo', userinfo: parent.CloneSafeUser(parent.users[user._id]) })); } catch (ex) { }
|
||||||
|
|
||||||
|
// Send user web state
|
||||||
|
db.Get('ws' + user._id, function (err, docs) {
|
||||||
|
if (docs.length == 1) { try { ws.send(JSON.stringify({ action: 'event', event: { action: 'userWebState', state: docs[0].state, nolog: 1 } })); } catch (ex) { } }
|
||||||
|
});
|
||||||
|
|
||||||
// We are all set, start receiving data
|
// We are all set, start receiving data
|
||||||
ws._socket.resume();
|
ws._socket.resume();
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.3.8-d",
|
"version": "0.3.8-e",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -260,6 +260,7 @@
|
|||||||
<p class="mL">
|
<p class="mL">
|
||||||
<span id="verifyEmailId" style="display:none"><a href=# onclick="return account_showVerifyEmail()">Verify email</a><br /></span>
|
<span id="verifyEmailId" style="display:none"><a href=# onclick="return account_showVerifyEmail()">Verify email</a><br /></span>
|
||||||
<span id="accountEnableNotificationsSpan" style="display:none"><a href=# onclick="return account_enableNotifications()">Enable web notifications</a><br /></span>
|
<span id="accountEnableNotificationsSpan" style="display:none"><a href=# onclick="return account_enableNotifications()">Enable web notifications</a><br /></span>
|
||||||
|
<a href=# onclick="return account_showAccountNotifySettings()">Notification Settings</a><br />
|
||||||
<span id="accountChangeEmailAddressSpan" style="display:none"><a href=# onclick="return account_showChangeEmail()">Change email address</a><br /></span>
|
<span id="accountChangeEmailAddressSpan" style="display:none"><a href=# onclick="return account_showChangeEmail()">Change email address</a><br /></span>
|
||||||
<a href=# onclick="return account_showChangePassword()">Change password</a><span id="p2nextPasswordUpdateTime"></span><br />
|
<a href=# onclick="return account_showChangePassword()">Change password</a><span id="p2nextPasswordUpdateTime"></span><br />
|
||||||
<a href=# onclick="return account_showDeleteAccount()">Delete account</a><br />
|
<a href=# onclick="return account_showDeleteAccount()">Delete account</a><br />
|
||||||
@ -1432,6 +1433,8 @@
|
|||||||
// Node was found, dispatch the message
|
// Node was found, dispatch the message
|
||||||
if (message.type == 'console') { p15consoleReceive(nodes[index], message.value); } // This is a console message.
|
if (message.type == 'console') { p15consoleReceive(nodes[index], message.value); } // This is a console message.
|
||||||
else if (message.type == 'notify') { // This is a notification message.
|
else if (message.type == 'notify') { // This is a notification message.
|
||||||
|
var n = getstore('notifications', 0);
|
||||||
|
if (((n & 8) == 0) && (message.amtMessage != null)) { break; } // Intel AMT desktop & terminal messages should be ignored.
|
||||||
var n = { text: message.value, title: message.title, icon: message.icon };
|
var n = { text: message.value, title: message.title, icon: message.icon };
|
||||||
if (message.nodeid != null) { n.nodeid = message.nodeid; }
|
if (message.nodeid != null) { n.nodeid = message.nodeid; }
|
||||||
if (message.tag != null) { n.tag = message.tag; }
|
if (message.tag != null) { n.tag = message.tag; }
|
||||||
@ -1942,6 +1945,19 @@
|
|||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
var node = nodes[index];
|
var node = nodes[index];
|
||||||
|
|
||||||
|
// Event the connection change if needed
|
||||||
|
var n = getstore('notifications', 0);
|
||||||
|
if (n & 2) {
|
||||||
|
if (((node.conn & 1) == 0) && ((message.event.conn & 1) != 0)) { addNotification({ text: 'Agent connected', title: node.name, icon: node.icon, nodeid: node._id }); }
|
||||||
|
if (((node.conn & 2) == 0) && ((message.event.conn & 2) != 0)) { addNotification({ text: 'Intel AMT detected', title: node.name, icon: node.icon, nodeid: node._id }); }
|
||||||
|
if (((node.conn & 4) == 0) && ((message.event.conn & 4) != 0)) { addNotification({ text: 'Intel AMT CIRA connected', title: node.name, icon: node.icon, nodeid: node._id }); }
|
||||||
|
}
|
||||||
|
if (n & 4) {
|
||||||
|
if (((node.conn & 1) != 0) && ((message.event.conn & 1) == 0)) { addNotification({ text: 'Agent disconnected', title: node.name, icon: node.icon, nodeid: node._id }); }
|
||||||
|
if (((node.conn & 2) != 0) && ((message.event.conn & 2) == 0)) { addNotification({ text: 'Intel AMT not detected', title: node.name, icon: node.icon, nodeid: node._id }); }
|
||||||
|
if (((node.conn & 4) != 0) && ((message.event.conn & 4) == 0)) { addNotification({ text: 'Intel AMT CIRA disconnected', title: node.name, icon: node.icon, nodeid: node._id }); }
|
||||||
|
}
|
||||||
|
|
||||||
// Change the node connection state
|
// Change the node connection state
|
||||||
node.conn = message.event.conn;
|
node.conn = message.event.conn;
|
||||||
node.pwr = message.event.pwr;
|
node.pwr = message.event.pwr;
|
||||||
@ -6052,6 +6068,31 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function account_showAccountNotifySettings() {
|
||||||
|
if (xxdialogMode) return false;
|
||||||
|
var x = '';
|
||||||
|
x += '<div><input id=p2notifyPlayNotifySound type=checkbox />Notification sound.</div>';
|
||||||
|
x += '<div><input id=p2notifyIntelDeviceConnect type=checkbox />Device connections.</div>';
|
||||||
|
x += '<div><input id=p2notifyIntelDeviceDisconnect type=checkbox />Device disconnections.</div>';
|
||||||
|
x += '<div><input id=p2notifyIntelAmtKvmActions type=checkbox />Intel® AMT desktop and serial events.</div>';
|
||||||
|
setDialogMode(2, "Notification Settings", 3, account_showAccountNotifySettingsEx, x);
|
||||||
|
var n = getstore('notifications', 0);
|
||||||
|
Q('p2notifyPlayNotifySound').checked = (n & 1);
|
||||||
|
Q('p2notifyIntelDeviceConnect').checked = (n & 2);
|
||||||
|
Q('p2notifyIntelDeviceDisconnect').checked = (n & 4);
|
||||||
|
Q('p2notifyIntelAmtKvmActions').checked = (n & 8);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function account_showAccountNotifySettingsEx() {
|
||||||
|
var n = 0;
|
||||||
|
n += Q('p2notifyPlayNotifySound').checked ? 1 : 0;
|
||||||
|
n += Q('p2notifyIntelDeviceConnect').checked ? 2 : 0;
|
||||||
|
n += Q('p2notifyIntelDeviceDisconnect').checked ? 4 : 0;
|
||||||
|
n += Q('p2notifyIntelAmtKvmActions').checked ? 8 : 0;
|
||||||
|
putstore('notifications', n);
|
||||||
|
}
|
||||||
|
|
||||||
function account_showVerifyEmail() {
|
function account_showVerifyEmail() {
|
||||||
if (xxdialogMode || (userinfo.emailVerified == true) || (serverinfo.emailcheck != true)) return false;
|
if (xxdialogMode || (userinfo.emailVerified == true) || (serverinfo.emailcheck != true)) return false;
|
||||||
var x = "Click ok to send a verification mail to:<br /><div style=padding:8px><b>" + EscapeHtml(userinfo.email) + "</b></div>Please wait a few minute to receive the verification.";
|
var x = "Click ok to send a verification mail to:<br /><div style=padding:8px><b>" + EscapeHtml(userinfo.email) + "</b></div>Please wait a few minute to receive the verification.";
|
||||||
@ -7879,7 +7920,8 @@
|
|||||||
notifications.unshift(n);
|
notifications.unshift(n);
|
||||||
setNotificationCount(notifications.length);
|
setNotificationCount(notifications.length);
|
||||||
clickNotificationIcon(true);
|
clickNotificationIcon(true);
|
||||||
Q('chimes').play();
|
var notifySettings = getstore('notifications', 0);
|
||||||
|
if (notifySettings & 1) { Q('chimes').play(); }
|
||||||
|
|
||||||
// If web notifications are granted, use it.
|
// If web notifications are granted, use it.
|
||||||
var notification = null;
|
var notification = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user