From e32cceb1b439d305106b252cbdac279884ad244e Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Wed, 20 Sep 2023 19:40:58 +0100 Subject: [PATCH] fix writeUtf8 for ssh player Signed-off-by: Simon Smith --- views/player.handlebars | 6 +++--- views/xterm.handlebars | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/views/player.handlebars b/views/player.handlebars index a773ab65..46020fce 100644 --- a/views/player.handlebars +++ b/views/player.handlebars @@ -1108,10 +1108,10 @@ function writeXTerm(data) { if (term == null) return; - if (typeof data == 'string') { - term.writeUtf8(data); + if (term.writeUtf8) { + if (typeof data == 'string') { term.writeUtf8(data); } else { term.writeUtf8(new Uint8Array(data)); } } else { - term.writeUtf8(new Uint8Array(data)); + if (typeof data == 'string') { term.write(data); } else { term.write(new Uint8Array(data)); } } } diff --git a/views/xterm.handlebars b/views/xterm.handlebars index 21e41028..380b115e 100644 --- a/views/xterm.handlebars +++ b/views/xterm.handlebars @@ -181,10 +181,10 @@ } function tunnelUpdate(data) { - if (typeof data == 'string') { - term.writeUtf8(data); + if (term.writeUtf8) { + if (typeof data == 'string') { term.writeUtf8(data); } else { term.writeUtf8(new Uint8Array(data)); } } else { - term.writeUtf8(new Uint8Array(data)); + if (typeof data == 'string') { term.write(data); } else { term.write(new Uint8Array(data)); } } }