gemini-proxy-client 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -4
- package/dist/browser/manager.js +4 -0
- package/dist/cli.js +16 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,13 +20,20 @@
|
|
|
20
20
|
npm install -g gemini-proxy-client
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
### 2. 安装 Camoufox 浏览器
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
|
|
26
|
+
gemini-client setup
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
这会下载 Camoufox 浏览器(约 200MB)。如果网络有问题,可以设置代理:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
export https_proxy=http://127.0.0.1:7890
|
|
33
|
+
gemini-client setup
|
|
27
34
|
```
|
|
28
35
|
|
|
29
|
-
###
|
|
36
|
+
### 3. 启动客户端
|
|
30
37
|
|
|
31
38
|
```bash
|
|
32
39
|
gemini-client start --server ws://your-server:5345/v1/ws
|
|
@@ -41,7 +48,7 @@ gemini-client start --server ws://your-server:5345/v1/ws
|
|
|
41
48
|
|
|
42
49
|
**之后运行**会直接以无头模式启动,无需再登录。
|
|
43
50
|
|
|
44
|
-
###
|
|
51
|
+
### 4. 后台运行
|
|
45
52
|
|
|
46
53
|
```bash
|
|
47
54
|
# 使用 nohup 后台运行
|
|
@@ -111,6 +118,14 @@ gemini-client start [options]
|
|
|
111
118
|
| `--headless` | 强制无头模式 | 自动判断 |
|
|
112
119
|
| `--data-dir <path>` | 数据目录路径 | `~/.gemini-client` |
|
|
113
120
|
|
|
121
|
+
### setup - 安装 Camoufox 浏览器
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
gemini-client setup
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
下载并安装 Camoufox 浏览器,首次使用前必须执行。
|
|
128
|
+
|
|
114
129
|
### login - 登录 Google 账号
|
|
115
130
|
|
|
116
131
|
```bash
|
package/dist/browser/manager.js
CHANGED
|
@@ -33,6 +33,10 @@ export class BrowserManager {
|
|
|
33
33
|
console.log(chalk.gray(`指纹配置: ${fingerprint.viewport.width}x${fingerprint.viewport.height}, ${fingerprint.locale}, ${fingerprint.timezoneId}`));
|
|
34
34
|
this.browser = await Camoufox({
|
|
35
35
|
headless: this.options.headless,
|
|
36
|
+
// 禁用 Cross-Origin-Opener-Policy,允许操作跨域 iframe 中的元素
|
|
37
|
+
disable_coop: true,
|
|
38
|
+
// 允许在主世界执行脚本,用于 iframe 内的 evaluate
|
|
39
|
+
main_world_eval: true,
|
|
36
40
|
});
|
|
37
41
|
this.context = await this.browser.newContext({
|
|
38
42
|
viewport: fingerprint.viewport,
|
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ const program = new Command();
|
|
|
12
12
|
program
|
|
13
13
|
.name('gemini-client')
|
|
14
14
|
.description('Gemini Proxy Build App 客户端 - 使用 Camoufox 自动保持连接')
|
|
15
|
-
.version('1.0.
|
|
15
|
+
.version('1.0.15');
|
|
16
16
|
program
|
|
17
17
|
.command('start')
|
|
18
18
|
.description('启动客户端,连接到代理服务器')
|
|
@@ -70,4 +70,19 @@ program
|
|
|
70
70
|
console.log(chalk.yellow('⚠️ 没有保存的登录状态'));
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
+
program
|
|
74
|
+
.command('setup')
|
|
75
|
+
.description('安装 Camoufox 浏览器')
|
|
76
|
+
.action(async () => {
|
|
77
|
+
console.log(chalk.cyan('📦 安装 Camoufox 浏览器...'));
|
|
78
|
+
const { execSync } = await import('child_process');
|
|
79
|
+
try {
|
|
80
|
+
execSync('npx camoufox-js fetch', { stdio: 'inherit' });
|
|
81
|
+
console.log(chalk.green('✅ Camoufox 安装成功!'));
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
console.error(chalk.red('❌ 安装失败,请检查网络连接'));
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
73
88
|
program.parse();
|