#!/bin/bash
# Writes build/index.stamped.html: the page with the version of the engine in web/dist.
set -e
V=$(cat web/dist/revc.js web/dist/revc.wasm web/dist/revc-jspi.js web/dist/revc-jspi.wasm | sha256sum | cut -c1-12)
# Apache prefers these over the originals, so they must always match: upload them with the engine.
for f in revc.js revc.wasm revc-jspi.js revc-jspi.wasm; do brotli -f -q 11 -k "web/dist/$f" -o "web/dist/$f.br"; done
sed "s/__ENGINE_V__/$V/g" web/shell/index.html > build/index.stamped.html
echo "$V"