Make client request base64 encoding

This makes gotty-client still work.
This commit is contained in:
Søren L. Hansen 2022-03-31 10:46:59 -07:00
parent 1eed97f0f8
commit dd3603c341
8 changed files with 42 additions and 37 deletions

29
js/package-lock.json generated
View file

@ -1491,23 +1491,6 @@
"webpack": "^4.0.0 || ^5.0.0"
}
},
"node_modules/style-loader/node_modules/schema-utils": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz",
"integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==",
"dependencies": {
"@types/json-schema": "^7.0.6",
"ajv": "^6.12.5",
"ajv-keywords": "^3.5.2"
},
"engines": {
"node": ">= 10.13.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
}
},
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@ -2970,18 +2953,6 @@
"requires": {
"loader-utils": "^2.0.0",
"schema-utils": "^3.0.0"
},
"dependencies": {
"schema-utils": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz",
"integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==",
"requires": {
"@types/json-schema": "^7.0.6",
"ajv": "^6.12.5",
"ajv-keywords": "^3.5.2"
}
}
}
},
"supports-color": {

View file

@ -149,7 +149,7 @@ export class WebTTY {
let maxChunkSize = Math.floor(effectiveBufferSize / 4)*3;
for (let i = 0; i < Math.ceil(dataString.length / maxChunkSize); i++) {
let inputChunk = dataString.substring(i * effectiveBufferSize, Math.min((i + 1) * effectiveBufferSize, dataString.length))
let inputChunk = dataString.substring(i * maxChunkSize, Math.min((i + 1) * maxChunkSize, dataString.length))
this.connection.send(msgInput + btoa(inputChunk));
}
}
@ -210,6 +210,9 @@ export class WebTTY {
this.term.onResize(resizeHandler);
resizeHandler(termInfo.columns, termInfo.rows);
// Set encoding to base64 (TODO: Fix this up)
connection.send("4base64");
this.term.onInput(
(input: string) => {
this.sendInput(input);