Diffinery

homeflare/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

fix(scripts): read the /login page before matching it

`curl | grep -q` fails under pipefail when grep stops early.
Jason Schwarzenberger authored 1 parent ff5bbbccommit 4bc699234c5880d2708ee4a4fbdf10a91195ed32Browse files
2 files changed+6−1
modifiedHOMEFLARE.md+2−0View file
@@ -8,6 +8,8 @@
88 with Cloudflare's API and registry as the defaults.
99 - The Homeflare deploy described below, skipping the steps that need Cloudflare
1010 itself.
11+- `scripts/setup.sh` reading the `/login` page before matching it: `curl | grep -q`
12+ fails under `pipefail` when grep stops early.
1113
1214 Rebase onto upstream when it moves:
1315
modifiedscripts/setup.sh+4−1View file
@@ -258,7 +258,10 @@
258258 [[ "$code" == 200 ]] || die "https://$DIFFINERY_DOMAIN/healthz did not return 200 (last: ${code:-no answer}). Check that $DIFFINERY_DOMAIN resolves to the host serving $CF_API and that the Worker started."
259259 fi
260260 info "/healthz -> 200"
261-curl -sS "https://$DIFFINERY_DOMAIN/login" | grep -q "Sign in with a passkey" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc"
261+# Read the whole page before matching: `curl | grep -q` fails under pipefail when grep stops
262+# early and curl can't finish writing (curl: (23) Failed writing body).
263+LOGIN_PAGE="$(curl -sS "https://$DIFFINERY_DOMAIN/login" || true)"
264+grep -q "Sign in with a passkey" <<<"$LOGIN_PAGE" || die "/login is not the Diffinery sign-in page: check DIFFINERY_DOMAIN, DIFFINERY_ZONE and the route in apps/diffinery/wrangler.deploy.jsonc"
262265 info "/login serves the passkey sign-in page"
263266 loc="$(curl -sS -o /dev/null -w '%{http_code} %{redirect_url}' "https://$DIFFINERY_DOMAIN/auth/access" || true)"
264267 if ((ON_CLOUDFLARE == 0)); then