channel-worker 1.3.4 → 1.3.6

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.
Files changed (2) hide show
  1. package/lib/nst-manager.js +22 -14
  2. package/package.json +1 -1
@@ -20,10 +20,17 @@ class NstManager {
20
20
  // Get all running browsers
21
21
  async getRunningBrowsers() {
22
22
  try {
23
- const res = await this.api('/browsers/running');
24
- return res?.data || [];
25
- } catch (err) {
26
- console.error(`[nst] Error getting running browsers:`, err.message);
23
+ const rawRes = await fetch(`${this.baseUrl}/browsers/running`, {
24
+ headers: { 'x-api-key': this.apiKey },
25
+ });
26
+ const text = await rawRes.text();
27
+ try {
28
+ const data = JSON.parse(text);
29
+ return data?.data || [];
30
+ } catch {
31
+ return [];
32
+ }
33
+ } catch {
27
34
  return [];
28
35
  }
29
36
  }
@@ -112,17 +119,18 @@ class NstManager {
112
119
  return { profileId, alreadyRunning: true };
113
120
  }
114
121
 
115
- // Update language to en-US
122
+ // Update profile language to en-US before launch
116
123
  try {
117
- const res = await fetch(`${this.baseUrl}/profiles/${profileId}`, {
118
- method: 'PATCH',
119
- headers: { 'Content-Type': 'application/json', 'x-api-key': this.apiKey },
120
- body: JSON.stringify({ fingerprint: { language: 'en-US' } }),
121
- });
122
- if (!res.ok) console.warn(`[nst] Could not update profile language: ${res.status}`);
123
- } catch (err) {
124
- console.warn(`[nst] Could not update profile language:`, err.message);
125
- }
124
+ for (const method of ['PATCH', 'PUT']) {
125
+ const res = await fetch(`${this.baseUrl}/profiles/${profileId}`, {
126
+ method,
127
+ headers: { 'Content-Type': 'application/json', 'x-api-key': this.apiKey },
128
+ body: JSON.stringify({ fingerprint: { language: 'en-US' } }),
129
+ });
130
+ if (res.ok) { console.log(`[nst] Profile language set to en-US (${method})`); break; }
131
+ }
132
+ } catch {}
133
+ // Also set via connect args as fallback
126
134
 
127
135
  // Set proxy before launch
128
136
  if (options.proxy) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Channel Manager worker daemon — runs on remote machines to execute video pipeline jobs",
5
5
  "main": "lib/daemon.js",
6
6
  "bin": {