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
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:
1 parent
6d0e980662
commit
42d68a2a4c
2 files changed
+10
-8
No files matched your search
+7
-6
@@ -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"
|
||||
Reference in new issue
Block a user