Added command and reset/off rights to mobile web page.
Ylian Saint-Hilaire committed
Oct 5, 2020 at 11:25 UTC
adc513f08a093184658bc3092dcf549ab386111d
5 files changed
+48
-29
agents/meshcore.js
+1
@@ -2486,6 +2486,7 @@ function createMeshCore(agent) {
2486
2487
// Open a web browser to a specified URL on current user's desktop
2488
function openUserDesktopUrl(url) {
2489
+ if ((url.toLowerCase().startsWith('http://') == false) || (url.toLowerCase().startsWith('https://') == false)) { return null; }
2490
var child = null;
2491
try {
2492
switch (process.platform) {
meshuser.js
+1
-1
@@ -2631,7 +2631,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2631
var url = "http" + (args.notls ? '' : 's') + "://" + parent.getWebServerName(domain) + ":" + httpsPort + "/" + xdomain + "messenger?id=meshmessenger/" + encodeURIComponent(command.nodeid) + "/" + encodeURIComponent(user._id) + "&title=" + encodeURIComponent(user.name);
2632
2633
// Create the notification message
2634
- routeCommandToNode({ "action": "openUrl", "nodeid": command.nodeid, "userid": user._id, "username": user.name, "url": url });
2634
+ routeCommandToNode({ 'action': 'openUrl', 'nodeid': command.nodeid, 'userid': user._id, 'username': user.name, 'url': url });
2635
});
2636
break;
2637
}
translate/translate.json
+31
-27
@@ -495,7 +495,7 @@
495
"zh-chs": ",",
496
"zh-cht": ",",
497
"xloc": [
498
- "default-mobile.handlebars->9->451",
498
+ "default-mobile.handlebars->9->455",
499
"default.handlebars->27->1494"
500
]
501
},
@@ -847,7 +847,7 @@
847
"zh-cht": "1個位元組",
848
"xloc": [
849
"default-mobile.handlebars->9->118",
850
- "default-mobile.handlebars->9->455",
850
+ "default-mobile.handlebars->9->459",
851
"default.handlebars->27->1559",
852
"download.handlebars->3->1",
853
"download2.handlebars->5->1"
@@ -3455,7 +3455,7 @@
3455
"zh-chs": "将用户添加到设备组",
3456
"zh-cht": "將用戶新增到裝置群",
3457
"xloc": [
3458
- "default-mobile.handlebars->9->429"
3458
+ "default-mobile.handlebars->9->431"
3459
]
3460
},
3461
{
@@ -4070,7 +4070,7 @@
4070
"zh-chs": "代理控制台",
4071
"zh-cht": "代理控制台",
4072
"xloc": [
4073
- "default-mobile.handlebars->9->435",
4073
+ "default-mobile.handlebars->9->437",
4074
"default.handlebars->27->1475"
4075
]
4076
},
@@ -7009,7 +7009,7 @@
7009
"zh-cht": "聊天並通知",
7010
"xloc": [
7011
"default-mobile.handlebars->9->427",
7012
- "default-mobile.handlebars->9->445",
7012
+ "default-mobile.handlebars->9->447",
7013
"default.handlebars->27->1450",
7014
"default.handlebars->27->1486"
7015
]
@@ -7889,6 +7889,7 @@
7889
{
7890
"en": "Commands",
7891
"xloc": [
7892
+ "default-mobile.handlebars->9->449",
7893
"default.handlebars->27->1488",
7894
"default.handlebars->27->690",
7895
"default.handlebars->27->711"
@@ -8517,7 +8518,7 @@
8518
"zh-chs": "确认删除用户{0}?",
8519
"zh-cht": "確認刪除用戶{0}?",
8520
"xloc": [
8520
- "default-mobile.handlebars->9->454"
8521
+ "default-mobile.handlebars->9->458"
8522
]
8523
},
8524
{
@@ -11074,7 +11075,7 @@
11075
"zh-chs": "设备组用户",
11076
"zh-cht": "裝置群用戶",
11077
"xloc": [
11077
- "default-mobile.handlebars->9->452",
11078
+ "default-mobile.handlebars->9->456",
11079
"default.handlebars->27->1495"
11080
]
11081
},
@@ -13178,7 +13179,7 @@
13179
"xloc": [
13180
"default-mobile.handlebars->9->411",
13181
"default-mobile.handlebars->9->413",
13181
- "default-mobile.handlebars->9->431",
13182
+ "default-mobile.handlebars->9->433",
13183
"default.handlebars->27->1403",
13184
"default.handlebars->27->1435",
13185
"default.handlebars->27->1459",
@@ -13388,7 +13389,7 @@
13389
"zh-chs": "编辑笔记",
13390
"zh-cht": "編輯筆記",
13391
"xloc": [
13391
- "default-mobile.handlebars->9->438",
13392
+ "default-mobile.handlebars->9->440",
13393
"default.handlebars->27->1478"
13394
]
13395
},
@@ -15815,7 +15816,7 @@
15816
"default-mobile.handlebars->9->105",
15817
"default-mobile.handlebars->9->403",
15818
"default-mobile.handlebars->9->412",
15818
- "default-mobile.handlebars->9->430",
15819
+ "default-mobile.handlebars->9->432",
15820
"default.handlebars->27->1287",
15821
"default.handlebars->27->1434",
15822
"default.handlebars->27->1791"
@@ -20460,7 +20461,7 @@
20461
"zh-chs": "有限输入",
20462
"zh-cht": "有限輸入",
20463
"xloc": [
20463
- "default-mobile.handlebars->9->443",
20464
+ "default-mobile.handlebars->9->445",
20465
"default.handlebars->27->1484",
20466
"default.handlebars->27->680",
20467
"default.handlebars->27->701"
@@ -21966,7 +21967,7 @@
21967
"zh-cht": "管理裝置群電腦",
21968
"xloc": [
21969
"default-mobile.handlebars->9->415",
21969
- "default-mobile.handlebars->9->433",
21970
+ "default-mobile.handlebars->9->435",
21971
"default.handlebars->27->1437",
21972
"default.handlebars->27->1473"
21973
]
@@ -21989,7 +21990,7 @@
21990
"zh-cht": "管理裝置群用戶",
21991
"xloc": [
21992
"default-mobile.handlebars->9->414",
21992
- "default-mobile.handlebars->9->432",
21993
+ "default-mobile.handlebars->9->434",
21994
"default.handlebars->27->1436",
21995
"default.handlebars->27->1472"
21996
]
@@ -24304,7 +24305,7 @@
24305
"zh-chs": "没有档案",
24306
"zh-cht": "沒有檔案",
24307
"xloc": [
24307
- "default-mobile.handlebars->9->441",
24308
+ "default-mobile.handlebars->9->443",
24309
"default.handlebars->27->1482",
24310
"default.handlebars->27->678",
24311
"default.handlebars->27->699"
@@ -24349,7 +24350,7 @@
24350
"zh-cht": "沒有Intel® AMT",
24351
"xloc": [
24352
"default-mobile.handlebars->9->421",
24352
- "default-mobile.handlebars->9->442",
24353
+ "default-mobile.handlebars->9->444",
24354
"default.handlebars->27->1444",
24355
"default.handlebars->27->1483"
24356
]
@@ -24495,7 +24496,7 @@
24496
"xloc": [
24497
"default-mobile.handlebars->9->106",
24498
"default-mobile.handlebars->9->404",
24498
- "default-mobile.handlebars->9->447",
24499
+ "default-mobile.handlebars->9->451",
24500
"default.handlebars->27->1288",
24501
"default.handlebars->27->1490",
24502
"default.handlebars->27->692",
@@ -24541,7 +24542,7 @@
24542
"zh-chs": "没有终端",
24543
"zh-cht": "沒有終端",
24544
"xloc": [
24544
- "default-mobile.handlebars->9->440",
24545
+ "default-mobile.handlebars->9->442",
24546
"default.handlebars->27->1481",
24547
"default.handlebars->27->677",
24548
"default.handlebars->27->698"
@@ -26929,7 +26930,7 @@
26930
"zh-chs": "权限",
26931
"zh-cht": "權限",
26932
"xloc": [
26932
- "default-mobile.handlebars->9->450",
26933
+ "default-mobile.handlebars->9->454",
26934
"default.handlebars->27->1493",
26935
"default.handlebars->27->1703"
26936
]
@@ -28683,6 +28684,7 @@
28684
{
28685
"en": "Remote Commands",
28686
"xloc": [
28687
+ "default-mobile.handlebars->9->429",
28688
"default.handlebars->27->1452"
28689
]
28690
},
@@ -28704,7 +28706,7 @@
28706
"zh-cht": "遙控",
28707
"xloc": [
28708
"default-mobile.handlebars->9->416",
28707
- "default-mobile.handlebars->9->434",
28709
+ "default-mobile.handlebars->9->436",
28710
"default.handlebars->27->1438",
28711
"default.handlebars->27->1474"
28712
]
@@ -28896,7 +28898,7 @@
28898
"zh-chs": "远程网格用户",
28899
"zh-cht": "遠程網格用戶",
28900
"xloc": [
28899
- "default-mobile.handlebars->9->453"
28901
+ "default-mobile.handlebars->9->457"
28902
]
28903
},
28904
{
@@ -28934,7 +28936,7 @@
28936
"zh-cht": "僅遠程查看",
28937
"xloc": [
28938
"default-mobile.handlebars->9->417",
28937
- "default-mobile.handlebars->9->439",
28939
+ "default-mobile.handlebars->9->441",
28940
"default.handlebars->27->1439",
28941
"default.handlebars->27->1479"
28942
]
@@ -29823,6 +29825,7 @@
29825
{
29826
"en": "Reset / Power Off",
29827
"xloc": [
29828
+ "default-mobile.handlebars->9->430",
29829
"default.handlebars->27->1453"
29830
]
29831
},
@@ -29935,6 +29938,7 @@
29938
{
29939
"en": "Reset/Off",
29940
"xloc": [
29941
+ "default-mobile.handlebars->9->450",
29942
"default.handlebars->27->1489",
29943
"default.handlebars->27->691",
29944
"default.handlebars->27->712"
@@ -31278,7 +31282,7 @@
31282
"zh-chs": "仅自我事件",
31283
"zh-cht": "僅自我事件",
31284
"xloc": [
31281
- "default-mobile.handlebars->9->444",
31285
+ "default-mobile.handlebars->9->446",
31286
"default.handlebars->27->1485"
31287
]
31288
},
@@ -31767,7 +31771,7 @@
31771
"zh-cht": "伺服器檔案",
31772
"xloc": [
31773
"default-mobile.handlebars->9->423",
31770
- "default-mobile.handlebars->9->436",
31774
+ "default-mobile.handlebars->9->438",
31775
"default.handlebars->27->1446",
31776
"default.handlebars->27->1476",
31777
"default.handlebars->27->1789",
@@ -36898,7 +36902,7 @@
36902
"zh-chs": "卸载",
36903
"zh-cht": "卸載",
36904
"xloc": [
36901
- "default-mobile.handlebars->9->446",
36905
+ "default-mobile.handlebars->9->448",
36906
"default.handlebars->27->1487",
36907
"default.handlebars->27->689",
36908
"default.handlebars->27->710"
@@ -37814,7 +37818,7 @@
37818
"zh-chs": "用户识别码",
37819
"zh-cht": "用戶識別碼",
37820
"xloc": [
37817
- "default-mobile.handlebars->9->449"
37821
+ "default-mobile.handlebars->9->453"
37822
]
37823
},
37824
{
@@ -37897,7 +37901,7 @@
37901
"zh-chs": "用户名",
37902
"zh-cht": "用戶名",
37903
"xloc": [
37900
- "default-mobile.handlebars->9->448",
37904
+ "default-mobile.handlebars->9->452",
37905
"default.handlebars->27->1491"
37906
]
37907
},
@@ -38867,7 +38871,7 @@
38871
"zh-cht": "喚醒裝置",
38872
"xloc": [
38873
"default-mobile.handlebars->9->424",
38870
- "default-mobile.handlebars->9->437",
38874
+ "default-mobile.handlebars->9->439",
38875
"default.handlebars->27->1447",
38876
"default.handlebars->27->1477"
38877
]
views/default-mobile.handlebars
+8
@@ -4162,6 +4162,8 @@
4162
x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20limitevents>' + "Show Only Own Events" + '</label><br>';
4163
x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20chatnotify>' + "Chat & Notify" + '</label><br>';
4164
x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20uninstall>' + "Uninstall Agent" + '</label><br>';
4165
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20commands>' + "Remote Commands" + '</label><br>';
4166
+ x += '<label><input type=checkbox onchange=p20validateAddMeshUserDialog() id=p20resetoff>' + "Reset / Power Off" + '</label><br>';
4167
x += '</div>';
4168
setDialogMode(2, "Add User to Device Group", 3, p20showAddMeshUserDialogEx, x);
4169
p20validateAddMeshUserDialog();
@@ -4188,6 +4190,8 @@
4190
QE('p20noamt', nc && Q('p20remotecontrol').checked);
4191
QE('p20chatnotify', nc);
4192
QE('p20uninstall', nc);
4193
+ QE('p20commands', nc);
4194
+ QE('p20resetoff', nc);
4195
}
4196
4197
function p20showAddMeshUserDialogEx() {
@@ -4209,6 +4213,8 @@
4213
if (Q('p20limitevents').checked == true) meshadmin += 8192;
4214
if (Q('p20chatnotify').checked == true) meshadmin += 16384;
4215
if (Q('p20uninstall').checked == true) meshadmin += 32768;
4216
+ if (Q('p20commands').checked == true) meshadmin += 131072;
4217
+ if (Q('p20resetoff').checked == true) meshadmin += 262144;
4218
}
4219
var users = Q('dp20username').value.split(','), users2 = [];
4220
for (var i in users) { users2.push(users[i].trim()); }
@@ -4236,6 +4242,8 @@
4242
if ((meshrights & 8192) != 0) r.push("Self Events Only");
4243
if ((meshrights & 16384) != 0) r.push("Chat & Notify");
4244
if ((meshrights & 32768) != 0) r.push("Uninstall");
4245
+ if ((meshrights & 131072) != 0) r.push("Commands");
4246
+ if ((meshrights & 262144) != 0) r.push("Reset/Off");
4247
}
4248
if (r.length == 0) { r.push("No Rights"); }
4249
var buttons = 1, uname = userid.split('/')[2];
views/default.handlebars
+7
-1
@@ -6039,8 +6039,14 @@
6039
6040
function deviceUrlFunction() {
6041
if (xxdialogMode) return;
6042
- setDialogMode(2, "Open Page on Device", 3, deviceUrlFunctionEx, '<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll></input>');
6042
+ setDialogMode(2, "Open Page on Device", 3, deviceUrlFunctionEx, '<input id=d2devurl placeholder="http://server.com" style=width:100%;overflow-y:scroll onkeyup=deviceUrlFunctionValidate() onchange=deviceUrlFunctionValidate()></input>');
6043
Q('d2devurl').focus();
6044
+ deviceUrlFunctionValidate();
6045
+ }
6046
+
6047
+ function deviceUrlFunctionValidate() {
6048
+ var x = Q('d2devurl').value.toLowerCase();
6049
+ QE('idx_dlgOkButton', ((x.startsWith('http://') && (x.length > 7)) || (x.startsWith('https://') && (x.length > 8))));
6050
}
6051
6052
function deviceUrlFunctionEx() {