gemini-proxy-client 1.0.19 → 1.0.21

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.
@@ -5,12 +5,6 @@ import path from 'path';
5
5
  import { execSync } from 'child_process';
6
6
  import { BrowserManager } from '../browser/manager.js';
7
7
  import { generateToken, ensureDataDir } from '../utils/helpers.js';
8
- /**
9
- * 检查是否是 macOS
10
- */
11
- function isMacOS() {
12
- return process.platform === 'darwin';
13
- }
14
8
  /**
15
9
  * 检查 Camoufox 是否已安装
16
10
  */
@@ -78,12 +72,6 @@ export async function startClient(options) {
78
72
  if (options.virtual) {
79
73
  headless = 'virtual';
80
74
  }
81
- // macOS 上自动使用 Playwright(Camoufox headless 在 macOS 上有问题)
82
- if (isMacOS() && !options.playwright && (options.headless || options.virtual)) {
83
- console.log(chalk.yellow('⚠️ macOS 检测到,自动切换到 Playwright Firefox'));
84
- usePlaywright = true;
85
- headless = true; // macOS 上使用纯 headless
86
- }
87
75
  if (!hasCookies) {
88
76
  console.log(chalk.yellow('⚠️ 未检测到 Google 登录状态'));
89
77
  console.log(chalk.white(' 将打开浏览器,请登录您的 Google 账号...'));
@@ -91,18 +79,10 @@ export async function startClient(options) {
91
79
  usePlaywright = false; // 登录时使用 Camoufox 有界面模式
92
80
  }
93
81
  else if (!options.headless && !options.virtual) {
94
- // 有 cookies,默认使用虚拟显示模式(如果可用)或无头模式
95
- if (isMacOS()) {
96
- headless = true;
97
- usePlaywright = true;
98
- console.log(chalk.green('📂 检测到已保存的登录状态'));
99
- console.log(chalk.gray(' macOS: 使用 Playwright Firefox 无头模式'));
100
- }
101
- else {
102
- headless = 'virtual';
103
- console.log(chalk.green('📂 检测到已保存的登录状态'));
104
- console.log(chalk.gray(' 尝试使用虚拟显示模式 (需要 xvfb)'));
105
- }
82
+ // 有 cookies,默认使用无头模式
83
+ headless = true;
84
+ console.log(chalk.green('📂 检测到已保存的登录状态'));
85
+ console.log(chalk.gray(' 使用无头模式'));
106
86
  }
107
87
  const spinner = ora('启动浏览器...').start();
108
88
  try {
@@ -131,19 +111,19 @@ export async function startClient(options) {
131
111
  // 保存 cookies
132
112
  await browserManager.saveCookies();
133
113
  console.log(chalk.green('✅ Google 登录成功!已保存登录状态'));
134
- // 关闭有界面的浏览器,以虚拟显示模式重新启动
135
- console.log(chalk.gray('🔄 切换到虚拟显示模式...'));
114
+ // 关闭有界面的浏览器,以无头模式重新启动
115
+ console.log(chalk.gray('🔄 切换到无头模式...'));
136
116
  await browserManager.close();
137
- // 创建新的虚拟显示模式浏览器实例
117
+ // 创建新的无头模式浏览器实例
138
118
  browserManager = new BrowserManager({
139
- headless: 'virtual',
119
+ headless: true,
140
120
  dataDir,
141
121
  serverUrl: server,
142
122
  token,
143
123
  });
144
124
  // 重新设置信号处理
145
125
  setupSignalHandlers(browserManager);
146
- spinner.start('以虚拟显示模式重新启动...');
126
+ spinner.start('以无头模式重新启动...');
147
127
  await browserManager.launch();
148
128
  spinner.text = '打开 Build App 页面...';
149
129
  await browserManager.openBuildApp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemini-proxy-client",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Gemini Proxy Build App 客户端 - 使用 Camoufox 自动保持连接",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -14,7 +14,14 @@
14
14
  "postinstall": "camoufox-js fetch || echo 'Camoufox download failed. Run: npx camoufox-js fetch'",
15
15
  "prepublishOnly": "npm run build"
16
16
  },
17
- "keywords": ["gemini", "proxy", "build-app", "camoufox", "automation", "google-ai-studio"],
17
+ "keywords": [
18
+ "gemini",
19
+ "proxy",
20
+ "build-app",
21
+ "camoufox",
22
+ "automation",
23
+ "google-ai-studio"
24
+ ],
18
25
  "author": "",
19
26
  "license": "MIT",
20
27
  "engines": {