winzik/tools/embed/tests/test.sh
David Nurdin 87ad5126aa Embed kit and docs: a playground application on a partner's site without iframe nor CORS, and custom domains
tools/embed/jumphp-embed.php: one PHP file (7.4+, curl) that signs the requests to the
playground's /api/embed/<slug>/ (HMAC-SHA256 over method, path, query, time and body
hash), serves the application under the partner's base path (streamed, Range, gzip
passed through, immutable files kept on disk), relays the TCP tickets with the
visitor's address, and gives the blocks (disk cache, ETag revalidation, last copy when
the playground is down); no cookie either way, security headers. Its end-to-end test
(tools/embed/tests/test.sh, Docker), the WordPress plugin (shortcode
[jumphp_block app block], the base path answered at plugins_loaded, settings page,
secret possibly in wp-config.php), nginx / Caddy / plain PHP examples.

docs/embed.md (+ .en), docs/domains.md (+ .en), AGENTS.md section 14.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 02:41:11 +01:00

13 lines
744 B
Shell
Executable file

#!/bin/sh
# The embed kit end to end, in Docker (PHP 8.2 + curl): a fake playground that checks the signatures, the kit in front of it, a browser.
# tools/embed/tests/test.sh
set -e
cd "$(dirname "$0")/.."
exec docker run --rm -v "$PWD:/kit:ro" -w /kit/tests php:8.2-cli-alpine sh -c '
rm -rf /tmp/kit-cache /tmp/kit-cache-2 /tmp/fake-hits.log
php -S 127.0.0.1:9001 fake-playground.php >/tmp/fake.log 2>&1 &
JUMPHP_EMBED_SERVER=http://127.0.0.1:9001 JUMPHP_EMBED_APP=demo JUMPHP_EMBED_SITE=es_00000000000000000000 JUMPHP_EMBED_SECRET=jes_test-secret \
JUMPHP_EMBED_BASE=/chat JUMPHP_EMBED_CACHE=/tmp/kit-cache php -S 127.0.0.1:9002 kit-front.php >/tmp/kit.log 2>&1 &
sleep 1
php -l ../jumphp-embed.php >/dev/null
php check.php'