n8n-nodes-nvk-browser 1.0.49 → 1.0.50

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.
@@ -94,7 +94,7 @@ class ProxyHandler {
94
94
  return args;
95
95
  }
96
96
  static saveProxyAuthToProfile(profilePath, proxyConfig) {
97
- if (!proxyConfig || !proxyConfig.username || !proxyConfig.password) {
97
+ if (!proxyConfig) {
98
98
  return;
99
99
  }
100
100
  try {
@@ -112,62 +112,49 @@ class ProxyHandler {
112
112
  prefs = JSON.parse(prefsContent);
113
113
  }
114
114
  catch (error) {
115
- // Ignore
115
+ console.warn(`Error reading Preferences file: ${error instanceof Error ? error.message : String(error)}`);
116
+ // Start with empty object if file is corrupted
116
117
  }
117
118
  }
118
- // Lưu proxy config vào preferences
119
+ // Lưu proxy config vào preferences (Chrome native format)
119
120
  if (!prefs.proxy_config) {
120
121
  prefs.proxy_config = {};
121
122
  }
123
+ const proxyServerUrl = proxyConfig.type === 'http'
124
+ ? `http://${proxyConfig.host}:${proxyConfig.port}`
125
+ : `socks5://${proxyConfig.host}:${proxyConfig.port}`;
122
126
  prefs.proxy_config = {
123
127
  mode: 'fixed_servers',
124
- server: proxyConfig.type === 'http'
125
- ? `http://${proxyConfig.host}:${proxyConfig.port}`
126
- : `socks5://${proxyConfig.host}:${proxyConfig.port}`,
128
+ server: proxyServerUrl,
127
129
  };
128
- // Lưu proxy auth credentials để extension có thể sử dụng
129
- // Chrome không hỗ trợ trực tiếp proxy auth qua preferences
130
- // Cần extension hoặc script để inject authentication
131
- if (!prefs.proxy_auth) {
132
- prefs.proxy_auth = {};
130
+ // Lưu proxy authentication theo format GoLogin: gologin.proxy
131
+ if (!prefs.gologin) {
132
+ prefs.gologin = {};
133
+ }
134
+ if (!prefs.gologin.proxy) {
135
+ prefs.gologin.proxy = {};
133
136
  }
134
- prefs.proxy_auth = {
135
- username: proxyConfig.username,
136
- password: proxyConfig.password,
137
- server: proxyConfig.type === 'http'
138
- ? `http://${proxyConfig.host}:${proxyConfig.port}`
139
- : `socks5://${proxyConfig.host}:${proxyConfig.port}`,
137
+ // Lưu proxy server URL, username và password
138
+ prefs.gologin.proxy = {
139
+ host: proxyConfig.host,
140
+ port: proxyConfig.port,
141
+ type: proxyConfig.type,
142
+ server: proxyServerUrl,
140
143
  };
141
- // Lưu vào Secure Preferences nếu có (cho proxy authentication)
142
- const securePrefsPath = path.join(defaultDir, 'Secure Preferences');
143
- let securePrefs = {};
144
- if (fs.existsSync(securePrefsPath)) {
145
- try {
146
- const securePrefsContent = fs.readFileSync(securePrefsPath, 'utf-8');
147
- securePrefs = JSON.parse(securePrefsContent);
148
- }
149
- catch (error) {
150
- // Ignore
151
- }
144
+ // Chỉ lưu username password nếu có
145
+ if (proxyConfig.username) {
146
+ prefs.gologin.proxy.username = proxyConfig.username;
152
147
  }
153
- // Lưu proxy auth vào secure preferences
154
- if (!securePrefs.proxy_auth) {
155
- securePrefs.proxy_auth = {};
148
+ if (proxyConfig.password) {
149
+ prefs.gologin.proxy.password = proxyConfig.password;
156
150
  }
157
- securePrefs.proxy_auth = {
158
- username: proxyConfig.username,
159
- password: proxyConfig.password,
160
- server: proxyConfig.type === 'http'
161
- ? `http://${proxyConfig.host}:${proxyConfig.port}`
162
- : `socks5://${proxyConfig.host}:${proxyConfig.port}`,
163
- };
164
- // Ghi lại Preferences
151
+ // Ghi lại Preferences file
165
152
  fs.writeFileSync(prefsPath, JSON.stringify(prefs, null, 2), 'utf-8');
166
- // Ghi lại Secure Preferences
167
- fs.writeFileSync(securePrefsPath, JSON.stringify(securePrefs, null, 2), 'utf-8');
153
+ console.log(`Proxy authentication saved to Preferences: ${prefsPath}`);
168
154
  }
169
155
  catch (error) {
170
- // Ignore errors - proxy auth is optional
156
+ console.error(`Error saving proxy authentication: ${error instanceof Error ? error.message : String(error)}`);
157
+ // Don't throw - proxy auth is optional but log the error
171
158
  }
172
159
  }
173
160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-nvk-browser",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "n8n nodes for managing Chrome browser profiles and page interactions with Puppeteer automation",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",