channel-worker 1.1.8 → 1.1.9
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/bin/cli.js +0 -10
- package/lib/daemon.js +0 -13
- package/lib/nst-manager.js +18 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -58,7 +58,6 @@ if (cmd === 'pair') {
|
|
|
58
58
|
headers: { 'Content-Type': 'application/json' },
|
|
59
59
|
body: JSON.stringify({
|
|
60
60
|
code,
|
|
61
|
-
ip_address: getLocalIP(),
|
|
62
61
|
max_concurrent: maxConcurrent,
|
|
63
62
|
}),
|
|
64
63
|
});
|
|
@@ -163,12 +162,3 @@ Examples:
|
|
|
163
162
|
`);
|
|
164
163
|
}
|
|
165
164
|
|
|
166
|
-
function getLocalIP() {
|
|
167
|
-
const interfaces = os.networkInterfaces();
|
|
168
|
-
for (const name of Object.keys(interfaces)) {
|
|
169
|
-
for (const iface of interfaces[name]) {
|
|
170
|
-
if (iface.family === 'IPv4' && !iface.internal) return iface.address;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return '127.0.0.1';
|
|
174
|
-
}
|
package/lib/daemon.js
CHANGED
|
@@ -2,7 +2,6 @@ const { ApiClient } = require('./api-client');
|
|
|
2
2
|
const { Heartbeat } = require('./heartbeat');
|
|
3
3
|
const { JobPoller } = require('./job-poller');
|
|
4
4
|
const { CommandPoller } = require('./command-poller');
|
|
5
|
-
const os = require('os');
|
|
6
5
|
|
|
7
6
|
class Daemon {
|
|
8
7
|
constructor(config) {
|
|
@@ -29,7 +28,6 @@ class Daemon {
|
|
|
29
28
|
await this.api.register({
|
|
30
29
|
worker_id: this.config.worker_id,
|
|
31
30
|
name: this.config.worker_id,
|
|
32
|
-
ip_address: this.getLocalIP(),
|
|
33
31
|
max_concurrent: this.config.max_concurrent,
|
|
34
32
|
});
|
|
35
33
|
console.log('[daemon] Registered with dashboard ✓');
|
|
@@ -75,17 +73,6 @@ class Daemon {
|
|
|
75
73
|
process.on('SIGTERM', shutdown);
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
getLocalIP() {
|
|
79
|
-
const interfaces = os.networkInterfaces();
|
|
80
|
-
for (const name of Object.keys(interfaces)) {
|
|
81
|
-
for (const iface of interfaces[name]) {
|
|
82
|
-
if (iface.family === 'IPv4' && !iface.internal) {
|
|
83
|
-
return iface.address;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return '127.0.0.1';
|
|
88
|
-
}
|
|
89
76
|
}
|
|
90
77
|
|
|
91
78
|
module.exports = { Daemon };
|
package/lib/nst-manager.js
CHANGED
|
@@ -88,6 +88,7 @@ class NstManager {
|
|
|
88
88
|
},
|
|
89
89
|
hardwareConcurrency: 8,
|
|
90
90
|
deviceMemory: 8,
|
|
91
|
+
language: 'en-US',
|
|
91
92
|
},
|
|
92
93
|
});
|
|
93
94
|
|
|
@@ -119,6 +120,15 @@ class NstManager {
|
|
|
119
120
|
return { profileId, alreadyRunning: true };
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
// Ensure profile language is en-US to prevent auto-translate
|
|
124
|
+
try {
|
|
125
|
+
await this.client.profiles().updateProfile(profileId, {
|
|
126
|
+
fingerprint: { language: 'en-US' },
|
|
127
|
+
});
|
|
128
|
+
} catch (err) {
|
|
129
|
+
console.warn(`[nst] Could not update profile language:`, err.message);
|
|
130
|
+
}
|
|
131
|
+
|
|
122
132
|
// Set proxy before launch
|
|
123
133
|
if (options.proxy) {
|
|
124
134
|
await this.setProxy(profileId, options.proxy);
|
|
@@ -129,11 +139,15 @@ class NstManager {
|
|
|
129
139
|
autoClose: false,
|
|
130
140
|
};
|
|
131
141
|
|
|
142
|
+
// Disable Chrome auto-translate
|
|
143
|
+
connectConfig.args = {
|
|
144
|
+
'--lang': 'en-US',
|
|
145
|
+
'--disable-features': 'Translate',
|
|
146
|
+
};
|
|
147
|
+
|
|
132
148
|
if (options.extensionPath) {
|
|
133
|
-
connectConfig.args =
|
|
134
|
-
|
|
135
|
-
'--disable-extensions-except': options.extensionPath,
|
|
136
|
-
};
|
|
149
|
+
connectConfig.args['--load-extension'] = options.extensionPath;
|
|
150
|
+
connectConfig.args['--disable-extensions-except'] = options.extensionPath;
|
|
137
151
|
console.log(`[nst] Loading extension: ${options.extensionPath}`);
|
|
138
152
|
}
|
|
139
153
|
|