#!/usr/bin/env bash # HTTP/package proof only: no real identities, relays, rooms or hardware. set -euo pipefail repo=$(cd "$(dirname "$0")/../../.." && pwd) image=${1:-localhost/archipelago-kithmoot:0.5.4-archy.1} python_image=${PYTHON_TEST_IMAGE:-docker.io/library/python:3.13-slim-bookworm@sha256:a1165e272e578941b84abc79e4ab38a0305cd12803a5c4247979ac7655f4d641} name="archy-kithmoot-fixture-$$" cleanup() { podman rm -f "$name-probe" "$name" >/dev/null 2>&1 || true; } trap cleanup EXIT trap 'exit 130' INT trap 'exit 143' TERM common=(--http-proxy=false --cpus 1 --memory 256m --pids-limit 128 --read-only --cap-drop all --security-opt no-new-privileges --tmpfs /tmp:rw,nosuid,nodev,size=32m) test "$(podman image inspect --format '{{.Config.User}}' "$image")" = '101:101' test "$(podman image inspect --format '{{index .Labels "org.opencontainers.image.revision"}}' "$image")" = '408c7b8e00caa3c968926fa7c3c9cd4ac58c76b9' podman run -d --name "$name" "${common[@]}" --network none \ --volume "$repo/neode-ui/public/nostr-provider.js:/bridge/nostr-provider.js:ro" "$image" >/dev/null for _ in $(seq 1 30); do if podman exec "$name" wget -q -O /dev/null http://127.0.0.1:8080/healthz; then break; fi sleep 0.2 done podman run -i --rm --name "$name-probe" "${common[@]}" --network "container:$name" \ --volume "$repo/docker/kithmoot:/expected:ro" \ --volume "$repo/neode-ui/public/nostr-provider.js:/expected-provider.js:ro" "$python_image" python3 - <<'PY' from pathlib import Path import urllib.error, urllib.request opener = urllib.request.build_opener(urllib.request.ProxyHandler({})) def get(path, expected=200): try: with opener.open('http://127.0.0.1:8080'+path, timeout=5) as r: status, headers, body = r.status, r.headers, r.read() except urllib.error.HTTPError as r: status, headers, body = r.code, r.headers, r.read() assert status == expected, (path, status, expected) return headers, body for path in ('/j/', '/healthz'): headers, body=get(path) assert b'KithMoot' in body assert 'camera=(self)' in headers['Permissions-Policy'] assert 'script-src' in headers['Content-Security-Policy'] for filename in ('archipelago-video.mjs', 'video-entry.mjs'): headers, body=get('/j/'+filename) assert body == Path('/expected',filename).read_bytes(), filename assert 'javascript' in headers['Content-Type'] headers, body=get('/nostr-provider.js') assert body == Path('/expected-provider.js').read_bytes() assert 'no-store' in headers['Cache-Control'] get('/turn',404) get('/codes',404) print('PASS matched KithMoot HTTP package: nonroot, pinned revision, exact adapters/provider, headers, truthful missing services') PY