[FEATURE] Several QOL Updates (#18)

Co-authored-by: Dunemask <dunemask@gmail.com>
Reviewed-on: https://gitea.dunemask.dev/elysium/minecluster/pulls/18
This commit is contained in:
dunemask 2024-02-11 03:57:01 +00:00
parent 4959d6c1fe
commit 0a0f9c8463
16 changed files with 432 additions and 828 deletions

View file

@ -26,9 +26,13 @@ export async function webConsoleLogs(socket) {
const log = new k8s.Log(kc);
const logStream = new stream.PassThrough();
logStream.on("data", (chunk) =>
socket.emit("push", Buffer.from(chunk).toString()),
);
var logstreamBuffer = "";
logStream.on("data", (chunk) => {
const bufferString = Buffer.from(chunk).toString();
if (!bufferString.includes("\n")) return (logstreamBuffer += bufferString);
const clientChunks = `${logstreamBuffer}${bufferString}`.split("\n");
for (var c of clientChunks) socket.emit("push", c);
});
log
.log(namespace, mcsPods[0], containerName, logStream, {
follow: true,