GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
scripts/web-probe/clipboard (1.1K)
1 #!/usr/bin/env bash
2 # web-probe/clipboard — the clipboard through the browser shell: the
3 # reference app (src/main.rs) built for the page as `demo` builds it, and
4 # clipboard.mjs's copy / paste round trips through its text box, in headless
5 # Chromium with the clipboard permissions granted. Prints one line a check
6 # and fails if any does. Needs what `run` needs.
7 set -euo pipefail
8 here=$(cd "$(dirname "$0")" && pwd)
9 fonts=${DEMO_FONTS_DIR:-/usr/share/fonts}
10 cd "$here/../.."
11
12 cargo build --release --target wasm32-unknown-unknown --example demo_web
13 site=$(mktemp -d)
14 trap 'rm -rf "$site"' EXIT
15 wasm-bindgen --target web --no-typescript --out-dir "$site" \
16 target/wasm32-unknown-unknown/release/examples/demo_web.wasm
17 cp "$here/demo.html" "$site/demo.html"
18 ln -s "$fonts" "$site/fonts"
19 (cd "$fonts" && find . \( -type f -o -type l \) \( -iname '*.ttf' -o -iname '*.otf' -o -iname '*.ttc' -o -iname '*.otc' \) \
20 | sed 's|^\./||' | DEMO_FAMILIES="${DEMO_FAMILIES:-}" python3 -c 'import json,os,sys; print(json.dumps({"files": sys.stdin.read().split(), "families": os.environ["DEMO_FAMILIES"]}))') > "$site/fonts.json"
21 node "$here/clipboard.mjs" "$site"