Fix carry-over on Pages: add 404.html and tolerate 200-with-HTML
Pages serves index.html with 200 for unknown paths when there is no 404.html, so a never-published channel looked published and jq failed on the HTML. Add a real 404 page and treat a 200 without a latest.json as absent. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdMNbY5hLR7FjtfEE712xG
This commit is contained in:
@@ -17,7 +17,7 @@ case "$channel" in prod) other=dev ;; dev) other=prod ;; *) echo "bad channel: $
|
|||||||
|
|
||||||
rm -rf "$out"
|
rm -rf "$out"
|
||||||
mkdir -p "$out/$channel" "$out/$other"
|
mkdir -p "$out/$channel" "$out/$other"
|
||||||
cp site/index.html site/_headers "$out/"
|
cp site/index.html site/404.html site/_headers "$out/"
|
||||||
|
|
||||||
name="$(basename "$apk")"
|
name="$(basename "$apk")"
|
||||||
cp "$apk" "$out/$channel/$name"
|
cp "$apk" "$out/$channel/$name"
|
||||||
@@ -47,6 +47,11 @@ fi
|
|||||||
if [ "$code" = 404 ]; then
|
if [ "$code" = 404 ]; then
|
||||||
echo "No $other channel published yet; skipping."
|
echo "No $other channel published yet; skipping."
|
||||||
rm -rf "$out/$other"
|
rm -rf "$out/$other"
|
||||||
|
elif [ "$code" = 200 ] && ! jq -e .apkName "$out/$other/latest.json" >/dev/null 2>&1; then
|
||||||
|
# A 200 that is not our JSON: Pages without a 404.html answers unknown paths
|
||||||
|
# with index.html. Nothing is published on that channel.
|
||||||
|
echo "No $other channel published yet (200 but no latest.json); skipping."
|
||||||
|
rm -rf "$out/$other"
|
||||||
elif [ "$code" = 200 ]; then
|
elif [ "$code" = 200 ]; then
|
||||||
other_name="$(jq -er .apkName "$out/$other/latest.json")"
|
other_name="$(jq -er .apkName "$out/$other/latest.json")"
|
||||||
curl -fsS -o "$out/$other/$other_name" "$base/$other/$other_name"
|
curl -fsS -o "$out/$other/$other_name" "$base/$other/$other_name"
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en"><head><meta charset="utf-8"><title>Not found</title></head>
|
||||||
|
<body><h1>404</h1><p>Not found. <a href="/">Pro Libertate Games downloads</a></p></body></html>
|
||||||
Reference in New Issue
Block a user