1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed meshctrl.js shell when ping/pong are active.

This commit is contained in:
Ylian Saint-Hilaire 2021-04-26 19:01:40 -07:00
parent 3a92c077b9
commit 3b637ad389
2 changed files with 8 additions and 2 deletions

View file

@ -1968,6 +1968,12 @@ function connectTunnel(url) {
settings.tunnelws.on('message', function (rawdata) {
var data = rawdata.toString();
if (settings.tunnelwsstate == 1) {
// If the incoming text looks exactly like a control command, ignore it.
if ((typeof data == 'string') && (data.startsWith('{"ctrlChannel":"102938","type":"'))) {
var ctrlCmd = null;
try { ctrlCmd = JSON.parse(data); } catch (ex) { }
if ((ctrlCmd != null) && (ctrlCmd.ctrlChannel == '102938') && (ctrlCmd.type != null)) return; // This is a control command, like ping/pong. Ignore it.
}
process.stdout.write(data);
} else if (settings.tunnelwsstate == 0) {
if (data == 'c') { console.log('Connected.'); } else if (data == 'cr') { console.log('Connected, session is being recorded.'); } else return;