1
0

Migrate src/public to web/public
All checks were successful
Build & Test WASM / build-and-test (push) Successful in 1m44s

This commit is contained in:
2026-03-16 12:38:12 +01:00
parent d5347a7093
commit 82c7e1b3b7
16 changed files with 14 additions and 14 deletions

6
.gitignore vendored
View File

@@ -12,11 +12,11 @@ kobopatch-wasm/kobopatch.wasm
kobopatch-wasm/wasm_exec.js kobopatch-wasm/wasm_exec.js
# Test artifacts in webroot # Test artifacts in webroot
src/public/_test_firmware.zip web/public/_test_firmware.zip
# WASM artifacts copied to webroot for serving # WASM artifacts copied to webroot for serving
src/public/kobopatch.wasm web/public/kobopatch.wasm
src/public/wasm_exec.js web/public/wasm_exec.js
# E2E tests # E2E tests
e2e/node_modules/ e2e/node_modules/

View File

@@ -1,7 +1,7 @@
# KoboPatch Web UI # KoboPatch Web UI
> [!IMPORTANT] > [!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. 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 ## 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) index.html # Single-page app, 3-step wizard (Device → Patches → Build)
style.css style.css
app.js # Step navigation, flow orchestration, firmware download with progress app.js # Step navigation, flow orchestration, firmware download with progress
@@ -44,13 +44,13 @@ kobopatch-wasm/ # WASM build
# Returns { tgz: Uint8Array, log: string } # Returns { tgz: Uint8Array, log: string }
go.mod go.mod
setup.sh # Clones kobopatch source, copies wasm_exec.js 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 # sets ?ts= cache-bust timestamp in patch-worker.js
``` ```
## Adding a new firmware version ## 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) 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 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 ```bash
cd kobopatch-wasm cd kobopatch-wasm
./setup.sh # first time only ./setup.sh # first time only
./build.sh # compiles WASM, copies to src/public/ ./build.sh # compiles WASM, copies to web/public/
``` ```
## Running locally ## Running locally
```bash ```bash
python3 -m http.server -d src/public/ 8888 python3 -m http.server -d web/public/ 8888
``` ```
## Testing ## Testing

View File

@@ -12,7 +12,7 @@ module.exports = defineConfig({
}, },
}, },
webServer: { webServer: {
command: 'python3 -m http.server -d ../src/public 8889', command: 'python3 -m http.server -d ../web/public 8889',
port: 8889, port: 8889,
reuseExistingServer: true, reuseExistingServer: true,
}, },

View File

@@ -11,7 +11,7 @@ FIRMWARE_URL="https://ereaderfiles.kobo.com/firmwares/kobo13/Mar2026/kobo-update
FIRMWARE_DIR="../kobopatch-wasm/testdata" FIRMWARE_DIR="../kobopatch-wasm/testdata"
FIRMWARE_FILE="${FIRMWARE_DIR}/kobo-update-${FIRMWARE_VERSION}.zip" 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." echo "ERROR: kobopatch.wasm not found. Run kobopatch-wasm/build.sh first."
exit 1 exit 1
fi fi

View File

@@ -18,7 +18,7 @@ FIRMWARE_DIR="../kobopatch-wasm/testdata"
FIRMWARE_FILE="${FIRMWARE_DIR}/kobo-update-${FIRMWARE_VERSION}.zip" FIRMWARE_FILE="${FIRMWARE_DIR}/kobo-update-${FIRMWARE_VERSION}.zip"
# Check WASM is built. # 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." echo "ERROR: kobopatch.wasm not found. Run kobopatch-wasm/build.sh first."
exit 1 exit 1
fi fi

View File

@@ -8,7 +8,7 @@ if [ ! -d "$SCRIPT_DIR/kobopatch-src" ]; then
exit 1 exit 1
fi fi
PUBLIC_DIR="$SCRIPT_DIR/../src/public" PUBLIC_DIR="$SCRIPT_DIR/../web/public"
echo "Building kobopatch WASM..." echo "Building kobopatch WASM..."
cd "$SCRIPT_DIR" cd "$SCRIPT_DIR"

View File

@@ -33,7 +33,7 @@ func TestIntegrationPatch(t *testing.T) {
} }
// Read patch files from the patches zip. // 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) patchesZip, err := os.ReadFile(patchesZipPath)
if err != nil { if err != nil {
t.Fatalf("could not read patches zip: %v", err) t.Fatalf("could not read patches zip: %v", err)