channel-worker 1.0.13 → 1.0.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/command-poller.js +2 -13
- package/lib/nst-manager.js +1 -22
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -84,22 +84,11 @@ class CommandPoller {
|
|
|
84
84
|
|
|
85
85
|
const extensionPath = this.config.extension_path || '';
|
|
86
86
|
const result = await this.nst.launchProfile(profile_id, { proxy, extensionPath });
|
|
87
|
-
console.log(`[commands] Profile ${profile_id} launched${
|
|
88
|
-
|
|
89
|
-
// Sync profile name + UUID back to dashboard
|
|
90
|
-
if (channel_id && (result.profileName || result.profileId)) {
|
|
91
|
-
try {
|
|
92
|
-
const update = {};
|
|
93
|
-
if (result.profileName) update.nst_profile_name = result.profileName;
|
|
94
|
-
if (result.profileId) update.nst_profile_uuid = result.profileId;
|
|
95
|
-
await this.api.request('PUT', `/channels/${channel_id}`, update);
|
|
96
|
-
console.log(`[commands] Synced profile info to channel: name=${result.profileName}, uuid=${result.profileId}`);
|
|
97
|
-
} catch { /* ignore sync errors */ }
|
|
98
|
-
}
|
|
87
|
+
console.log(`[commands] Profile ${profile_id} launched${extensionPath ? ' (ext)' : ''}`);
|
|
99
88
|
|
|
100
89
|
await this.api.updateCommand(command._id, {
|
|
101
90
|
status: 'done',
|
|
102
|
-
result: { profile_id: result.profileId,
|
|
91
|
+
result: { profile_id: result.profileId, launched_at: new Date().toISOString() },
|
|
103
92
|
});
|
|
104
93
|
} catch (err) {
|
|
105
94
|
console.error(`[commands] Failed to launch profile: ${err.message}`);
|
package/lib/nst-manager.js
CHANGED
|
@@ -90,18 +90,6 @@ class NstManager {
|
|
|
90
90
|
return profileId;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
// Get profile info by ID (name, etc.)
|
|
94
|
-
async getProfileInfo(profileId) {
|
|
95
|
-
try {
|
|
96
|
-
const res = await this.client.profiles().getProfiles({ s: profileId });
|
|
97
|
-
const profiles = res?.data?.docs || [];
|
|
98
|
-
const match = profiles.find(p => p.profileId === profileId);
|
|
99
|
-
return match || null;
|
|
100
|
-
} catch {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
93
|
// Set proxy on profile
|
|
106
94
|
async setProxy(profileId, proxyUrl) {
|
|
107
95
|
if (!proxyUrl) return;
|
|
@@ -152,16 +140,7 @@ class NstManager {
|
|
|
152
140
|
if (res.err) throw new Error(res.msg || 'Failed to connect browser');
|
|
153
141
|
|
|
154
142
|
console.log(`[nst] Browser started`);
|
|
155
|
-
|
|
156
|
-
// Get profile info (name) for sync back to dashboard
|
|
157
|
-
const profileInfo = await this.getProfileInfo(profileId);
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
profileId,
|
|
161
|
-
profileName: profileInfo?.name || null,
|
|
162
|
-
wsEndpoint: res?.data?.webSocketDebuggerUrl,
|
|
163
|
-
response: res,
|
|
164
|
-
};
|
|
143
|
+
return { profileId, wsEndpoint: res?.data?.webSocketDebuggerUrl, response: res };
|
|
165
144
|
}
|
|
166
145
|
|
|
167
146
|
// Stop browser
|