channel-worker 1.0.12 → 1.0.13

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.
@@ -84,11 +84,22 @@ 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${proxy ? ' (proxy: ' + proxy + ')' : ''}${extensionPath ? ' (ext: ' + extensionPath + ')' : ''}`);
87
+ console.log(`[commands] Profile ${profile_id} launched${result.profileName ? ' (name: ' + result.profileName + ')' : ''}${extensionPath ? ' (ext)' : ''}`);
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
+ }
88
99
 
89
100
  await this.api.updateCommand(command._id, {
90
101
  status: 'done',
91
- result: { profile_id: result.profileId, launched_at: new Date().toISOString(), proxy: proxy || null },
102
+ result: { profile_id: result.profileId, profile_name: result.profileName, launched_at: new Date().toISOString() },
92
103
  });
93
104
  } catch (err) {
94
105
  console.error(`[commands] Failed to launch profile: ${err.message}`);
@@ -90,6 +90,18 @@ 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
+
93
105
  // Set proxy on profile
94
106
  async setProxy(profileId, proxyUrl) {
95
107
  if (!proxyUrl) return;
@@ -140,7 +152,16 @@ class NstManager {
140
152
  if (res.err) throw new Error(res.msg || 'Failed to connect browser');
141
153
 
142
154
  console.log(`[nst] Browser started`);
143
- return { profileId, wsEndpoint: res?.data?.webSocketDebuggerUrl, response: res };
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
+ };
144
165
  }
145
166
 
146
167
  // Stop browser
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
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": {