mb-service-linux 2.0.2-dev-20260702-75c365b → 2.0.3-dev-20260704-e589e6d

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/CHANGELOG.md CHANGED
@@ -24,13 +24,27 @@ If you like this project and find it useful, please consider giving it a star on
24
24
 
25
25
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
26
26
 
27
- ## [2.0.2] - Dev branch
27
+ ## [2.0.3] - Dev branch
28
28
 
29
29
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
30
30
 
31
- ## [2.0.1] - 2026-07-01
31
+ ## [2.0.2] - 2026-07-04
32
32
 
33
- - [help]: Update usage instructions in help output to include additional commands.
33
+ ### Added
34
+
35
+ - [service]: Create the Matterbridge directories (~/Matterbridge, ~/.matterbridge, ~/.mattercert) on create and change their ownership to the service user.
36
+ - [service]: Add SyslogIdentifier to the service file.
37
+
38
+ ### Changed
39
+
40
+ - [service]: Set WorkingDirectory to the Matterbridge directory in the home of the service user.
41
+ - [service]: Send stdout and stderr to the journal in the service file.
42
+ - [package]: Update dependencies.
43
+ - [package]: Upgrade package.
44
+
45
+ <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
46
+
47
+ ## [2.0.1] - 2026-07-01
34
48
 
35
49
  ### Added
36
50
 
@@ -38,6 +52,10 @@ If you like this project and find it useful, please consider giving it a star on
38
52
  - [service]: Add Environment PATH to the service file.
39
53
  - [service]: Add network-online.target to the service file.
40
54
 
55
+ ### Changed
56
+
57
+ - [help]: Update usage instructions in help output to include additional commands.
58
+
41
59
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
42
60
 
43
61
  ## [2.0.0] - 2026-07-01
package/dist/module.js CHANGED
@@ -41,6 +41,9 @@ function getServicePath(root) {
41
41
  function getUserServiceDirectory() {
42
42
  return `${process.env.HOME}/.config/systemd/user`;
43
43
  }
44
+ function getUserHomeDirectory(user) {
45
+ return user === 'root' ? '/root' : `/home/${user}`;
46
+ }
44
47
  function getDiagnosticUser() {
45
48
  return process.env.SUDO_USER ?? process.env.USER ?? 'unknown';
46
49
  }
@@ -190,6 +193,11 @@ function printHelp() {
190
193
  }
191
194
  function createServiceConfig(root) {
192
195
  const user = process.env.SUDO_USER || process.env.USER;
196
+ if (!user) {
197
+ console.error('Could not determine the user to run the service. Please set SUDO_USER or USER environment variable.');
198
+ return;
199
+ }
200
+ const home = getUserHomeDirectory(user);
193
201
  const rootConfig = `[Unit]\n` +
194
202
  `Description=matterbridge\n` +
195
203
  `After=network-online.target\n` +
@@ -202,10 +210,11 @@ function createServiceConfig(root) {
202
210
  `# PATH for any child process Matterbridge/plugins spawn (bun/node/npm lookups).\n` +
203
211
  `Environment="PATH=/usr/local/bin:/usr/bin:/bin"\n` +
204
212
  `ExecStart=matterbridge --service\n` +
205
- `WorkingDirectory=%h\n` +
213
+ `WorkingDirectory=${home}/Matterbridge\n` +
206
214
  `# Logs go to the journal (should be persistent). Read with: journalctl -u matterbridge -n 1000 -f --output cat\n` +
207
- `StandardOutput=inherit\n` +
208
- `StandardError=inherit\n` +
215
+ `StandardOutput=journal\n` +
216
+ `StandardError=journal\n` +
217
+ `SyslogIdentifier=matterbridge\n` +
209
218
  `Restart=always\n` +
210
219
  `RestartSec=5\n` +
211
220
  `TimeoutStopSec=60\n` +
@@ -229,10 +238,11 @@ function createServiceConfig(root) {
229
238
  `# --bun forces the Bun runtime even though the matterbridge bin has a node shebang,\n` +
230
239
  `# and shims any \`node\` the process spawns to Bun as well.\n` +
231
240
  (isBun() ? `ExecStart=%h/.bun/bin/bun --bun %h/.bun/bin/matterbridge --service\n` : `ExecStart=matterbridge --service\n`) +
232
- `WorkingDirectory=%h\n` +
241
+ `WorkingDirectory=${home}/Matterbridge\n` +
233
242
  `# Logs go to the journal (should be persistent). Read with: journalctl --user -u matterbridge -n 1000 -f --output cat\n` +
234
- `StandardOutput=inherit\n` +
235
- `StandardError=inherit\n` +
243
+ `StandardOutput=journal\n` +
244
+ `StandardError=journal\n` +
245
+ `SyslogIdentifier=matterbridge\n` +
236
246
  `Restart=always\n` +
237
247
  `RestartSec=5\n` +
238
248
  `TimeoutStopSec=60\n` +
@@ -240,14 +250,26 @@ function createServiceConfig(root) {
240
250
  `[Install]\n` +
241
251
  `WantedBy=default.target\n`;
242
252
  const servicePath = getServicePath(root);
243
- if (!user) {
244
- console.error('Could not determine the user to run the service. Please set SUDO_USER or USER environment variable.');
245
- return;
246
- }
247
253
  if (existsSync(servicePath)) {
248
254
  console.log(`Service configuration already exists at ${servicePath}. No changes made.`);
249
255
  return;
250
256
  }
257
+ const matterbridgeDirectories = [`${home}/Matterbridge`, `${home}/.matterbridge`, `${home}/.mattercert`];
258
+ try {
259
+ for (const directory of matterbridgeDirectories) {
260
+ mkdirSync(directory, { recursive: true });
261
+ }
262
+ if (root) {
263
+ const chown = spawnSync('chown', ['-R', `${user}:${user}`, ...matterbridgeDirectories], { stdio: 'inherit' });
264
+ if (chown.error) {
265
+ console.error('Failed to change the ownership of the Matterbridge directories:', chown.error.message);
266
+ }
267
+ }
268
+ }
269
+ catch (err) {
270
+ console.error(`Failed to create the Matterbridge directories: ${String(err)}`);
271
+ process.exit(1);
272
+ }
251
273
  try {
252
274
  if (!root) {
253
275
  mkdirSync(getUserServiceDirectory(), { recursive: true });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "mb-service-linux",
3
- "version": "2.0.2-dev-20260702-75c365b",
3
+ "version": "2.0.3-dev-20260704-e589e6d",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "mb-service-linux",
9
- "version": "2.0.2-dev-20260702-75c365b",
9
+ "version": "2.0.3-dev-20260704-e589e6d",
10
10
  "license": "Apache-2.0",
11
11
  "bin": {
12
12
  "mb-service": "bin/mb-service"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mb-service-linux",
3
- "version": "2.0.2-dev-20260702-75c365b",
3
+ "version": "2.0.3-dev-20260704-e589e6d",
4
4
  "description": "Matterbridge service command line interface",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",