fix writeUtf8 for ssh player

Signed-off-by: Simon Smith <simonsmith5521@gmail.com>

Simon Smith committed Sep 20, 2023 at 19:40 UTC e32cceb1b439d305106b252cbdac279884ad244e
2 files changed +6 -6
views/player.handlebars
+3 -3
@@ -1108,10 +1108,10 @@
1108
1109 function writeXTerm(data) {
1110 if (term == null) return;
1111 - if (typeof data == 'string') {
1112 - term.writeUtf8(data);
1111 + if (term.writeUtf8) {
1112 + if (typeof data == 'string') { term.writeUtf8(data); } else { term.writeUtf8(new Uint8Array(data)); }
1113 } else {
1114 - term.writeUtf8(new Uint8Array(data));
1114 + if (typeof data == 'string') { term.write(data); } else { term.write(new Uint8Array(data)); }
1115 }
1116 }
1117
views/xterm.handlebars
+3 -3
@@ -181,10 +181,10 @@
181 }
182
183 function tunnelUpdate(data) {
184 - if (typeof data == 'string') {
185 - term.writeUtf8(data);
184 + if (term.writeUtf8) {
185 + if (typeof data == 'string') { term.writeUtf8(data); } else { term.writeUtf8(new Uint8Array(data)); }
186 } else {
187 - term.writeUtf8(new Uint8Array(data));
187 + if (typeof data == 'string') { term.write(data); } else { term.write(new Uint8Array(data)); }
188 }
189 }
190