move to gitea
All checks were successful
App Image CI / Build app image (push) Successful in -2m7s
Docker Image CI / Build build images (arch) (push) Successful in -15s
Docker Image CI / Build build images (artix) (push) Successful in -48s

This commit is contained in:
2025-04-29 21:04:32 -05:00
parent 9722c4f992
commit b13d34cbdb
7 changed files with 53 additions and 82 deletions

View File

@@ -13,12 +13,14 @@ document.addEventListener('DOMContentLoaded', function () {
/**
* Add log line to the DOM
* @param {string} str
* @param {string[]} str
*/
function appendLine(str, e = false) {
const p = document.createElement('p');
p.appendChild(document.createTextNode(str));
logContainer.appendChild(p);
function appendLines(str, e = false) {
str.forEach(line => {
const p = document.createElement('p');
p.appendChild(document.createTextNode(line));
logContainer.appendChild(p);
});
}
/**
@@ -30,6 +32,14 @@ document.addEventListener('DOMContentLoaded', function () {
}
}
/**
* Split string by newline char
* @param {string} str
*/
function splitLines(str) {
return str.split('\n').map(line => line.substring(line.lastIndexOf('\r') + 1));
}
/**
* Establish websocket connection
*/
@@ -41,15 +51,14 @@ document.addEventListener('DOMContentLoaded', function () {
var ws = new WebSocket(new_uri);
ws.onmessage = function (message) {
console.log('Got message: ', message);
const buildEvent = JSON.parse(message.data);
if (buildEvent.type === 'finish') {
ws.close();
buildStatusTxt.replaceChild(document.createTextNode(buildEvent.message), buildStatusTxt.firstChild);
}
else {
appendLine(buildEvent.message, buildEvent.type === 'err');
appendLines(splitLines(buildEvent.message), buildEvent.type === 'err');
scrollToBottom();
}
}