mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 21:55:52 -05:00
Fixed translation tools output format.
This commit is contained in:
parent
f350350fc6
commit
85d4972068
@ -1131,67 +1131,48 @@ function createMeshCore(agent) {
|
||||
};
|
||||
|
||||
// Remote terminal using native pipes
|
||||
if (process.platform == 'win32')
|
||||
{
|
||||
try
|
||||
{
|
||||
if (process.platform == 'win32') {
|
||||
try {
|
||||
if (!require('win-terminal').PowerShellCapable() && (this.httprequest.protocol == 6 || this.httprequest.protocol == 9)) { throw ('PowerShell is not supported on this version of windows'); }
|
||||
if ((this.httprequest.protocol == 1) || (this.httprequest.protocol == 6))
|
||||
{
|
||||
if ((this.httprequest.protocol == 1) || (this.httprequest.protocol == 6)) {
|
||||
// Admin Terminal
|
||||
if (require('win-virtual-terminal').supported)
|
||||
{
|
||||
if (require('win-virtual-terminal').supported) {
|
||||
// ConPTY PseudoTerminal
|
||||
// this.httprequest._term = require('win-virtual-terminal')[this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'](80, 25);
|
||||
|
||||
// The above line is commented out, because there is a bug with ClosePseudoConsole() API, so this is the workaround
|
||||
this.httprequest._dispatcher = require('win-dispatcher').dispatch({ modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (this.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [80, 25] } });
|
||||
this.httprequest._dispatcher.ws = this;
|
||||
this.httprequest._dispatcher.on('connection', function (c)
|
||||
{
|
||||
console.log('client connected');
|
||||
this.ws._term = c;
|
||||
c.pipe(this.ws, { dataTypeSkip: 1 });
|
||||
this.ws.pipe(c, { dataTypeSkip: 1 });
|
||||
});
|
||||
this.httprequest._term = require('win-virtual-terminal')[this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'](80, 25);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Legacy Terminal
|
||||
this.httprequest._term = require('win-terminal')[this.httprequest.protocol == 6 ? 'StartPowerShell' : 'Start'](80, 25);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Logged in user
|
||||
var userPromise = require('user-sessions').enumerateUsers();
|
||||
userPromise.that = this;
|
||||
userPromise.then(function (u)
|
||||
{
|
||||
userPromise.then(function (u) {
|
||||
var that = this.that;
|
||||
if (u.Active.length > 0)
|
||||
{
|
||||
if (u.Active.length > 0) {
|
||||
var username = u.Active[0].Username;
|
||||
if (require('win-virtual-terminal').supported)
|
||||
{
|
||||
if (require('win-virtual-terminal').supported) {
|
||||
// ConPTY PseudoTerminal
|
||||
that.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [80, 25] } });
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Legacy Terminal
|
||||
that.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-terminal', script: getJSModule('win-terminal') }], launch: { module: 'win-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [80, 25] } });
|
||||
}
|
||||
that.httprequest._dispatcher.ws = that;
|
||||
that.httprequest._dispatcher.on('connection', function (c)
|
||||
{
|
||||
that.httprequest._dispatcher.on('connection', function (c) {
|
||||
console.log('client connected');
|
||||
this.ws._term = c;
|
||||
c.pipe(this.ws, { dataTypeSkip: 1 });
|
||||
this.ws.pipe(c, { dataTypeSkip: 1 });
|
||||
this.ws.pipe(c, { dataTypeSkip: 1, end: false });
|
||||
this.ws.prependListener('end', function () {
|
||||
if (this.httprequest._term) { this.httprequest._term.end(function () { console.log("Terminal was closed"); }); }
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
MeshServerLog('Failed to start remote terminal session, ' + e.toString() + ' (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
@ -1199,17 +1180,14 @@ function createMeshCore(agent) {
|
||||
this.end();
|
||||
return;
|
||||
}
|
||||
if (!this.httprequest._dispatcher)
|
||||
{
|
||||
if (!this.httprequest._dispatcher) {
|
||||
this.httprequest._term.pipe(this, { dataTypeSkip: 1 });
|
||||
this.pipe(this.httprequest._term, { dataTypeSkip: 1, end: false });
|
||||
this.prependListener('end', function () { this.httprequest._term.end(function () { console.log("Terminal was closed"); }); });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
else {
|
||||
try {
|
||||
var bash = fs.existsSync('/bin/bash') ? '/bin/bash' : false;
|
||||
var sh = fs.existsSync('/bin/sh') ? '/bin/sh' : false;
|
||||
var script = fs.existsSync('/usr/bin/script') ? '/usr/bin/script' : false;
|
||||
|
@ -253,6 +253,7 @@ module.exports.translationsToJson = function(t) {
|
||||
for (var j in el) { names.push(j); }
|
||||
names.sort();
|
||||
for (var j in names) { el2[names[j]] = el[names[j]]; }
|
||||
if (el2.xloc != null) { el2.xloc.sort(); }
|
||||
arr2.push(el2);
|
||||
}
|
||||
arr2.sort(function (a, b) { if (a.en > b.en) return 1; if (a.en < b.en) return -1; return 0; });
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.4.6-z",
|
||||
"version": "0.4.7-a",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
@ -2,4 +2,5 @@
|
||||
CD ..\translate
|
||||
C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js minifyall
|
||||
C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js translateall
|
||||
C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js extractall
|
||||
C:\Users\Default.DESKTOP-M9I88C9\AppData\Roaming\nvm\v12.13.0\node translate.js extractall
|
||||
pause
|
@ -392,6 +392,7 @@
|
||||
for (var j in el) { names.push(j); }
|
||||
names.sort();
|
||||
for (var j in names) { el2[names[j]] = el[names[j]]; }
|
||||
if (el2.xloc != null) { el2.xloc.sort(); }
|
||||
arr2.push(el2);
|
||||
}
|
||||
arr2.sort(function (a, b) { if (a.en > b.en) return 1; if (a.en < b.en) return -1; return 0; });
|
||||
@ -443,7 +444,7 @@
|
||||
}
|
||||
|
||||
function translateServer() {
|
||||
var x = 'Perform server translation? The MeshCentral server will reset for 10 to 30 seconds to perform this operation.';
|
||||
var x = "Perform server translation? The MeshCentral server will reset for 10 to 30 seconds to perform this operation.";
|
||||
setDialogMode(2, "Translate Server", 3, translateServerEx, x);
|
||||
}
|
||||
|
||||
@ -458,14 +459,14 @@
|
||||
xdr.onload = function () {
|
||||
var x = null;
|
||||
try { x = JSON.parse(this.responseText); } catch (ex) { }
|
||||
if ((x == null) || (x.response == null)) { messagebox('Server Translation', 'ERROR: Unable to parse server response.'); return; }
|
||||
if ((x == null) || (x.response == null)) { messagebox("Server Translation", "ERROR: Unable to parse server response."); return; }
|
||||
if (x.response == 'ok') {
|
||||
messagebox('Server Translation', 'Server translation initiated, this will take a minute or two. Once done, you can refresh the MeshCentral web pages to see the changes.<br /><br />When ready, please mail the file "meshcentral-data/translate.json" to <a href="mailto:ylianst@gmail.com">ylianst@gmail.com</a> for inclusion on the official build.');
|
||||
messagebox("Server Translation", "Server translation initiated, this will take a minute or two. Once done, you can refresh the MeshCentral web pages to see the changes.<br /><br />When ready, please mail the file \"meshcentral-data/translate.json\" to <a href=\"mailto:ylianst@gmail.com\">ylianst@gmail.com</a> for inclusion on the official build.");
|
||||
} else {
|
||||
messagebox('Server Translation', 'ERROR: ' + x.response);
|
||||
messagebox("Server Translation", "ERROR: " + x.response);
|
||||
}
|
||||
};
|
||||
xdr.onerror = function () { messagebox('Translations', 'ERROR: Unable to save translations to server.'); };
|
||||
xdr.onerror = function () { messagebox("Translations", "ERROR: Unable to save translations to server."); };
|
||||
xdr.send(JSON.stringify({ 'action': 'translateServer', strings: translations }));
|
||||
}
|
||||
|
||||
|
@ -664,6 +664,7 @@ function translationsToJson(t) {
|
||||
for (var j in el) { names.push(j); }
|
||||
names.sort();
|
||||
for (var j in names) { el2[names[j]] = el[names[j]]; }
|
||||
if (el2.xloc != null) { el2.xloc.sort(); }
|
||||
arr2.push(el2);
|
||||
}
|
||||
arr2.sort(function (a, b) { if (a.en > b.en) return 1; if (a.en < b.en) return -1; return 0; });
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user