matterbridge 3.0.1-dev-20250501-4f463f9 → 3.0.1-dev-20250502-f374923

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.
@@ -5,7 +5,7 @@ import EventEmitter from 'node:events';
5
5
  import { inspect } from 'node:util';
6
6
  import { AnsiLogger, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, BRIGHT, RESET, er, nf, rs, wr, RED, GREEN, zb, CYAN } from './logger/export.js';
7
7
  import { NodeStorageManager } from './storage/export.js';
8
- import { getParameter, getIntParameter, hasParameter, copyDirectory, withTimeout, waiter } from './utils/export.js';
8
+ import { getParameter, getIntParameter, hasParameter, copyDirectory, withTimeout, waiter, isValidString, parseVersionString } from './utils/export.js';
9
9
  import { logInterfaces, getGlobalNodeModules } from './utils/network.js';
10
10
  import { PluginManager } from './pluginManager.js';
11
11
  import { DeviceManager } from './deviceManager.js';
@@ -369,6 +369,7 @@ export class Matterbridge extends EventEmitter {
369
369
  if (!availableInterfaces.includes(this.mdnsInterface)) {
370
370
  this.log.error(`Invalid mdnsInterface: ${this.mdnsInterface}. Available interfaces are: ${availableInterfaces.join(', ')}. Using all available interfaces.`);
371
371
  this.mdnsInterface = undefined;
372
+ await this.nodeContext.remove('mattermdnsinterface');
372
373
  }
373
374
  else {
374
375
  this.log.info(`Using mdnsInterface ${CYAN}${this.mdnsInterface}${nf} for the Matter MdnsBroadcaster.`);
@@ -396,6 +397,7 @@ export class Matterbridge extends EventEmitter {
396
397
  if (!isValid) {
397
398
  this.log.error(`Invalid ipv4address: ${this.ipv4address}. Using all available addresses.`);
398
399
  this.ipv4address = undefined;
400
+ await this.nodeContext.remove('matteripv4address');
399
401
  }
400
402
  }
401
403
  if (hasParameter('ipv6address')) {
@@ -423,6 +425,7 @@ export class Matterbridge extends EventEmitter {
423
425
  if (!isValid) {
424
426
  this.log.error(`Invalid ipv6address: ${this.ipv6address}. Using all available addresses.`);
425
427
  this.ipv6address = undefined;
428
+ await this.nodeContext.remove('matteripv6address');
426
429
  }
427
430
  }
428
431
  this.plugins = new PluginManager(this);
@@ -1403,10 +1406,10 @@ export class Matterbridge extends EventEmitter {
1403
1406
  await storageContext.set('productLabel', productName.slice(0, 32));
1404
1407
  await storageContext.set('serialNumber', await storageContext.get('serialNumber', serialNumber ? serialNumber.slice(0, 32) : 'SN' + random));
1405
1408
  await storageContext.set('uniqueId', await storageContext.get('uniqueId', 'UI' + random));
1406
- await storageContext.set('softwareVersion', this.matterbridgeVersion !== '' && this.matterbridgeVersion.includes('.') ? parseInt(this.matterbridgeVersion.split('.')[0], 10) : 1);
1407
- await storageContext.set('softwareVersionString', this.matterbridgeVersion !== '' ? this.matterbridgeVersion : '1.0.0');
1408
- await storageContext.set('hardwareVersion', this.systemInformation.osRelease !== '' && this.systemInformation.osRelease.includes('.') ? parseInt(this.systemInformation.osRelease.split('.')[0], 10) : 1);
1409
- await storageContext.set('hardwareVersionString', this.systemInformation.osRelease !== '' ? this.systemInformation.osRelease : '1.0.0');
1409
+ await storageContext.set('softwareVersion', parseVersionString(this.matterbridgeVersion) || 1);
1410
+ await storageContext.set('softwareVersionString', isValidString(this.matterbridgeVersion, 5) ? this.matterbridgeVersion : '1.0.0');
1411
+ await storageContext.set('hardwareVersion', parseVersionString(this.systemInformation.osRelease) || 1);
1412
+ await storageContext.set('hardwareVersionString', isValidString(this.systemInformation.osRelease, 5) ? this.systemInformation.osRelease : '1.0.0');
1410
1413
  this.log.debug(`Created server node storage context "${pluginName}.persist" for ${pluginName}:`);
1411
1414
  this.log.debug(`- storeId: ${await storageContext.get('storeId')}`);
1412
1415
  this.log.debug(`- deviceName: ${await storageContext.get('deviceName')}`);
@@ -48,3 +48,19 @@ export function isValidNull(value) {
48
48
  export function isValidUndefined(value) {
49
49
  return value === undefined;
50
50
  }
51
+ export function parseVersionString(versionString) {
52
+ if (!isValidString(versionString))
53
+ return undefined;
54
+ versionString = versionString.trim();
55
+ const match = versionString.match(/^(\d+)\.(\d+)\.(\d+)/);
56
+ if (!match)
57
+ return undefined;
58
+ const [, majorStr, minorStr, patchStr] = match;
59
+ const major = parseInt(majorStr, 10);
60
+ const minor = parseInt(minorStr, 10);
61
+ const patch = parseInt(patchStr, 10);
62
+ if ([major, minor, patch].some((n) => !Number.isFinite(n)) || major > 99 || minor > 99 || patch > 99) {
63
+ return undefined;
64
+ }
65
+ return major * 10000 + minor * 100 + patch;
66
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.944b63c3.css",
4
- "main.js": "./static/js/main.356788d7.js",
4
+ "main.js": "./static/js/main.53d64feb.js",
5
5
  "static/js/453.d855a71b.chunk.js": "./static/js/453.d855a71b.chunk.js",
6
6
  "static/media/roboto-latin-700-normal.woff2": "./static/media/roboto-latin-700-normal.c4d6cab43bec89049809.woff2",
7
7
  "static/media/roboto-latin-500-normal.woff2": "./static/media/roboto-latin-500-normal.599f66a60bdf974e578e.woff2",
@@ -77,11 +77,11 @@
77
77
  "static/media/roboto-greek-ext-300-normal.woff": "./static/media/roboto-greek-ext-300-normal.60729cafbded24073dfb.woff",
78
78
  "index.html": "./index.html",
79
79
  "main.944b63c3.css.map": "./static/css/main.944b63c3.css.map",
80
- "main.356788d7.js.map": "./static/js/main.356788d7.js.map",
80
+ "main.53d64feb.js.map": "./static/js/main.53d64feb.js.map",
81
81
  "453.d855a71b.chunk.js.map": "./static/js/453.d855a71b.chunk.js.map"
82
82
  },
83
83
  "entrypoints": [
84
84
  "static/css/main.944b63c3.css",
85
- "static/js/main.356788d7.js"
85
+ "static/js/main.53d64feb.js"
86
86
  ]
87
87
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.356788d7.js"></script><link href="./static/css/main.944b63c3.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.53d64feb.js"></script><link href="./static/css/main.944b63c3.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>