fix: complete CHRNX responsive edge states

This commit is contained in:
chrnx committed 2026-08-12 09:02:34 -05:00
1 parent 5073178492
commit 1e9386ac13
15 files changed
+384 -35

No files matched your search

+28 -1
View File
@@ -3,7 +3,34 @@ set -eu
chrnx_image_script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
chrnx_image_root=$(dirname -- "$chrnx_image_script_dir")
chrnx_image_output="$chrnx_image_root/assets/images/generated"
chrnx_image_default_output="$chrnx_image_root/assets/images/generated"
chrnx_image_output=${1:-"$chrnx_image_default_output"}
case "$chrnx_image_output" in
/*) ;;
*)
echo "Image output must be an explicit absolute path." >&2
exit 2
;;
esac
if [ "$chrnx_image_output" = "/" ] || [ "$chrnx_image_output" = "$chrnx_image_root" ]; then
echo "Refusing broad image output path: $chrnx_image_output" >&2
exit 2
fi
if [ "$chrnx_image_output" != "$chrnx_image_default_output" ]; then
chrnx_image_safe_tmp=${TMPDIR:-/tmp}
chrnx_image_safe_tmp=${chrnx_image_safe_tmp%/}
case "$chrnx_image_output" in
"$chrnx_image_safe_tmp"/chrnx-*) ;;
*)
echo "Temporary image output must be an existing chrnx-* directory under $chrnx_image_safe_tmp." >&2
exit 2
;;
esac
if [ ! -d "$chrnx_image_output" ]; then
echo "Temporary image output does not exist: $chrnx_image_output" >&2
exit 2
fi
fi
chrnx_image_tmp=$(mktemp -d "${TMPDIR:-/tmp}/chrnx-images.XXXXXX")
trap 'rm -rf -- "$chrnx_image_tmp"' EXIT HUP INT TERM