icons: icon.html draws a fixed box at the requested size (?s=512) so the runner's screenshot crop is exact
shots / shots (push) Successful in 2m21s

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K6897PWcUEwHiqZMcVnNF6
This commit is contained in:
teahubxyzandClaude Fable 5.1 committed 2026-10-20 23:46:28 +00:00
1 parent 6d0e980662
commit 42d68a2a4c
2 files changed
+10 -8

No files matched your search

+3 -2
View File
@@ -1,5 +1,6 @@
<!doctype html>
<meta charset="utf-8">
<title>icon</title>
<style>html,body{margin:0;height:100%;background:#0b0b0e;overflow:hidden}img{display:block;width:100vmin;height:100vmin}</style>
<img src="icon.svg" alt="">
<style>html,body{margin:0;background:#0b0b0e;overflow:hidden}img{position:absolute;left:0;top:0;display:block}</style>
<img id="i" src="icon.svg" alt="">
<script>const s=+new URLSearchParams(location.search).get("s")||512;const i=document.getElementById("i");i.width=s;i.height=s;i.style.width=i.style.height=s+"px";</script>
+7 -6
View File
@@ -22,14 +22,15 @@ until curl -fs -o /dev/null --max-time 2 "http://127.0.0.1:$PORT/"; do
n=$((n + 1)); [ "$n" -lt 40 ] || { echo "the local server on port $PORT never answered" >&2; exit 1; }; sleep 0.5
done
# shoot <url> <WxH> <out>: one headless screenshot, waited for
# shoot <url> <WxH> <out>: one headless screenshot, waited for. The icon page draws its own box at the top left,
# so the crop is exact whatever viewport the runner's Chromium decides on.
shoot() {
prof=$(mktemp -d)
rm -f "$3"
# shellcheck disable=SC2086
"$CHROME" --headless=new --hide-scrollbars --no-first-run --no-default-browser-check --disable-background-networking \
--disable-component-update --user-data-dir="$prof" --virtual-time-budget=6000 --window-size="$2" \
--screenshot="$3" ${CHROME_FLAGS:-} "$1" >"$prof.log" 2>&1 &
--disable-component-update --force-device-scale-factor=1 --user-data-dir="$prof" --virtual-time-budget=6000 \
--window-size="$2" --screenshot="$3" ${CHROME_FLAGS:-} "$1" >"$prof.log" 2>&1 &
pid=$!
n=0
while kill -0 "$pid" 2>/dev/null && [ ! -s "$3" ]; do n=$((n + 1)); [ "$n" -lt 120 ] || break; sleep 0.5; done
@@ -42,6 +43,6 @@ shoot() {
mkdir -p shots icons
shoot "http://127.0.0.1:$PORT/" 1440,900 "$PWD/shots/desktop.png"
shoot "http://127.0.0.1:$PORT/icons/icon.html" 512,512 "$PWD/icons/icon-512.png"
shoot "http://127.0.0.1:$PORT/icons/icon.html" 192,192 "$PWD/icons/icon-192.png"
shoot "http://127.0.0.1:$PORT/icons/icon.html" 180,180 "$PWD/icons/apple-touch-icon.png"
shoot "http://127.0.0.1:$PORT/icons/icon.html?s=512" 512,512 "$PWD/icons/icon-512.png"
shoot "http://127.0.0.1:$PORT/icons/icon.html?s=192" 192,192 "$PWD/icons/icon-192.png"
shoot "http://127.0.0.1:$PORT/icons/icon.html?s=180" 180,180 "$PWD/icons/apple-touch-icon.png"