@matterbridge/core 3.10.14-dev-20261014-ce817f8 → 3.10.14-dev-20261014-dcbcee7

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.
@@ -77,7 +77,7 @@ function getWindowsCommandCandidates() {
77
77
  return candidates;
78
78
  }
79
79
  function resolveFfmpeg() {
80
- const candidates = ['ffmpeg', '/usr/bin/ffmpeg', '/bin/ffmpeg', '/usr/local/bin/ffmpeg', ...getWindowsCommandCandidates()];
80
+ const candidates = ['ffmpeg', '/usr/bin/ffmpeg', '/bin/ffmpeg', '/usr/local/bin/ffmpeg', '/opt/homebrew/bin/ffmpeg', ...getWindowsCommandCandidates()];
81
81
  log.debug(`Resolving ffmpeg: trying ${candidates.length} candidate(s)`);
82
82
  for (const candidate of candidates) {
83
83
  if (path.isAbsolute(candidate)) {
@@ -200,22 +200,31 @@ export function playWebcam(videoSource, audioSource) {
200
200
  log.debug(`Spawning ffplay: ${ffplayCommand} ${args.map(redactSource).join(' ')}`);
201
201
  return spawn(ffplayCommand, args);
202
202
  }
203
+ async function runPrivileged(asRoot, command, args) {
204
+ await (asRoot ? runCommand(command, args) : runCommand('sudo', ['-n', command, ...args]));
205
+ }
203
206
  export async function installFfmpeg() {
204
207
  if (process.platform !== 'linux') {
205
208
  log.warn(`Cannot install ffmpeg: unsupported platform ${process.platform}`);
206
209
  return false;
207
210
  }
208
- if (process.getuid?.() !== 0) {
209
- log.warn('Cannot install ffmpeg: root privileges are required');
210
- return false;
211
+ const isRoot = process.getuid?.() === 0;
212
+ if (!isRoot) {
213
+ try {
214
+ runProbe('sudo', ['-n', 'true']);
215
+ }
216
+ catch {
217
+ log.warn('Cannot install ffmpeg: root privileges or passwordless sudo are required');
218
+ return false;
219
+ }
211
220
  }
212
221
  try {
213
222
  if (isRunnable('apk')) {
214
- await runCommand('apk', ['add', '--no-cache', 'ffmpeg']);
223
+ await runPrivileged(isRoot, 'apk', ['add', '--no-cache', 'ffmpeg']);
215
224
  }
216
225
  else if (isRunnable('apt-get')) {
217
- await runCommand('apt-get', ['update']);
218
- await runCommand('env', ['DEBIAN_FRONTEND=noninteractive', 'apt-get', 'install', '-y', '--no-install-recommends', 'ffmpeg']);
226
+ await runPrivileged(isRoot, 'apt-get', ['update']);
227
+ await runPrivileged(isRoot, 'env', ['DEBIAN_FRONTEND=noninteractive', 'apt-get', 'install', '-y', '--no-install-recommends', 'ffmpeg']);
219
228
  }
220
229
  else {
221
230
  log.warn('Cannot install ffmpeg: no supported package manager found (apk, apt-get)');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/core",
3
- "version": "3.10.14-dev-20261014-ce817f8",
3
+ "version": "3.10.14-dev-20261014-dcbcee7",
4
4
  "description": "Matterbridge core library",
5
5
  "author": "https://github.com/Luligu",
6
6
  "homepage": "https://matterbridge.io/",
@@ -136,10 +136,10 @@
136
136
  },
137
137
  "dependencies": {
138
138
  "@matter/main": "0.17.9",
139
- "@matterbridge/dgram": "3.10.14-dev-20261014-ce817f8",
140
- "@matterbridge/thread": "3.10.14-dev-20261014-ce817f8",
141
- "@matterbridge/types": "3.10.14-dev-20261014-ce817f8",
142
- "@matterbridge/utils": "3.10.14-dev-20261014-ce817f8",
139
+ "@matterbridge/dgram": "3.10.14-dev-20261014-dcbcee7",
140
+ "@matterbridge/thread": "3.10.14-dev-20261014-dcbcee7",
141
+ "@matterbridge/types": "3.10.14-dev-20261014-dcbcee7",
142
+ "@matterbridge/utils": "3.10.14-dev-20261014-dcbcee7",
143
143
  "escape-html": "1.0.3",
144
144
  "express": "5.2.1",
145
145
  "express-rate-limit": "8.7.1",