Firefox extension CSP blocks inline <script> tags. Moved all test code to test-suite.js (loaded via src attribute). Build script updated to copy both files. https://claude.ai/code/session_01KF4i7Ra7zCEDskxDBaNtcT
54 lines
1.2 KiB
Bash
Executable File
54 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Build Silent Send for Chrome or Firefox.
|
|
#
|
|
# Usage:
|
|
# ./build.sh chrome → dist/chrome/ (load unpacked)
|
|
# ./build.sh firefox → dist/firefox/ (load as temporary add-on)
|
|
# ./build.sh both → builds both
|
|
#
|
|
|
|
set -e
|
|
|
|
TARGET="${1:-both}"
|
|
|
|
build() {
|
|
local browser="$1"
|
|
local out="dist/$browser"
|
|
|
|
echo "Building for $browser..."
|
|
rm -rf "$out"
|
|
mkdir -p "$out"
|
|
|
|
# Copy all source files
|
|
cp -r src icons "$out/"
|
|
|
|
# Copy the correct manifest
|
|
if [ "$browser" = "firefox" ]; then
|
|
cp manifest.firefox.json "$out/manifest.json"
|
|
else
|
|
cp manifest.json "$out/manifest.json"
|
|
fi
|
|
|
|
# Copy other root files
|
|
cp README.md "$out/" 2>/dev/null || true
|
|
cp test-suite.html test-suite.js "$out/" 2>/dev/null || true
|
|
|
|
echo " → $out/ ready"
|
|
}
|
|
|
|
case "$TARGET" in
|
|
chrome) build chrome ;;
|
|
firefox) build firefox ;;
|
|
both) build chrome; build firefox ;;
|
|
*)
|
|
echo "Usage: $0 {chrome|firefox|both}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
echo ""
|
|
echo "Done! Load the extension:"
|
|
echo " Chrome: chrome://extensions → Load unpacked → dist/chrome/"
|
|
echo " Firefox: about:debugging → This Firefox → Load Temporary Add-on → dist/firefox/manifest.json"
|