diff --git a/.gitignore b/.gitignore index e399df9..9f8fe27 100644 --- a/.gitignore +++ b/.gitignore @@ -12,11 +12,11 @@ kobopatch-wasm/kobopatch.wasm kobopatch-wasm/wasm_exec.js # Test artifacts in webroot -src/public/_test_firmware.zip +web/public/_test_firmware.zip # WASM artifacts copied to webroot for serving -src/public/kobopatch.wasm -src/public/wasm_exec.js +web/public/kobopatch.wasm +web/public/wasm_exec.js # E2E tests e2e/node_modules/ diff --git a/README.md b/README.md index ca4840a..3eda3d2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # KoboPatch Web UI > [!IMPORTANT] -> **This is an experiment**, mostly created with the help of Claude and some very precise instructions. Until I can validate that this project consistently outputs identically patched files to the local binaries and I am confident the patcher works as expected, this message will remain. +> **This is an experiment**, mostly created with the help of Claude and some very precise instructions. A web application that provides a GUI for applying custom [kobopatch](https://github.com/pgaskin/kobopatch) patches to Kobo e-readers. It uses the File System Access API (Chromium) to interface with connected Kobo devices, or falls back to manual model/firmware selection on other browsers. @@ -21,7 +21,7 @@ Fully client-side — no backend needed, can be hosted as a static site. Patches ## File structure ``` -src/public/ # Webroot — serve this directory +web/public/ # Webroot — serve this directory index.html # Single-page app, 3-step wizard (Device → Patches → Build) style.css app.js # Step navigation, flow orchestration, firmware download with progress @@ -44,13 +44,13 @@ kobopatch-wasm/ # WASM build # Returns { tgz: Uint8Array, log: string } go.mod setup.sh # Clones kobopatch source, copies wasm_exec.js - build.sh # GOOS=js GOARCH=wasm go build, copies .wasm to src/public/, + build.sh # GOOS=js GOARCH=wasm go build, copies .wasm to web/public/, # sets ?ts= cache-bust timestamp in patch-worker.js ``` ## Adding a new firmware version -1. Add the patch zip to `src/public/patches/` and update `index.json` +1. Add the patch zip to `web/public/patches/` and update `index.json` 2. Add firmware download URLs to `FIRMWARE_DOWNLOADS` in `kobo-device.js` (keyed by version then serial prefix) 3. The kobo CDN prefix per device family (e.g. `kobo12`, `kobo13`) is stable; the date path segment changes per release @@ -61,13 +61,13 @@ Requires Go 1.21+. ```bash cd kobopatch-wasm ./setup.sh # first time only -./build.sh # compiles WASM, copies to src/public/ +./build.sh # compiles WASM, copies to web/public/ ``` ## Running locally ```bash -python3 -m http.server -d src/public/ 8888 +python3 -m http.server -d web/public/ 8888 ``` ## Testing diff --git a/e2e/playwright.config.js b/e2e/playwright.config.js index 1cf9c0d..248d664 100644 --- a/e2e/playwright.config.js +++ b/e2e/playwright.config.js @@ -12,7 +12,7 @@ module.exports = defineConfig({ }, }, webServer: { - command: 'python3 -m http.server -d ../src/public 8889', + command: 'python3 -m http.server -d ../web/public 8889', port: 8889, reuseExistingServer: true, }, diff --git a/e2e/run-e2e-local.sh b/e2e/run-e2e-local.sh index 0e03205..9a9cada 100755 --- a/e2e/run-e2e-local.sh +++ b/e2e/run-e2e-local.sh @@ -11,7 +11,7 @@ FIRMWARE_URL="https://ereaderfiles.kobo.com/firmwares/kobo13/Mar2026/kobo-update FIRMWARE_DIR="../kobopatch-wasm/testdata" FIRMWARE_FILE="${FIRMWARE_DIR}/kobo-update-${FIRMWARE_VERSION}.zip" -if [ ! -f "../src/public/kobopatch.wasm" ]; then +if [ ! -f "../web/public/kobopatch.wasm" ]; then echo "ERROR: kobopatch.wasm not found. Run kobopatch-wasm/build.sh first." exit 1 fi diff --git a/e2e/run-e2e.sh b/e2e/run-e2e.sh index b49904c..739e31c 100755 --- a/e2e/run-e2e.sh +++ b/e2e/run-e2e.sh @@ -18,7 +18,7 @@ FIRMWARE_DIR="../kobopatch-wasm/testdata" FIRMWARE_FILE="${FIRMWARE_DIR}/kobo-update-${FIRMWARE_VERSION}.zip" # Check WASM is built. -if [ ! -f "../src/public/kobopatch.wasm" ]; then +if [ ! -f "../web/public/kobopatch.wasm" ]; then echo "ERROR: kobopatch.wasm not found. Run kobopatch-wasm/build.sh first." exit 1 fi diff --git a/kobopatch-wasm/build.sh b/kobopatch-wasm/build.sh index 770ac0c..23494d5 100755 --- a/kobopatch-wasm/build.sh +++ b/kobopatch-wasm/build.sh @@ -8,7 +8,7 @@ if [ ! -d "$SCRIPT_DIR/kobopatch-src" ]; then exit 1 fi -PUBLIC_DIR="$SCRIPT_DIR/../src/public" +PUBLIC_DIR="$SCRIPT_DIR/../web/public" echo "Building kobopatch WASM..." cd "$SCRIPT_DIR" diff --git a/kobopatch-wasm/integration_test.go b/kobopatch-wasm/integration_test.go index 9494b50..7465886 100644 --- a/kobopatch-wasm/integration_test.go +++ b/kobopatch-wasm/integration_test.go @@ -33,7 +33,7 @@ func TestIntegrationPatch(t *testing.T) { } // Read patch files from the patches zip. - patchesZipPath := "../src/public/patches/patches_4.4523646.zip" + patchesZipPath := "../web/public/patches/patches_4.4523646.zip" patchesZip, err := os.ReadFile(patchesZipPath) if err != nil { t.Fatalf("could not read patches zip: %v", err) diff --git a/src/public/app.js b/web/public/app.js similarity index 100% rename from src/public/app.js rename to web/public/app.js diff --git a/src/public/index.html b/web/public/index.html similarity index 100% rename from src/public/index.html rename to web/public/index.html diff --git a/src/public/kobo-device.js b/web/public/kobo-device.js similarity index 100% rename from src/public/kobo-device.js rename to web/public/kobo-device.js diff --git a/src/public/kobopatch.js b/web/public/kobopatch.js similarity index 100% rename from src/public/kobopatch.js rename to web/public/kobopatch.js diff --git a/src/public/patch-ui.js b/web/public/patch-ui.js similarity index 100% rename from src/public/patch-ui.js rename to web/public/patch-ui.js diff --git a/src/public/patch-worker.js b/web/public/patch-worker.js similarity index 100% rename from src/public/patch-worker.js rename to web/public/patch-worker.js diff --git a/src/public/patches/index.json b/web/public/patches/index.json similarity index 100% rename from src/public/patches/index.json rename to web/public/patches/index.json diff --git a/src/public/patches/patches_4.4523646.zip b/web/public/patches/patches_4.4523646.zip similarity index 100% rename from src/public/patches/patches_4.4523646.zip rename to web/public/patches/patches_4.4523646.zip diff --git a/src/public/style.css b/web/public/style.css similarity index 100% rename from src/public/style.css rename to web/public/style.css