1
0

Do not push transient steps
All checks were successful
Build and test project / build-and-test (push) Successful in 1m30s

This commit is contained in:
2026-03-19 21:03:20 +01:00
parent cc1ac91253
commit f97e0be4c3
4 changed files with 33 additions and 27 deletions

View File

@@ -4,6 +4,11 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
KOBOPATCH_DIR="$SCRIPT_DIR/kobopatch-src"
if ! command -v go &>/dev/null; then
echo "Go not found, downloading..."
curl -fsSL https://go.dev/dl/go1.23.12.linux-amd64.tar.gz | tar -xz -C /usr/local
fi
if [ -d "$KOBOPATCH_DIR" ]; then
echo "Updating kobopatch source..."
cd "$KOBOPATCH_DIR"

View File

@@ -3,9 +3,6 @@ providers = ["node"]
[phases.setup]
nixPkgs = ["git", "curl", "zip", "gnutar", "nginx"]
paths = ["/usr/local/go/bin"]
cmds = [
"curl -sSfL https://go.dev/dl/go1.23.12.linux-amd64.tar.gz | tar -xz -C /usr/local",
]
[phases.build]
cmds = [

View File

@@ -3,6 +3,14 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "=== Installing web dependencies ==="
cd "$SCRIPT_DIR/web" && npm install
echo ""
echo "=== Building web app ==="
cd "$SCRIPT_DIR/web" && node build.mjs
echo ""
echo "=== Building WASM ==="
"$SCRIPT_DIR/kobopatch-wasm/build.sh"

View File

@@ -138,13 +138,17 @@ import JSZip from 'jszip';
const stepHistory = [stepConnect];
function pushStep(step) {
stepHistory.push(step);
}
function popStep() {
stepHistory.pop();
return stepHistory[stepHistory.length - 1];
function showStep(step, push = true) {
for (const s of allSteps) {
s.hidden = (s !== step);
}
if (!push) return;
const idx = stepHistory.indexOf(step);
if (idx >= 0) {
stepHistory.length = idx + 1;
} else {
stepHistory.push(step);
}
}
function setNavLabels(labels) {
@@ -158,15 +162,6 @@ import JSZip from 'jszip';
}
}
function showStep(step, updateHistory = true) {
for (const s of allSteps) {
s.hidden = (s !== step);
}
if (updateHistory) {
stepHistory[stepHistory.length - 1] = step;
}
}
function setNavStep(num) {
const items = $qa('li', stepNav);
items.forEach((li, i) => {
@@ -704,12 +699,11 @@ import JSZip from 'jszip';
}
populateSelectedPatchesList();
setNavStep(4);
showStep(stepFirmware);
showStep(stepFirmware, false);
}
btnBuildBack.addEventListener('click', () => {
if (isRestore) {
// Restore was triggered directly from the device step
isRestore = false;
setNavLabels(NAV_DEFAULT);
setNavStep(1);
@@ -836,7 +830,7 @@ import JSZip from 'jszip';
}
btnBuild.addEventListener('click', async () => {
showStep(stepBuilding);
showStep(stepBuilding, false);
buildLog.textContent = '';
buildProgress.textContent = 'Starting...';
$('build-wait-hint').textContent = isRestore
@@ -909,7 +903,7 @@ import JSZip from 'jszip';
errorLog.hidden = true;
}
const hasBackStep = stepHistory[stepHistory.length - 1] === stepPatches;
const hasBackStep = stepHistory.includes(stepPatches);
if (hasBackStep) {
errorTitle.textContent = 'The patch failed to apply';
errorHint.hidden = false;
@@ -922,16 +916,18 @@ import JSZip from 'jszip';
btnRetry.classList.remove('danger');
}
hideNav();
pushStep(stepError);
showStep(stepError, false);
showStep(stepError);
}
btnErrorBack.addEventListener('click', () => {
btnErrorBack.hidden = true;
btnRetry.classList.remove('danger');
const prev = popStep();
stepHistory.pop();
while (stepHistory.length > 0 && stepHistory[stepHistory.length - 1] !== stepPatches) {
stepHistory.pop();
}
showNav();
showStep(prev);
showStep(stepPatches);
});
btnRetry.addEventListener('click', () => {