channel-worker 2.0.2 → 2.0.3

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.
@@ -334,6 +334,19 @@ class CommandPoller {
334
334
  else if (fs.statSync(src).isDirectory()) fs.cpSync(src, dest, { recursive: true });
335
335
  }
336
336
  console.log(`[commands] CC extension downloaded to ${extPath}`);
337
+
338
+ // Close running profiles so they reload with new extension on next launch
339
+ if (this.nst) {
340
+ try {
341
+ const running = await this.nst.getRunningBrowsers();
342
+ if (running.length > 0) {
343
+ console.log(`[commands] Closing ${running.length} running profiles to reload extension...`);
344
+ for (const b of running) {
345
+ try { await this.nst.stopProfile(b.profileId); } catch {}
346
+ }
347
+ }
348
+ } catch {}
349
+ }
337
350
  } finally {
338
351
  try { fs.unlinkSync(tmpArchive); } catch {}
339
352
  try { fs.rmSync(tmpExtract, { recursive: true, force: true }); } catch {}
@@ -1170,11 +1183,20 @@ class CommandPoller {
1170
1183
  const baseExtPath = this.config.content_creator_ext_path || defaultCCExtPath;
1171
1184
  await this._ensureContentCreatorExt(baseExtPath);
1172
1185
 
1173
- // Create unique ext dir per profile
1186
+ // Create unique ext dir per profile + version (forces Chromium to reload SW)
1174
1187
  let extensionPath = baseExtPath;
1175
1188
  const fs = require('fs');
1176
- const uniqueExtPath = baseExtPath + '-' + target.nst_profile_id;
1189
+ const extVersion = (() => { try { return JSON.parse(fs.readFileSync(path.join(baseExtPath, 'manifest.json'), 'utf8')).version; } catch { return '0'; } })();
1190
+ const uniqueExtPath = baseExtPath + '-' + target.nst_profile_id + '-v' + extVersion;
1177
1191
  try {
1192
+ // Clean old version dirs for this profile
1193
+ const parent = path.dirname(baseExtPath);
1194
+ const prefix = path.basename(baseExtPath) + '-' + target.nst_profile_id;
1195
+ try {
1196
+ fs.readdirSync(parent)
1197
+ .filter(d => d.startsWith(prefix) && d !== path.basename(uniqueExtPath))
1198
+ .forEach(d => { try { fs.rmSync(path.join(parent, d), { recursive: true }); } catch {} });
1199
+ } catch {}
1178
1200
  if (fs.existsSync(uniqueExtPath)) fs.rmSync(uniqueExtPath, { recursive: true });
1179
1201
  fs.mkdirSync(uniqueExtPath, { recursive: true });
1180
1202
  fs.cpSync(baseExtPath, uniqueExtPath, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
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": {