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.
- package/dist/utils/ProxyHandler.js +29 -42
- package/package.json +1 -1
|
@@ -94,7 +94,7 @@ class ProxyHandler {
|
|
|
94
94
|
return args;
|
|
95
95
|
}
|
|
96
96
|
static saveProxyAuthToProfile(profilePath, proxyConfig) {
|
|
97
|
-
if (!proxyConfig
|
|
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
|
-
|
|
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:
|
|
125
|
-
? `http://${proxyConfig.host}:${proxyConfig.port}`
|
|
126
|
-
: `socks5://${proxyConfig.host}:${proxyConfig.port}`,
|
|
128
|
+
server: proxyServerUrl,
|
|
127
129
|
};
|
|
128
|
-
// Lưu proxy
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
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 và password nếu có
|
|
145
|
+
if (proxyConfig.username) {
|
|
146
|
+
prefs.gologin.proxy.username = proxyConfig.username;
|
|
152
147
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
securePrefs.proxy_auth = {};
|
|
148
|
+
if (proxyConfig.password) {
|
|
149
|
+
prefs.gologin.proxy.password = proxyConfig.password;
|
|
156
150
|
}
|
|
157
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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