Migrate src/public to web/public
All checks were successful
Build & Test WASM / build-and-test (push) Successful in 1m41s
All checks were successful
Build & Test WASM / build-and-test (push) Successful in 1m41s
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -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/
|
||||
|
||||
12
README.md
12
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
|
||||
|
||||
@@ -17,7 +17,7 @@ const EXPECTED_SHA1 = {
|
||||
const FIRMWARE_PATH = process.env.FIRMWARE_ZIP
|
||||
|| path.resolve(__dirname, '..', 'kobopatch-wasm', 'testdata', 'kobo-update-4.45.23646.zip');
|
||||
|
||||
const WEBROOT_FIRMWARE = path.resolve(__dirname, '..', 'src', 'public', '_test_firmware.zip');
|
||||
const WEBROOT_FIRMWARE = path.resolve(__dirname, '..', 'web', 'public', '_test_firmware.zip');
|
||||
|
||||
/**
|
||||
* Parse a tar archive (uncompressed) and return a map of entry name -> Buffer.
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user