- commit
- 9506c71
- parent
- a6e9636
- author
- im_wower
- date
- 2026-03-22 15:33:02 +0800 CST
Use system Firefox profile for manual plugin workflow
2 files changed,
+42,
-87
+13,
-13
1@@ -12,30 +12,30 @@
2
3 ## 快速启动
4
5-使用你当前指定的已登录 Firefox profile:
6+当前推荐模式已经改成:
7+
8+- 使用系统 Firefox 的正常默认 profile
9+- `baa-firefox` 插件由你手动安装到这个 profile
10+- Firefox 常开,不再依赖 `web-ext run` 的临时加载模式
11+
12+启动命令:
13
14 ```bash
15 ./scripts/firefox/open-firefox-with-plugin.sh
16 ```
17
18-默认参数是:
19-
20-- profile: `/Users/george/Library/Application Support/Firefox/Profiles/biog272e.default-release`
21-- extension source: `/Users/george/code/baa-conductor/plugins/baa-firefox`
22-- firefox binary: `/Applications/Firefox.app/Contents/MacOS/firefox`
23-
24-如果要改 profile:
25+如果要顺手打开 Claude:
26
27 ```bash
28-./scripts/firefox/open-firefox-with-plugin.sh \
29- --profile "/Users/george/Library/Application Support/Firefox/Profiles/biog272e.default-release"
30+./scripts/firefox/open-firefox-with-plugin.sh --url https://claude.ai
31 ```
32
33 说明:
34
35-- 这是 `web-ext run` 的临时加载模式
36-- 脚本进程退出后,扩展会被卸载
37-- 下次新对话直接运行这个脚本即可恢复同一套 profile + 插件环境
38+- 脚本现在只是打开系统 Firefox,不再创建单独 profile
39+- 脚本也不再临时注入扩展
40+- 插件需要你手动安装到 Firefox 的正常使用 profile
41+- 下次新对话直接运行这个脚本即可,前提是 Firefox 里已经装好插件
42
43 本文档定义 `baa-firefox` 与 `baa-conductor` control API 之间的最小协议。
44
+29,
-74
1@@ -7,64 +7,34 @@ Usage:
2 scripts/firefox/open-firefox-with-plugin.sh [options]
3
4 Options:
5- --repo-dir PATH Repo root. Defaults to /Users/george/code/baa-conductor.
6- --profile PATH Firefox profile path.
7- --firefox-bin PATH Firefox binary path.
8- --source-dir PATH Extension source dir. Defaults to <repo>/plugins/baa-firefox.
9- --start-url URL Optional start URL passed to web-ext.
10- --devtools Open browser devtools.
11- --verbose Enable verbose web-ext logging.
12+ --firefox-app PATH Firefox.app path. Defaults to /Applications/Firefox.app
13+ --url URL Optional URL to open after launch.
14+ --wait Wait for the `open` command to finish.
15 --help Show this help text.
16
17 Notes:
18- This uses web-ext temporary loading. Keep this script process alive while
19- you want the extension to remain installed in Firefox.
20+ This launcher now opens the system Firefox with its normal default profile.
21+ The baa-firefox extension is expected to be installed manually in that profile.
22+ Keep Firefox running as a normal long-lived process.
23 EOF
24 }
25
26-require_command() {
27- if ! command -v "$1" >/dev/null 2>&1; then
28- printf '[firefox] error: missing command: %s\n' "$1" >&2
29- exit 1
30- fi
31-}
32-
33-repo_dir="/Users/george/code/baa-conductor"
34-profile_path="${HOME}/Library/Application Support/Firefox/Profiles/biog272e.default-release"
35-firefox_bin="/Applications/Firefox.app/Contents/MacOS/firefox"
36-source_dir=""
37-start_url=""
38-devtools="0"
39-verbose="0"
40+firefox_app="/Applications/Firefox.app"
41+open_url=""
42+wait_flag="0"
43
44 while [[ $# -gt 0 ]]; do
45 case "$1" in
46- --repo-dir)
47- repo_dir="$2"
48- shift 2
49- ;;
50- --profile)
51- profile_path="$2"
52- shift 2
53- ;;
54- --firefox-bin)
55- firefox_bin="$2"
56- shift 2
57- ;;
58- --source-dir)
59- source_dir="$2"
60+ --firefox-app)
61+ firefox_app="$2"
62 shift 2
63 ;;
64- --start-url)
65- start_url="$2"
66+ --url)
67+ open_url="$2"
68 shift 2
69 ;;
70- --devtools)
71- devtools="1"
72- shift
73- ;;
74- --verbose)
75- verbose="1"
76+ --wait)
77+ wait_flag="1"
78 shift
79 ;;
80 --help)
81@@ -78,41 +48,26 @@ while [[ $# -gt 0 ]]; do
82 esac
83 done
84
85-require_command npx
86-
87-if [[ -z "$source_dir" ]]; then
88- source_dir="${repo_dir}/plugins/baa-firefox"
89-fi
90-
91-[[ -d "$source_dir" ]] || { printf '[firefox] error: missing source dir: %s\n' "$source_dir" >&2; exit 1; }
92-[[ -d "$profile_path" ]] || { printf '[firefox] error: missing profile dir: %s\n' "$profile_path" >&2; exit 1; }
93-[[ -x "$firefox_bin" ]] || { printf '[firefox] error: missing firefox binary: %s\n' "$firefox_bin" >&2; exit 1; }
94+[[ -d "$firefox_app" ]] || {
95+ printf '[firefox] error: missing Firefox.app: %s\n' "$firefox_app" >&2
96+ exit 1
97+}
98
99-cmd=(
100- npx --yes web-ext run
101- --source-dir "$source_dir"
102- --firefox "$firefox_bin"
103- --target firefox-desktop
104- --firefox-profile "$profile_path"
105- --keep-profile-changes
106- --pref=network.proxy.allow_hijacking_localhost=false
107- --pref=network.proxy.no_proxies_on=localhost,127.0.0.1
108-)
109+cmd=(open -a "$firefox_app")
110
111-if [[ -n "$start_url" ]]; then
112- cmd+=(--start-url "$start_url")
113+if [[ "$wait_flag" == "1" ]]; then
114+ cmd+=(-W)
115 fi
116
117-if [[ "$devtools" == "1" ]]; then
118- cmd+=(--devtools)
119+if [[ -n "$open_url" ]]; then
120+ cmd+=("$open_url")
121 fi
122
123-if [[ "$verbose" == "1" ]]; then
124- cmd+=(--verbose)
125+printf '[firefox] app: %s\n' "$firefox_app"
126+printf '[firefox] mode: system default profile\n'
127+if [[ -n "$open_url" ]]; then
128+ printf '[firefox] url: %s\n' "$open_url"
129 fi
130-
131-printf '[firefox] source dir: %s\n' "$source_dir"
132-printf '[firefox] profile: %s\n' "$profile_path"
133-printf '[firefox] binary: %s\n' "$firefox_bin"
134+printf '[firefox] extension: install baa-firefox manually in the normal Firefox profile\n'
135
136 exec "${cmd[@]}"