Added PreconfiguredRemoteInput #3264
Ylian Saint-Hilaire committed
Nov 8, 2021 at 11:45 UTC
eece5412f49d46bfb9aafbbab89ce9b0d917ed5b
4 files changed
+52
-2
meshcentral-config-schema.json
+19
@@ -307,6 +307,25 @@
307
"guestDeviceSharing": { "type": "boolean", "default": true, "description": "When set to false, the desktop/terminal sharing link feature is not available." },
308
"autoRemoveInactiveDevices": { "type": "integer", "default": 0, "minimum": 0, "maximum": 2000, "description": "Number of days a device can be inactive before it's removed. 0 disables this feature. Device group setting will override this value." },
309
"DeviceSearchBarServerAndClientName": { "type": "boolean", "default": false, "description": "When set to true, the devices search box will match on both the server name and client name of a device." },
310
+ "PreconfiguredRemoteInput": {
311
+ "type": "array",
312
+ "default": null,
313
+ "description": "When set, you can right click on the input button in the desktop tab and instantly remotely type one of these pre-configured strings.",
314
+ "items": {
315
+ "type": "object",
316
+ "required": [ "name", "value" ],
317
+ "properties": {
318
+ "name": {
319
+ "description": "Name of the text string.",
320
+ "type": "string"
321
+ },
322
+ "protocol": {
323
+ "description": "Text string that will be remotely typed when selected.",
324
+ "type": "string"
325
+ }
326
+ }
327
+ }
328
+ },
329
"altMessenging": {
330
"type": "object",
331
"properties": {
meshuser.js
+1
@@ -548,6 +548,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
548
if (typeof domain.terminal == 'object') { // Settings used for remote terminal feature
549
if ((typeof domain.terminal.linuxshell == 'string') && (domain.terminal.linuxshell != 'any')) { serverinfo.linuxshell = domain.terminal.linuxshell; }
550
}
551
+ if (Array.isArray(domain.preconfiguredremoteinput)) { serverinfo.preConfiguredRemoteInput = domain.preconfiguredremoteinput; }
552
553
// Send server information
554
try { ws.send(JSON.stringify({ action: 'serverinfo', serverinfo: serverinfo })); } catch (ex) { }
sample-config-advanced.json
+15
@@ -141,6 +141,7 @@
141
"minify": true,
142
"_guestDeviceSharing" : false,
143
"_AutoRemoveInactiveDevices": 37,
144
+ "_DeviceSearchBarServerAndClientName": false,
145
"_loginKey": [ "abc", "123" ],
146
"_newAccounts": true,
147
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
@@ -180,6 +181,20 @@
181
}
182
]
183
},
184
+ "PreconfiguredRemoteInput": [
185
+ {
186
+ "name": "CompagnyUrl",
187
+ "value": "https://help.mycompany.com/"
188
+ },
189
+ {
190
+ "name": "Any Text",
191
+ "value": "Any text\r"
192
+ },
193
+ {
194
+ "name": "Welcome",
195
+ "value": "Default welcome text"
196
+ }
197
+ ],
198
"myServer": {
199
"Backup": false,
200
"Restore": false,
views/default.handlebars
+17
-2
@@ -111,6 +111,8 @@
111
<div id="deskKeyShortcutContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
112
<div class="cmtext" onclick="cmdeskshortcutaction(1,event)">Customize...</div>
113
</div>
114
+ <div id="deskPreConfigShortcutContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
115
+ </div>
116
117
<!--
118
<div id="pluginTabContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
@@ -2258,6 +2260,12 @@
2260
addNotification({ text: format("Certificate expires in {0} day(s)", days) });
2261
}
2262
}
2263
+ if (serverinfo.preConfiguredRemoteInput) {
2264
+ var x = '';
2265
+ for (var i in serverinfo.preConfiguredRemoteInput) { x += '<div class="cmtext" onclick="cmdeskpreconfigtypeaction(' + i + ',event)">' + EscapeHtml(serverinfo.preConfiguredRemoteInput[i].name) + '</div>'; }
2266
+ QH('deskPreConfigShortcutContextMenu', x);
2267
+ Q('DeskType').setAttribute('cmenu', 'deskPreConfigShortcutContextMenu');
2268
+ }
2269
break;
2270
}
2271
case 'userinfo': {
@@ -5880,6 +5888,11 @@
5888
deskCustomizeKeys();
5889
}
5890
5891
+ function cmdeskpreconfigtypeaction(action) {
5892
+ if (xxdialogMode) return;
5893
+ showDeskTypeEx(serverinfo.preConfiguredRemoteInput[action].value); // Type a pre-configured input string
5894
+ }
5895
+
5896
function p13deletefileCm(b, file) {
5897
files.sendText({ action: 'rm', reqid: 1, path: p13filetreelocation.join('/'), delfiles: [ file.n ], rec: false });
5898
p13folderup(999);
@@ -5911,6 +5924,7 @@
5924
QV('filesContextMenu', false);
5925
QV('deskPlayerContextMenu', false);
5926
QV('deskKeyShortcutContextMenu', false);
5927
+ QV('deskPreConfigShortcutContextMenu', false);
5928
QV('expandAllContextMenu', false);
5929
//QV('pluginTabContextMenu', false);
5930
contextelement = null;
@@ -8779,8 +8793,9 @@
8793
var AmtDeskTypeContent = null;
8794
var DeskTypeTranslate = { 39: 222, 42: 106, 43: 107, 44: 188, 45: 189, 46: 190, 47: 191, 59: 186, 61: 187, 91: 219, 92: 220, 93: 221, 96: 192, 191: 111 };
8795
var DeskTypeShiftTranslate = { 33: 49, 34: 222, 35: 51, 36: 52, 37: 53, 38: 55, 40: 57, 41: 48, 58: 186, 60: 188, 62: 190, 63: 191, 64: 50, 94: 54, 95: 189, 106: 56, 107: 187, 123: 219, 124: 220, 125: 221, 126: 192 };
8782
- function showDeskTypeEx() {
8783
- var txt = Q('d2typeText').value, ltxt = Q('d2typeText').value.toUpperCase(), x = [], shift = false;
8796
+ function showDeskTypeEx(text) {
8797
+ var txt, ltxt, x = [], shift = false;
8798
+ if (typeof text == 'string') { txt = text, ltxt = text.toUpperCase() } else { txt = Q('d2typeText').value, ltxt = Q('d2typeText').value.toUpperCase(); }
8799
if (desktop.contype == 2) {
8800
// Intel AMT
8801
for (var i in txt) { var a = txt.charCodeAt(i); x.push([a, 1], [a, 0]); }