master
John Lauer Every file the Rust build embeds from outside rust/ (pup-bridge#118): src/extension-nbe/**, src/extension-identity/iden… c7a8f33 1mo ago
#!/usr/bin/env bash
# Re-copy nb's extension into pup's staged copy. nb's repo is the source of truth: pup never edits
# nbe's code, it only adds toolbar.json (the packaged default nb built for pup: sw.js "a host that
# copies this extension into its own profile (pup) can drop a toolbar.json next to the manifest").
set -euo pipefail
SRC="${1:-/home/adom/project/adom-browser-extension/extension}"
DST="$(cd "$(dirname "$0")/.." && pwd)/src/extension-nbe"
[ -f "$SRC/manifest.json" ] || { echo "no nbe at $SRC"; exit 1; }
rm -rf "$DST"; mkdir -p "$DST"; cp -r "$SRC/." "$DST/"
rm -f "$DST/icons/README.md"
printf '{"toolbarIcon":"on"}\n' > "$DST/toolbar.json"
python3 - "$DST/icons" <<'PYICON'
import sys
from PIL import Image, ImageDraw
d=sys.argv[1]; TEAL=(0,184,177,255); INK=(0,61,64,255); S=512
im=Image.new('RGBA',(S,S),(0,0,0,0)); dr=ImageDraw.Draw(im)
dr.rounded_rectangle([0,0,S-1,S-1], radius=int(S*22/128), fill=TEAL)
m=int(S*26/128); top=int(S*30/128); bot=S-m
dr.rounded_rectangle([m,top,S-m,bot], radius=int(S*10/128), fill=INK)
bar=int(S*22/128)
dr.rounded_rectangle([m+int(S*9/128), top+bar, S-m-int(S*9/128), bot-int(S*9/128)], radius=int(S*5/128), fill=TEAL)
r=int(S*5/128); cy=top+bar//2
for cx in [m+int(S*13/128), m+int(S*27/128)]: dr.ellipse([cx-r,cy-r,cx+r,cy+r], fill=TEAL)
for sz in (16,48,128): im.resize((sz,sz), Image.LANCZOS).save('%s/icon%d.png'%(d,sz))
PYICON
V=$(python3 -c "import json;print(json.load(open('$DST/manifest.json'))['version'])")
printf 'adom-browser-extension/extension v%s\n' "$V" > "$DST/.nbe-source"
echo "synced nbe v$V into src/extension-nbe"
# 2.0.578: pup's OWN worker imports nbe's DevTools driver (one driver, not two). A module worker can only
# import files inside its own extension, so the driver is copied next to worker.js as nbe-cdp.js.
cp "$SRC/src/cdp.js" "$(dirname "$DST")/extension/nbe-cdp.js"
echo "synced nbe cdp.js -> src/extension/nbe-cdp.js"