Fix missing stylesheet link; deploy-time asset smoke checks

This commit is contained in:
zai-agent 2026-09-16 00:18:05 +00:00
parent fd55ac8837
commit 17f2070e7b
2 changed files with 18 additions and 0 deletions

View file

@ -67,6 +67,7 @@ def layout(title, desc, body, path='/', extra_head=''):
<meta property="og:type" content="website">
<meta property="og:url" content="{SITE_URL}{esc(path)}">
<meta name="twitter:card" content="summary">
<link rel="stylesheet" href="/static/style.css">
<style>:root{{--brand:#e4572e;--brand2:#f5a623;--ink:#2b2118;--cream:#fff8ec;--card:#ffffff}}</style>
{extra_head}
</head>

View file

@ -21,4 +21,21 @@ for host in bestdadjokes.lol www.bestdadjokes.lol myadhd.dev; do
code=$(curl -sk -o /dev/null -w '%{http_code}' --resolve "$host:443:127.0.0.1" "https://$host/" --max-time 10)
echo " https://$host -> $code (origin)"
done
echo "==> asset smoke checks"
fail=0
hp=$(curl -sk --resolve bestdadjokes.lol:443:127.0.0.1 https://bestdadjokes.lol/ --max-time 10)
echo "$hp" | grep -q 'rel="stylesheet"' || { echo " FAIL: stylesheet not linked in homepage"; fail=1; }
for asset in /static/style.css /static/main.js /static/jokes-data.js /static/favicon.svg; do
out=$(curl -sk -o /dev/null -w '%{http_code} %{content_type}' --resolve bestdadjokes.lol:443:127.0.0.1 "https://bestdadjokes.lol$asset" --max-time 10)
echo " $asset -> $out"
case "$out" in 200*) ;; *) fail=1 ;; esac
done
# every referenced local asset must exist (catches missing files)
echo "$hp" | grep -oE '(src|href)="/[^"]+"' | sed -E 's/(src|href)="([^"]+)"/\2/' | sort -u | while read -r ref; do
case "$ref" in //*) continue ;; esac
code=$(curl -sk -o /dev/null -w '%{http_code}' --resolve bestdadjokes.lol:443:127.0.0.1 "https://bestdadjokes.lol$ref" --max-time 10)
[ "$code" = "200" ] || echo " WARN: referenced asset $ref -> $code"
done
[ "$fail" = "0" ] || { echo "==> DEPLOY FAILED ASSET CHECKS"; exit 1; }
echo "==> deploy complete"