Added agent notification internalization.

Ylian Saint-Hilaire committed Jun 4, 2021 at 11:15 UTC e39cd672ab63b4ebd6475189672e941bd3faea20
2 files changed +7 -1
agents/meshcore.js
+4
@@ -2941,6 +2941,10 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
2941 sendPeriodicServerUpdate();
2942 break;
2943 }
2944 + case 'agentmsgx': {
2945 + try { mesh.SendCommand({ action: 'sessions', type: 'msg', value: { 0: { msg: "This is an old agent version, consider updating.", msgid: 117, icon: 3 } } }); } catch (ex) { }
2946 + break;
2947 + }
2948 case 'agentmsg': {
2949 if (args['_'].length == 0) {
2950 response = "Proper usage:\r\n agentmsg add \"[message]\" [iconIndex]\r\n agentmsg remove [index]\r\n agentmsg list"; // Display usage
views/default.handlebars
+3 -1
@@ -4309,6 +4309,7 @@
4309 for (var i in node.sessions.msg) {
4310 var msg = i, icon = 5;
4311 if (typeof node.sessions.msg[i].msg == 'string') { msg = node.sessions.msg[i].msg; }
4312 + if ((typeof node.sessions.msg[i].msgid == 'number') && (eventsMessageId[node.sessions.msg[i].msgid] != null)) { msg = eventsMessageId[node.sessions.msg[i].msgid]; }
4313 if (typeof node.sessions.msg[i].icon == 'number') { icon = node.sessions.msg[i].icon; }
4314 if ((icon < 1) || (icon > 9)) { icon = 5; }
4315 x += '<table style=width:96%><td style=width:24px><div class=NotifyIconSmall' + icon + '></div><td><div style="border-radius:5px;background-color:#BBB;width:100%;padding:8px">' + EscapeHtml(msg) + '</div></table>';
@@ -12386,7 +12387,8 @@
12387 113: "Added push notification authentication device",
12388 114: "Removed push notification authentication device",
12389 115: "Added login token",
12389 - 116: "Removed login token"
12390 + 116: "Removed login token",
12391 + 117: "This is an old agent version, consider updating.xx"
12392 };
12393
12394 // Highlights the device being hovered