Standardize line endings
All checks were successful
Build & Test WASM / build-and-test (push) Successful in 1m45s
All checks were successful
Build & Test WASM / build-and-test (push) Successful in 1m45s
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
* text=auto
|
||||
*.sh text eol=lf
|
||||
@@ -33,7 +33,7 @@ func TestIntegrationPatch(t *testing.T) {
|
||||
}
|
||||
|
||||
// Read patch files from the patches zip.
|
||||
patchesZipPath := "../web/public/patches/patches_4.4523646.zip"
|
||||
patchesZipPath := "../web/public/patches/patches_4.45.23646.zip"
|
||||
patchesZip, err := os.ReadFile(patchesZipPath)
|
||||
if err != nil {
|
||||
t.Fatalf("could not read patches zip: %v", err)
|
||||
|
||||
16
test.sh
Executable file
16
test.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
echo "=== Building WASM ==="
|
||||
"$SCRIPT_DIR/kobopatch-wasm/build.sh"
|
||||
|
||||
echo ""
|
||||
echo "=== Running WASM integration test ==="
|
||||
"$SCRIPT_DIR/kobopatch-wasm/test-integration.sh"
|
||||
|
||||
echo ""
|
||||
echo "=== Running E2E tests (Playwright) ==="
|
||||
cd "$SCRIPT_DIR/e2e"
|
||||
npm test
|
||||
@@ -215,10 +215,9 @@
|
||||
btnDeviceRestore.hidden = false;
|
||||
showStep(stepDevice);
|
||||
} else {
|
||||
deviceStatus.className = 'status-unsupported';
|
||||
deviceStatus.className = 'warning';
|
||||
deviceStatus.textContent =
|
||||
'No patches available for software version ' + info.firmware + '. ' +
|
||||
'Supported versions: ' + available.map(p => p.version).join(', ');
|
||||
'No patch available for this specific version and model combination. Currently, only Kobo Libra Colour, Kobo Clara Colour and Kobo Clara BW can be patched via this website.';
|
||||
btnDeviceNext.hidden = true;
|
||||
btnDeviceRestore.hidden = true;
|
||||
showStep(stepDevice);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<main>
|
||||
<header class="hero">
|
||||
<h1>KoboPatch <span class="hero-accent">Web UI</span> <span class="beta-pill">beta</span></h1>
|
||||
<p class="subtitle">Custom patches for your Kobo e-reader</p>
|
||||
<p class="subtitle">Apply patches to your Kobo Libra Colour, Kobo Clara Colour and Kobo Clara BW.</p>
|
||||
</header>
|
||||
|
||||
<!-- Step indicator -->
|
||||
|
||||
@@ -36,11 +36,6 @@ const KOBO_MODELS = {
|
||||
'N204': 'Kobo Aura HD',
|
||||
};
|
||||
|
||||
/**
|
||||
* Supported firmware version for patching.
|
||||
*/
|
||||
const SUPPORTED_FIRMWARE = '4.45.23646';
|
||||
|
||||
/**
|
||||
* Firmware download URLs by version and serial prefix.
|
||||
* Source: https://help.kobo.com/hc/en-us/articles/35059171032727
|
||||
@@ -58,6 +53,11 @@ const FIRMWARE_DOWNLOADS = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Supported firmware versions for patching (derived from FIRMWARE_DOWNLOADS).
|
||||
*/
|
||||
const SUPPORTED_FIRMWARE = Object.keys(FIRMWARE_DOWNLOADS);
|
||||
|
||||
/**
|
||||
* Get the firmware download URL for a given serial prefix and firmware version.
|
||||
* Returns null if no URL is available.
|
||||
@@ -153,7 +153,7 @@ class KoboDevice {
|
||||
? serial.substring(0, 4)
|
||||
: serial.substring(0, 3);
|
||||
const model = KOBO_MODELS[serialPrefix] || 'Unknown Kobo (' + serial.substring(0, 4) + ')';
|
||||
const isSupported = firmware === SUPPORTED_FIRMWARE;
|
||||
const isSupported = SUPPORTED_FIRMWARE.includes(firmware);
|
||||
|
||||
return {
|
||||
serial,
|
||||
|
||||
@@ -136,14 +136,22 @@ function parsePatchConfig(configYAML) {
|
||||
|
||||
/**
|
||||
* Scan the patches/ directory for available patch zips.
|
||||
* Returns an array of { filename, version } sorted by version descending.
|
||||
* Returns an array of { filename, version } objects.
|
||||
* Each entry in index.json may list multiple versions; these are flattened
|
||||
* so that each version gets its own entry pointing to the same filename.
|
||||
*/
|
||||
async function scanAvailablePatches() {
|
||||
try {
|
||||
const resp = await fetch('patches/index.json');
|
||||
if (!resp.ok) return [];
|
||||
const list = await resp.json();
|
||||
return list;
|
||||
const result = [];
|
||||
for (const entry of list) {
|
||||
for (const version of entry.versions) {
|
||||
result.push({ filename: entry.filename, version });
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[
|
||||
{
|
||||
"filename": "patches_4.4523646.zip",
|
||||
"version": "4.45.23646"
|
||||
}
|
||||
"filename": "patches_4.45.23646.zip",
|
||||
"versions": ["4.45.23646"],
|
||||
"date": "03-2026"
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user