Updated MeshAgents with TLS1.3 and many more fixes.
Ylian Saint-Hilaire committed
Jan 22, 2020 at 16:26 UTC
8275ddd0c997cba111a802a0a39aec51d384da72
24 files changed
+149
-89
agents/MeshCmd-signed.exe
Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ
agents/MeshCmd64-signed.exe
Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ
agents/MeshService-signed.exe
Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ
agents/MeshService.exe
Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ
agents/MeshService64-signed.exe
Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ
agents/MeshService64.exe
Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ
agents/meshagent_arm
Binary files a/agents/meshagent_arm and b/agents/meshagent_arm differ
agents/meshagent_arm64
Binary files a/agents/meshagent_arm64 and b/agents/meshagent_arm64 differ
agents/meshagent_armhf
Binary files a/agents/meshagent_armhf and b/agents/meshagent_armhf differ
agents/meshagent_freebsd_x86-64
Binary files a/agents/meshagent_freebsd_x86-64 and b/agents/meshagent_freebsd_x86-64 differ
agents/meshagent_mips
Binary files a/agents/meshagent_mips and b/agents/meshagent_mips differ
agents/meshagent_osx-x86-64
Binary files a/agents/meshagent_osx-x86-64 and b/agents/meshagent_osx-x86-64 differ
agents/meshagent_pogo
Binary files a/agents/meshagent_pogo and b/agents/meshagent_pogo differ
agents/meshagent_poky
Binary files a/agents/meshagent_poky and b/agents/meshagent_poky differ
agents/meshagent_poky64
Binary files a/agents/meshagent_poky64 and b/agents/meshagent_poky64 differ
agents/meshagent_x86
Binary files a/agents/meshagent_x86 and b/agents/meshagent_x86 differ
agents/meshagent_x86-64
Binary files a/agents/meshagent_x86-64 and b/agents/meshagent_x86-64 differ
agents/meshagent_x86-64_nokvm
Binary files a/agents/meshagent_x86-64_nokvm and b/agents/meshagent_x86-64_nokvm differ
agents/meshagent_x86_nokvm
Binary files a/agents/meshagent_x86_nokvm and b/agents/meshagent_x86_nokvm differ
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.4.7-l",
3
+ "version": "0.4.7-m",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
public/translate.bat
-1
@@ -3,4 +3,3 @@ CD ..\translate
3
C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js minifyall
4
C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js translateall
5
C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js extractall
6
-pause
\ No newline at end of file
translate/translate.js
+145
-83
@@ -33,12 +33,48 @@ var meshCentralSourceFiles = [
33
];
34
35
// Check NodeJS version
36
-if (Number(process.version.match(/^v(\d+\.\d+)/)[1]) < 8) { console.log("Translate.js requires Node v8 or above, current version is " + process.version + "."); return; }
36
+const NodeJSVer = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
37
+if (NodeJSVer < 8) { log("Translate.js requires Node v8 or above, current version is " + process.version + "."); return; }
38
39
// node translate.json CHECK ../meshcentral/views/default.handlebars
40
// node translate.json EXTRACT bob.json ../meshcentral/views/default.handlebars
41
// node translate.js TRANSLATE fr test2.json ../meshcentral/views/default.handlebars
42
43
+var worker = null;
44
+function log() {
45
+ if (worker == null) {
46
+ console.log(...arguments);
47
+ } else {
48
+ worker.parentPort.postMessage({ msg: arguments[0] })
49
+ }
50
+}
51
+
52
+if (NodeJSVer >= 12) {
53
+ const xworker = require('worker_threads');
54
+ try {
55
+ if (xworker.isMainThread == false) {
56
+ // We are being called to do some work
57
+ worker = xworker;
58
+ const op = worker.workerData.op;
59
+ const args = worker.workerData.args;
60
+
61
+ // Get things setup
62
+ jsdom = require('jsdom');
63
+ esprima = require('esprima'); // https://www.npmjs.com/package/esprima
64
+ if (minifyLib == 1) { minify = require('minify-js'); }
65
+ if (minifyLib == 2) { minify = require('html-minifier').minify; } // https://www.npmjs.com/package/html-minifier
66
+
67
+ switch (op) {
68
+ case 'translate': {
69
+ translateSingleThreaded(args[0], args[1], args[2], args[3]);
70
+ break;
71
+ }
72
+ }
73
+ return;
74
+ }
75
+ } catch (ex) { log(ex); }
76
+}
77
+
78
var libs = ['jsdom', 'esprima', 'minify-js'];
79
if (minifyLib == 1) { libs.push('minify-js'); }
80
if (minifyLib == 2) { libs.push('html-minifier'); }
@@ -55,37 +91,37 @@ function start() {
91
if (process.argv.length > 2) { command = process.argv[2].toLowerCase(); }
92
if (['check', 'extract', 'extractall', 'translate', 'translateall', 'minifyall', 'merge', 'totext', 'fromtext'].indexOf(command) == -1) { command = null; }
93
58
- console.log('MeshCentral web site translator');
94
+ log('MeshCentral web site translator');
95
if (command == null) {
60
- console.log('Usage "node translate.js [command] [options]');
61
- console.log('Possible commands:');
62
- console.log('');
63
- console.log(' CHECK [files]');
64
- console.log(' Check will pull string out of a web page and display a report.');
65
- console.log('');
66
- console.log(' EXTRACT [languagefile] [files]');
67
- console.log(' Extract strings from web pages and generate a language (.json) file.');
68
- console.log('');
69
- console.log(' EXTRACTALL');
70
- console.log(' Extract all MeshCentral strings from web pages and generate the languages.json file.');
71
- console.log('');
72
- console.log(' TRANSLATE [language] [languagefile] [files]');
73
- console.log(' Use a language (.json) file to translate web pages to a give language.');
74
- console.log('');
75
- console.log(' TRANSLATEALL (languagefile) (language code)');
76
- console.log(' Translate all MeshCentral strings using the languages.json file.');
77
- console.log('');
78
- console.log(' MINIFYALL');
79
- console.log(' Minify the main MeshCentral english web pages.');
80
- console.log('');
81
- console.log(' MERGE [sourcefile] [targetfile] [language code]');
82
- console.log(' Merge a language from a translation file into another translation file.');
83
- console.log('');
84
- console.log(' TOTEXT [translationfile] [textfile] [language code]');
85
- console.log(' Save a text for with all strings of a given language.');
86
- console.log('');
87
- console.log(' FROMTEXT [translationfile] [textfile] [language code]');
88
- console.log(' Import raw text string as translations for a language code.');
96
+ log('Usage "node translate.js [command] [options]');
97
+ log('Possible commands:');
98
+ log('');
99
+ log(' CHECK [files]');
100
+ log(' Check will pull string out of a web page and display a report.');
101
+ log('');
102
+ log(' EXTRACT [languagefile] [files]');
103
+ log(' Extract strings from web pages and generate a language (.json) file.');
104
+ log('');
105
+ log(' EXTRACTALL');
106
+ log(' Extract all MeshCentral strings from web pages and generate the languages.json file.');
107
+ log('');
108
+ log(' TRANSLATE [language] [languagefile] [files]');
109
+ log(' Use a language (.json) file to translate web pages to a give language.');
110
+ log('');
111
+ log(' TRANSLATEALL (languagefile) (language code)');
112
+ log(' Translate all MeshCentral strings using the languages.json file.');
113
+ log('');
114
+ log(' MINIFYALL');
115
+ log(' Minify the main MeshCentral english web pages.');
116
+ log('');
117
+ log(' MERGE [sourcefile] [targetfile] [language code]');
118
+ log(' Merge a language from a translation file into another translation file.');
119
+ log('');
120
+ log(' TOTEXT [translationfile] [textfile] [language code]');
121
+ log(' Save a text for with all strings of a given language.');
122
+ log('');
123
+ log(' FROMTEXT [translationfile] [textfile] [language code]');
124
+ log(' Import raw text string as translations for a language code.');
125
process.exit();
126
return;
127
}
@@ -93,34 +129,34 @@ function start() {
129
// Extract strings from web pages and display a report
130
if (command == 'check') {
131
var sources = [];
96
- for (var i = 3; i < process.argv.length; i++) { if (fs.existsSync(process.argv[i]) == false) { console.log('Missing file: ' + process.argv[i]); process.exit(); return; } sources.push(process.argv[i]); }
97
- if (sources.length == 0) { console.log('No source files specified.'); process.exit(); return; }
132
+ for (var i = 3; i < process.argv.length; i++) { if (fs.existsSync(process.argv[i]) == false) { log('Missing file: ' + process.argv[i]); process.exit(); return; } sources.push(process.argv[i]); }
133
+ if (sources.length == 0) { log('No source files specified.'); process.exit(); return; }
134
performCheck = true;
135
sourceStrings = {};
136
for (var i = 0; i < sources.length; i++) { extractFromHtml(sources[i]); }
137
var count = 0;
138
for (var i in sourceStrings) { count++; }
103
- console.log('Extracted ' + count + ' strings.');
139
+ log('Extracted ' + count + ' strings.');
140
process.exit();
141
return;
142
}
143
144
// Extract strings from web pages
145
if (command == 'extract') {
110
- if (process.argv.length < 4) { console.log('No language file specified.'); process.exit(); return; }
146
+ if (process.argv.length < 4) { log('No language file specified.'); process.exit(); return; }
147
var sources = [];
112
- for (var i = 4; i < process.argv.length; i++) { if (fs.existsSync(process.argv[i]) == false) { console.log('Missing file: ' + process.argv[i]); process.exit(); return; } sources.push(process.argv[i]); }
113
- if (sources.length == 0) { console.log('No source files specified.'); process.exit(); return; }
148
+ for (var i = 4; i < process.argv.length; i++) { if (fs.existsSync(process.argv[i]) == false) { log('Missing file: ' + process.argv[i]); process.exit(); return; } sources.push(process.argv[i]); }
149
+ if (sources.length == 0) { log('No source files specified.'); process.exit(); return; }
150
extract(process.argv[3], sources);
151
}
152
153
// Save a text file with all the strings for a given language
154
if (command == 'totext') {
155
if ((process.argv.length == 6)) {
120
- if (fs.existsSync(process.argv[3]) == false) { console.log('Unable to find: ' + process.argv[3]); return; }
156
+ if (fs.existsSync(process.argv[3]) == false) { log('Unable to find: ' + process.argv[3]); return; }
157
totext(process.argv[3], process.argv[4], process.argv[5]);
158
} else {
123
- console.log('Usage: TOTEXT [translationfile] [textfile] [language code]');
159
+ log('Usage: TOTEXT [translationfile] [textfile] [language code]');
160
}
161
return;
162
}
@@ -128,11 +164,11 @@ function start() {
164
// Read a text file and use it as translation for a given language
165
if (command == 'fromtext') {
166
if ((process.argv.length == 6)) {
131
- if (fs.existsSync(process.argv[3]) == false) { console.log('Unable to find: ' + process.argv[3]); return; }
132
- if (fs.existsSync(process.argv[4]) == false) { console.log('Unable to find: ' + process.argv[4]); return; }
167
+ if (fs.existsSync(process.argv[3]) == false) { log('Unable to find: ' + process.argv[3]); return; }
168
+ if (fs.existsSync(process.argv[4]) == false) { log('Unable to find: ' + process.argv[4]); return; }
169
fromtext(process.argv[3], process.argv[4], process.argv[5]);
170
} else {
135
- console.log('Usage: FROMTEXT [translationfile] [textfile] [language code]');
171
+ log('Usage: FROMTEXT [translationfile] [textfile] [language code]');
172
}
173
return;
174
}
@@ -140,11 +176,11 @@ function start() {
176
// Merge one language from a language file into another language file.
177
if (command == 'merge') {
178
if ((process.argv.length == 6)) {
143
- if (fs.existsSync(process.argv[3]) == false) { console.log('Unable to find: ' + process.argv[3]); return; }
144
- if (fs.existsSync(process.argv[4]) == false) { console.log('Unable to find: ' + process.argv[4]); return; }
179
+ if (fs.existsSync(process.argv[3]) == false) { log('Unable to find: ' + process.argv[3]); return; }
180
+ if (fs.existsSync(process.argv[4]) == false) { log('Unable to find: ' + process.argv[4]); return; }
181
merge(process.argv[3], process.argv[4], process.argv[5]);
182
} else {
147
- console.log('Usage: MERGE [sourcefile] [tartgetfile] [language code]');
183
+ log('Usage: MERGE [sourcefile] [tartgetfile] [language code]');
184
}
185
return;
186
}
@@ -158,13 +194,13 @@ function start() {
194
if (process.argv.length > 4) { lang = process.argv[4].toLowerCase(); }
195
if (process.argv.length > 3) {
196
if (fs.existsSync(process.argv[3]) == false) {
161
- console.log('Unable to find: ' + process.argv[3]);
197
+ log('Unable to find: ' + process.argv[3]);
198
} else {
199
translate(lang, process.argv[3], meshCentralSourceFiles, 'translations');
200
}
201
} else {
202
if (fs.existsSync('translate.json') == false) {
167
- console.log('Unable to find translate.json.');
203
+ log('Unable to find translate.json.');
204
} else {
205
translate(lang, 'translate.json', meshCentralSourceFiles, 'translations');
206
}
@@ -174,15 +210,15 @@ function start() {
210
211
// Translate web pages to a given language given a language file
212
if (command == 'translate') {
177
- if (process.argv.length < 4) { console.log("No language specified."); process.exit(); return; }
178
- if (process.argv.length < 5) { console.log("No language file specified."); process.exit(); return; }
213
+ if (process.argv.length < 4) { log("No language specified."); process.exit(); return; }
214
+ if (process.argv.length < 5) { log("No language file specified."); process.exit(); return; }
215
var lang = process.argv[3].toLowerCase();
216
var langFile = process.argv[4];
181
- if (fs.existsSync(langFile) == false) { console.log("Missing language file: " + langFile); process.exit(); return; }
217
+ if (fs.existsSync(langFile) == false) { log("Missing language file: " + langFile); process.exit(); return; }
218
219
var sources = [];
184
- for (var i = 5; i < process.argv.length; i++) { if (fs.existsSync(process.argv[i]) == false) { console.log("Missing file: " + process.argv[i]); process.exit(); return; } sources.push(process.argv[i]); }
185
- if (sources.length == 0) { console.log("No source files specified."); process.exit(); return; }
220
+ for (var i = 5; i < process.argv.length; i++) { if (fs.existsSync(process.argv[i]) == false) { log("Missing file: " + process.argv[i]); process.exit(); return; } sources.push(process.argv[i]); }
221
+ if (sources.length == 0) { log("No source files specified."); process.exit(); return; }
222
223
translate(lang, langFile, sources, false);
224
}
@@ -200,7 +236,7 @@ function start() {
236
} else {
237
outnamemin = (outname, outname + '.min');
238
}
203
- console.log('Generating ' + outnamemin + '...');
239
+ log('Generating ' + outnamemin + '...');
240
241
// Minify the file
242
if (minifyLib = 2) {
@@ -231,9 +267,9 @@ function totext(source, target, lang) {
267
// Load the source language file
268
var sourceLangFileData = null;
269
try { sourceLangFileData = JSON.parse(fs.readFileSync(source)); } catch (ex) { }
234
- if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { console.log("Invalid source language file."); process.exit(); return; }
270
+ if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { log("Invalid source language file."); process.exit(); return; }
271
236
- console.log('Writing ' + lang + '...');
272
+ log('Writing ' + lang + '...');
273
274
// Generate raw text
275
var output = [];
@@ -261,14 +297,14 @@ function totext(source, target, lang) {
297
if (splitOutputPtr == 1) {
298
// Save the target back
299
fs.writeFileSync(target + '-' + lang + '.txt', output.join('\r\n'), { flag: 'w+' });
264
- console.log('Done.');
300
+ log('Done.');
301
} else {
302
// Save the text in 1000 string bunches
303
for (var i in splitOutput) {
268
- console.log('Writing ' + target + '-' + lang + '-' + i + '.txt...');
304
+ log('Writing ' + target + '-' + lang + '-' + i + '.txt...');
305
fs.writeFileSync(target + '-' + lang + '-' + i + '.txt', splitOutput[i].join('\r\n'), { flag: 'w+' });
306
}
271
- console.log('Done.');
307
+ log('Done.');
308
}
309
}
310
@@ -276,18 +312,18 @@ function fromtext(source, target, lang) {
312
// Load the source language file
313
var sourceLangFileData = null;
314
try { sourceLangFileData = JSON.parse(fs.readFileSync(source)); } catch (ex) { }
279
- if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { console.log("Invalid source language file."); process.exit(); return; }
315
+ if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { log("Invalid source language file."); process.exit(); return; }
316
281
- console.log('Updating ' + lang + '...');
317
+ log('Updating ' + lang + '...');
318
319
// Read raw text
320
var rawText = fs.readFileSync(target).toString('utf8');
321
var rawTextArray = rawText.split('\r\n');
322
var rawTextPtr = 0;
323
288
- console.log('Translation file: ' + sourceLangFileData.strings.length + ' string(s)');
289
- console.log('Text file: ' + rawTextArray.length + ' string(s)');
290
- if (sourceLangFileData.strings.length != rawTextArray.length) { console.log('String count mismatch, unable to import.'); process.exit(1); return; }
324
+ log('Translation file: ' + sourceLangFileData.strings.length + ' string(s)');
325
+ log('Text file: ' + rawTextArray.length + ' string(s)');
326
+ if (sourceLangFileData.strings.length != rawTextArray.length) { log('String count mismatch, unable to import.'); process.exit(1); return; }
327
328
var output = [];
329
var splitOutput = [];
@@ -298,21 +334,21 @@ function fromtext(source, target, lang) {
334
}
335
336
fs.writeFileSync(source + '-new', translationsToJson(sourceLangFileData), { flag: 'w+' });
301
- console.log('Done.');
337
+ log('Done.');
338
}
339
340
function merge(source, target, lang) {
341
// Load the source language file
342
var sourceLangFileData = null;
343
try { sourceLangFileData = JSON.parse(fs.readFileSync(source)); } catch (ex) { }
308
- if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { console.log("Invalid source language file."); process.exit(); return; }
344
+ if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { log("Invalid source language file."); process.exit(); return; }
345
346
// Load the target language file
347
var targetLangFileData = null;
348
try { targetLangFileData = JSON.parse(fs.readFileSync(target)); } catch (ex) { }
313
- if ((targetLangFileData == null) || (targetLangFileData.strings == null)) { console.log("Invalid target language file."); process.exit(); return; }
349
+ if ((targetLangFileData == null) || (targetLangFileData.strings == null)) { log("Invalid target language file."); process.exit(); return; }
350
315
- console.log('Merging ' + lang + '...');
351
+ log('Merging ' + lang + '...');
352
353
// Index the target file
354
var index = {};
@@ -333,14 +369,40 @@ function merge(source, target, lang) {
369
370
// Save the target back
371
fs.writeFileSync(target, translationsToJson(targetData), { flag: 'w+' });
336
- console.log('Done.');
372
+ log('Done.');
373
}
374
375
function translate(lang, langFile, sources, createSubDir) {
376
+ if ((NodeJSVer >= 12) && (lang == null)) {
377
+ // Multi threaded translation
378
+ log("Multi-threaded translation.");
379
+
380
+ // Load the language file
381
+ var langFileData = null;
382
+ try { langFileData = JSON.parse(fs.readFileSync(langFile)); } catch (ex) { }
383
+ if ((langFileData == null) || (langFileData.strings == null)) { log("Invalid language file."); process.exit(); return; }
384
+
385
+ langs = {};
386
+ for (var i in langFileData.strings) { var entry = langFileData.strings[i]; for (var j in entry) { if ((j != 'en') && (j != 'xloc') && (j != '*')) { langs[j.toLowerCase()] = true; } } }
387
+ for (var i in langs) {
388
+ const { Worker } = require('worker_threads')
389
+ const worker = new Worker('./translate.js', { stdout: true, workerData: { op: 'translate', args: [i, langFile, sources, createSubDir] } });
390
+ worker.stdout.on('data', function (msg) { console.log('wstdio:', msg.toString()); });
391
+ worker.on('message', function (message) { console.log(message.msg); });
392
+ worker.on('error', function (error) { console.log('error', error); });
393
+ worker.on('exit', function (code) { /*console.log('exit', code);*/ })
394
+ }
395
+ } else {
396
+ // Single threaded translation
397
+ translateSingleThreaded(lang, langFile, sources, createSubDir);
398
+ }
399
+}
400
+
401
+function translateSingleThreaded(lang, langFile, sources, createSubDir) {
402
// Load the language file
403
var langFileData = null;
404
try { langFileData = JSON.parse(fs.readFileSync(langFile)); } catch (ex) { }
343
- if ((langFileData == null) || (langFileData.strings == null)) { console.log("Invalid language file."); process.exit(); return; }
405
+ if ((langFileData == null) || (langFileData.strings == null)) { log("Invalid language file."); process.exit(); return; }
406
407
if (lang != null) {
408
// Translate a single language
@@ -373,7 +435,7 @@ function extract(langFile, sources) {
435
if (fs.existsSync(langFile) == true) {
436
var langFileData = null;
437
try { langFileData = JSON.parse(fs.readFileSync(langFile)); } catch (ex) { }
376
- if ((langFileData == null) || (langFileData.strings == null)) { console.log("Invalid language file."); process.exit(); return; }
438
+ if ((langFileData == null) || (langFileData.strings == null)) { log("Invalid language file."); process.exit(); return; }
439
for (var i in langFileData.strings) {
440
sourceStrings[langFileData.strings[i]['en']] = langFileData.strings[i];
441
delete sourceStrings[langFileData.strings[i]['en']].xloc;
@@ -388,7 +450,7 @@ function extract(langFile, sources) {
450
output.push(sourceStrings[i]); // Save all results
451
}
452
fs.writeFileSync(langFile, translationsToJson({ strings: output }), { flag: 'w+' });
391
- console.log(format("{0} strings in output file.", count));
453
+ log(format("{0} strings in output file.", count));
454
process.exit();
455
return;
456
}
@@ -397,7 +459,7 @@ function extractFromHtml(file) {
459
var data = fs.readFileSync(file);
460
var { JSDOM } = jsdom;
461
const dom = new JSDOM(data, { includeNodeLocations: true });
400
- console.log("Processing HTML: " + path.basename(file));
462
+ log("Processing HTML: " + path.basename(file));
463
getStrings(path.basename(file), dom.window.document.querySelector('body'));
464
}
465
@@ -441,7 +503,7 @@ function getStrings(name, node) {
503
var nodeValue = subnode.nodeValue.trim().split('\\r').join('').split('\\n').join('').trim();
504
if ((nodeValue.length > 0) && (subnode.nodeType == 3)) {
505
if ((node.tagName != 'SCRIPT') && (node.tagName != 'STYLE') && (nodeValue.length < 8000) && (nodeValue.startsWith('{{{') == false) && (nodeValue != ' ')) {
444
- if (performCheck) { console.log(' "' + nodeValue + '"'); }
506
+ if (performCheck) { log(' "' + nodeValue + '"'); }
507
// Add a new string to the list
508
if (sourceStrings[nodeValue] == null) { sourceStrings[nodeValue] = { en: nodeValue, xloc: [name] }; } else { if (sourceStrings[nodeValue].xloc == null) { sourceStrings[nodeValue].xloc = []; } sourceStrings[nodeValue].xloc.push(name); }
509
} else if (node.tagName == 'SCRIPT') {
@@ -454,14 +516,14 @@ function getStrings(name, node) {
516
}
517
518
function getStringFromJavaScript(name, script) {
457
- if (performCheck) { console.log(format('Processing JavaScript of {0} bytes: {1}', script.length, name)); }
519
+ if (performCheck) { log(format('Processing JavaScript of {0} bytes: {1}', script.length, name)); }
520
var tokenScript = esprima.tokenize(script), count = 0;
521
for (var i in tokenScript) {
522
var token = tokenScript[i];
523
if ((token.type == 'String') && (token.value.length > 2) && (token.value[0] == '"')) {
524
var str = token.value.substring(1, token.value.length - 1);
463
- //if (performCheck) { console.log(' ' + name + '->' + (++count), token.value); }
464
- if (performCheck) { console.log(' ' + token.value); }
525
+ //if (performCheck) { log(' ' + name + '->' + (++count), token.value); }
526
+ if (performCheck) { log(' ' + token.value); }
527
if (sourceStrings[str] == null) { sourceStrings[str] = { en: str, xloc: [name + '->' + (++count)] }; } else { if (sourceStrings[str].xloc == null) { sourceStrings[str].xloc = []; } sourceStrings[str].xloc.push(name + '->' + (++count)); }
528
}
529
}
@@ -475,7 +537,7 @@ function translateFromHtml(lang, file, createSubDir) {
537
var data = fs.readFileSync(file);
538
var { JSDOM } = jsdom;
539
const dom = new JSDOM(data, { includeNodeLocations: true });
478
- console.log("Translating HTML (" + lang + "): " + path.basename(file));
540
+ log("Translating HTML (" + lang + "): " + path.basename(file));
541
translateStrings(path.basename(file), dom.window.document.querySelector('body'));
542
var out = dom.serialize();
543
@@ -503,8 +565,8 @@ function translateFromHtml(lang, file, createSubDir) {
565
file: outname,
566
dist: outnamemin
567
}, (e, compress) => {
506
- if (e) { console.log('ERROR ', e); return done(); }
507
- compress.run((e) => { e ? console.log('Minification fail', e) : console.log('Minification sucess'); minifyDone(); });
568
+ if (e) { log('ERROR ', e); return done(); }
569
+ compress.run((e) => { e ? log('Minification fail', e) : log('Minification sucess'); minifyDone(); });
570
}
571
);
572
}
@@ -531,7 +593,7 @@ function translateFromHtml(lang, file, createSubDir) {
593
}
594
}
595
534
-function minifyDone() { console.log('Completed minification.'); }
596
+function minifyDone() { log('Completed minification.'); }
597
598
function translateStrings(name, node) {
599
for (var i = 0; i < node.childNodes.length; i++) {
@@ -591,7 +653,7 @@ function translateStrings(name, node) {
653
}
654
655
function translateStringsFromJavaScript(name, script) {
594
- if (performCheck) { console.log(format('Translating JavaScript of {0} bytes: {1}', script.length, name)); }
656
+ if (performCheck) { log(format('Translating JavaScript of {0} bytes: {1}', script.length, name)); }
657
var tokenScript = esprima.tokenize(script, { range: true }), count = 0;
658
var output = [], ptr = 0;
659
for (var i in tokenScript) {
@@ -634,7 +696,7 @@ function InstallModules(modules, func) {
696
697
// Check if a module is present and install it if missing
698
function InstallModule(modulename, func, tag1, tag2) {
637
- console.log('Installing ' + modulename + '...');
699
+ log('Installing ' + modulename + '...');
700
var child_process = require('child_process');
701
var parentpath = __dirname;
702
@@ -645,7 +707,7 @@ function InstallModule(modulename, func, tag1, tag2) {
707
InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 120000, cwd: parentpath }, function (error, stdout, stderr) {
708
InstallModuleChildProcess = null;
709
if ((error != null) && (error != '')) {
648
- console.log('ERROR: Unable to install required module "' + modulename + '". May not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n');
710
+ log('ERROR: Unable to install required module "' + modulename + '". May not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n');
711
process.exit();
712
return;
713
}
translate/translate.json
+1
-1
@@ -19264,4 +19264,4 @@
19264
]
19265
}
19266
]
19267
-}
19267
+}
\ No newline at end of file
views/default.handlebars
+2
-3
@@ -5261,9 +5261,8 @@
5261
// Request MQTT login credentials
5262
function p10showMqttLoginDialog(nodeid) { meshserver.send({ action: 'getmqttlogin', nodeid: nodeid }); }
5263
5264
- function p10deviceLinkToClipboard() {
5265
- copyTextToClip2(document.URL.split('?')[0].split('#')[0] + '?node=' + currentNode._id.split('/')[2] + '&viewmode=10');
5266
- }
5264
+ // Place a device link URL in the clipboard
5265
+ function p10deviceLinkToClipboard() { copyTextToClip2(document.URL.split('?')[0].split('#')[0] + '?node=' + currentNode._id.split('/')[2] + '&viewmode=10'); }
5266
5267
// Show MeshCmd dialog
5268
function p10showMeshCmdDialog(mode, nodeid) {