channel-worker 1.0.7 → 1.0.8

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.
@@ -46,15 +46,11 @@ class CommandPoller {
46
46
  case 'close_profile':
47
47
  await this.handleCloseProfile(command);
48
48
  break;
49
- case 'scan_facebook_pages':
50
- await this.handleScanFacebookPages(command);
51
- break;
52
- case 'verify_logins':
53
- await this.handleVerifyLogins(command);
54
- break;
55
49
  default:
56
- console.warn(`[commands] Unknown command type: ${command.type}`);
57
- await this.api.updateCommand(command._id, { status: 'failed', error: 'Unknown command type' });
50
+ // Other commands (scan_facebook_pages, etc.) handled by extension
51
+ console.log(`[commands] Skipping ${command.type} handled by extension`);
52
+ // Reset to pending so extension can pick it up
53
+ await this.api.updateCommand(command._id, { status: 'pending' });
58
54
  }
59
55
  } catch (err) {
60
56
  if (this.config.verbose) {
@@ -105,7 +101,7 @@ class CommandPoller {
105
101
 
106
102
  async handleScanFacebookPages(command) {
107
103
  const { profile_id } = command.payload || {};
108
- console.log(`[commands] Scanning Facebook pages via profile: ${profile_id}`);
104
+ console.log(`[commands] Scan Facebook pages launching profile: ${profile_id}`);
109
105
 
110
106
  try {
111
107
  if (!this.nst) {
@@ -117,36 +113,25 @@ class CommandPoller {
117
113
  }
118
114
  }
119
115
 
120
- // Launch profile and get CDP endpoint
121
- const { profileId, wsEndpoint } = await this.nst.connectProfile(profile_id);
122
-
123
- // TODO: Use Puppeteer/Playwright to navigate facebook.com/pages and scrape page list
124
- // For now, placeholder worker needs puppeteer-core to actually scrape
125
- console.log(`[commands] Browser connected at ${wsEndpoint}`);
126
- console.log(`[commands] TODO: Navigate to facebook.com/pages and scrape page list`);
127
-
128
- // Placeholder result in real implementation, scrape pages from Facebook
129
- const pages = [];
130
- // const puppeteer = require('puppeteer-core');
131
- // const browser = await puppeteer.connect({ browserWSEndpoint: wsEndpoint });
132
- // const page = await browser.newPage();
133
- // await page.goto('https://www.facebook.com/pages/?category=your_pages');
134
- // pages = await page.evaluate(() => { /* scrape page names/urls */ });
135
-
136
- // Send results to API
137
- if (pages.length > 0) {
138
- await this.api.request('POST', '/facebook-pages/scan-result', {
139
- pages,
140
- scanned_from_profile: profile_id,
141
- });
142
- }
116
+ // Launch profile
117
+ const extensionPath = this.config.extension_path || '';
118
+ await this.nst.launchProfile(profile_id, { extensionPath });
119
+
120
+ // Create a NEW command for extension to pick up (separate from worker command)
121
+ await this.api.request('POST', '/workers/commands', {
122
+ worker_id: this.config.worker_id,
123
+ type: 'scan_facebook_pages',
124
+ payload: { profile_id, channel_id: command.payload?.channel_id },
125
+ status: 'pending',
126
+ });
143
127
 
128
+ // Mark worker command as done
144
129
  await this.api.updateCommand(command._id, {
145
130
  status: 'done',
146
- result: { profile_id: profileId, pages_found: pages.length },
131
+ result: { profile_id, message: 'Profile launched, extension command created' },
147
132
  });
148
133
 
149
- console.log(`[commands] Facebook scan complete ${pages.length} pages found`);
134
+ console.log(`[commands] Profile launchedextension will execute scan`);
150
135
  } catch (err) {
151
136
  console.error(`[commands] Facebook scan failed: ${err.message}`);
152
137
  await this.api.updateCommand(command._id, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
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": {