channel-worker 1.3.4 → 1.3.5
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 -15
- package/package.json +1 -1
package/lib/nst-manager.js
CHANGED
|
@@ -20,10 +20,17 @@ class NstManager {
|
|
|
20
20
|
// Get all running browsers
|
|
21
21
|
async getRunningBrowsers() {
|
|
22
22
|
try {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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,7 @@ class NstManager {
|
|
|
112
119
|
return { profileId, alreadyRunning: true };
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
//
|
|
116
|
-
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
|
-
}
|
|
122
|
+
// Language set via --lang arg in connectConfig, no need to update profile
|
|
126
123
|
|
|
127
124
|
// Set proxy before launch
|
|
128
125
|
if (options.proxy) {
|