feat: add Firefox support with cross-browser compatibility
Add manifest.firefox.json for Firefox MV3 (gecko ID, background scripts instead of service_worker, options_ui). Introduce browser-polyfill.js shim so all modules use whichever API is available (browser.* or chrome.*). Add build.sh to target chrome, firefox, or both. https://claude.ai/code/session_01Dvgwe7XMoSxnWXkih8p1Cw
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#!/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
|
||||
|
||||
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"
|
||||
Reference in New Issue
Block a user