channel-worker 1.6.7 → 1.6.8
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/lib/nst-manager.js +18 -5
- package/package.json +1 -1
package/lib/nst-manager.js
CHANGED
|
@@ -149,11 +149,6 @@ class NstManager {
|
|
|
149
149
|
}
|
|
150
150
|
} catch {}
|
|
151
151
|
|
|
152
|
-
// Set proxy before launch
|
|
153
|
-
if (options.proxy) {
|
|
154
|
-
await this.setProxy(profileId, options.proxy);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
152
|
const connectConfig = {
|
|
158
153
|
headless: false,
|
|
159
154
|
autoClose: false,
|
|
@@ -163,6 +158,24 @@ class NstManager {
|
|
|
163
158
|
},
|
|
164
159
|
};
|
|
165
160
|
|
|
161
|
+
// Pass proxy in connect config
|
|
162
|
+
if (options.proxy) {
|
|
163
|
+
try {
|
|
164
|
+
const proxyUrl = new URL(options.proxy);
|
|
165
|
+
connectConfig.proxy = {
|
|
166
|
+
proxyMethod: 'custom',
|
|
167
|
+
proxyType: proxyUrl.protocol.replace(':', '') || 'http',
|
|
168
|
+
host: proxyUrl.hostname,
|
|
169
|
+
port: proxyUrl.port,
|
|
170
|
+
username: decodeURIComponent(proxyUrl.username || ''),
|
|
171
|
+
password: decodeURIComponent(proxyUrl.password || ''),
|
|
172
|
+
};
|
|
173
|
+
console.log(`[nst] Proxy: ${proxyUrl.hostname}:${proxyUrl.port}`);
|
|
174
|
+
} catch (e) {
|
|
175
|
+
console.warn(`[nst] Invalid proxy URL: ${options.proxy}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
166
179
|
if (options.extensionPath) {
|
|
167
180
|
connectConfig.args['--load-extension'] = options.extensionPath;
|
|
168
181
|
connectConfig.args['--disable-extensions-except'] = options.extensionPath;
|