From 8d67346f801d30ee09ffe04ab494a52919c55aaa Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Thu, 26 Mar 2026 13:32:38 +0100 Subject: [PATCH] Add support for older devices (Libra 2 and newer) --- .github/workflows/build.yml | 6 ++++++ tests/validate-dl-urls.sh | 38 ++++++++++++++++++++++++++++++++++ web/src/index.html | 5 +++-- web/src/patches/downloads.json | 22 +++++++++++++++++++- web/src/patches/index.json | 12 +++++++---- 5 files changed, 76 insertions(+), 7 deletions(-) create mode 100755 tests/validate-dl-urls.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index add8d78..489322c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,6 +95,12 @@ jobs: if: steps.check-e2e.outputs.run == 'true' && env.GITEA_ACTIONS != 'true' run: readerly/setup.sh + - name: Validate download URLs + if: steps.check-e2e.outputs.run == 'true' && env.GITEA_ACTIONS != 'true' + run: | + cd tests + ./validate-dl-urls.sh + - name: Full integration test (Playwright) if: steps.check-e2e.outputs.run == 'true' && env.GITEA_ACTIONS != 'true' run: | diff --git a/tests/validate-dl-urls.sh b/tests/validate-dl-urls.sh new file mode 100755 index 0000000..79fbae7 --- /dev/null +++ b/tests/validate-dl-urls.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -euo pipefail + +# Validate all firmware download URLs in downloads.json via HEAD requests. +# Exits with code 1 if any URL is invalid. + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)/../web/src/patches" +DOWNLOADS="$SCRIPT_DIR/downloads.json" + +# Extract unique URLs (skip keys starting with _). +URLS=$(node -e " + const d = require('$DOWNLOADS'); + const seen = new Set(); + for (const [key, val] of Object.entries(d)) { + if (key.startsWith('_') || typeof val !== 'object') continue; + for (const url of Object.values(val)) { + if (!seen.has(url)) { seen.add(url); console.log(url); } + } + } +") + +FAILED=0 +TOTAL=0 + +while IFS= read -r url; do + TOTAL=$((TOTAL + 1)) + STATUS=$(curl -s -o /dev/null -w "%{http_code}" --head "$url") + if [ "$STATUS" -ge 200 ] && [ "$STATUS" -lt 400 ]; then + echo " OK $STATUS $url" + else + echo "FAIL $STATUS $url" + FAILED=$((FAILED + 1)) + fi +done <<< "$URLS" + +echo "" +echo "$TOTAL URLs checked, $FAILED failed." +[ "$FAILED" -eq 0 ] diff --git a/web/src/index.html b/web/src/index.html index d856d84..064ad97 100644 --- a/web/src/index.html +++ b/web/src/index.html @@ -133,6 +133,7 @@