sync install.sh: only install camoufox-js, daemon is now embedded in binary

This commit is contained in:
2026-06-13 23:22:22 +05:30
parent 6aa200f373
commit 1d32a9f76a

View File

@@ -218,34 +218,18 @@ install_camoufox_browser() {
if ! command -v npx &>/dev/null && ! command -v npm &>/dev/null; then
warn "Node.js not found. Skipping Camoufox install."
warn "Install Node.js and re-run: npm install -g camoufox-browser@0.1.0"
warn "Install Node.js and re-run: npm install -g camoufox-js@0.11.0 && npx --yes camoufox-js@0.11.0 fetch"
return 0
fi
# Step 1: Install npm package (daemon)
info "Installing npm package (camoufox-browser@0.1.0)..."
npm install -g camoufox-browser@0.1.0 2>&1 | tail -3 || {
warn "npm install failed. Try manually: npm install -g camoufox-browser@0.1.0"
return 0
}
# Step 2: Override bundled camoufox-js@0.9.3 with v0.11.0
# The daemon does: import("camoufox-js") — Node resolves this from
# the daemon's own node_modules/ FIRST, before checking global.
# So we must REMOVE the bundled copy so Node falls through to global.
info "Upgrading bundled camoufox-js to v0.11.0 (daemon dependency)..."
local cb_pkg
cb_pkg="$(npm root -g 2>/dev/null)/camoufox-browser"
if [ -d "$cb_pkg/node_modules/camoufox-js" ]; then
rm -rf "$cb_pkg/node_modules/camoufox-js"
ok "Removed bundled camoufox-js@0.9.3 from daemon package"
fi
# Ensure global v0.11.0 exists
# Step 1: Install camoufox-js globally (daemon imports this at runtime)
info "Installing camoufox-js@0.11.0 (browser engine)..."
npm install -g camoufox-js@0.11.0 2>&1 | tail -3 || {
warn "Failed to install camoufox-js@0.11.0 globally"
warn "npm install failed. Try manually: npm install -g camoufox-js@0.11.0"
return 0
}
# Step 3: Download browser binary
# Step 2: Download browser binary
info "Downloading Camoufox browser binary (~311MB)..."
npx --yes camoufox-js@0.11.0 fetch 2>&1 || {
warn "Download failed. Try manually: npx --yes camoufox-js@0.11.0 fetch"