channel-worker 1.6.12 → 1.6.14
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 +12 -4
- package/package.json +1 -1
package/lib/nst-manager.js
CHANGED
|
@@ -127,10 +127,18 @@ class NstManager {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
// If already running, stop first then relaunch
|
|
130
|
-
|
|
130
|
+
const running = await this.getRunningBrowsers();
|
|
131
|
+
console.log(`[nst] Running browsers: ${running.map(b => b.name || b.profileId).join(', ') || 'none'}`);
|
|
132
|
+
const isRunning = running.some(b => b.profileId === profileId);
|
|
133
|
+
if (isRunning) {
|
|
131
134
|
console.log(`[nst] Profile ${profileId} already running — stopping first`);
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
try {
|
|
136
|
+
await this.stopProfile(profileId);
|
|
137
|
+
console.log(`[nst] Stop command sent, waiting 3s...`);
|
|
138
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
139
|
+
} catch (e) {
|
|
140
|
+
console.warn(`[nst] Stop failed: ${e.message} — continuing anyway`);
|
|
141
|
+
}
|
|
134
142
|
}
|
|
135
143
|
|
|
136
144
|
// Update profile language to en-US (Custom) before launch
|
|
@@ -162,7 +170,7 @@ class NstManager {
|
|
|
162
170
|
// Pass proxy as URL string in connect config (Nstbrowser API format)
|
|
163
171
|
if (options.proxy) {
|
|
164
172
|
connectConfig.proxy = options.proxy;
|
|
165
|
-
connectConfig.args['--proxy-bypass-list'] = 'api.channel.tunasm.art,localhost,127.0.0.1';
|
|
173
|
+
connectConfig.args['--proxy-bypass-list'] = 'api.channel.tunasm.art,*.amazonaws.com,localhost,127.0.0.1';
|
|
166
174
|
console.log(`[nst] Proxy: ${options.proxy} (bypass: api.channel.tunasm.art)`);
|
|
167
175
|
}
|
|
168
176
|
|