matterbridge 3.3.0-dev-20251003-626ea2f → 3.3.0-dev-20251004-43d8106
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/dist/frontend.js +36 -35
- package/dist/matterbridge.js +13 -17
- package/dist/matterbridgeTypes.js +4 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/frontend.js
CHANGED
|
@@ -14,7 +14,7 @@ import { BridgedDeviceBasicInformation, PowerSource } from '@matter/main/cluster
|
|
|
14
14
|
import { DeviceAdvertiser, DeviceCommissioner, FabricManager } from '@matter/main/protocol';
|
|
15
15
|
import { CommissioningOptions } from '@matter/main/types';
|
|
16
16
|
import { createZip, isValidArray, isValidNumber, isValidObject, isValidString, isValidBoolean, withTimeout, hasParameter, wait, inspectError } from './utils/export.js';
|
|
17
|
-
import { plg } from './matterbridgeTypes.js';
|
|
17
|
+
import { MATTER_LOGGER_FILE, MATTER_STORAGE_NAME, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg, } from './matterbridgeTypes.js';
|
|
18
18
|
import { capitalizeFirstLetter, getAttribute } from './matterbridgeEndpointHelpers.js';
|
|
19
19
|
import { cliEmitter, lastCpuUsage } from './cliEmitter.js';
|
|
20
20
|
export class Frontend extends EventEmitter {
|
|
@@ -304,13 +304,14 @@ export class Frontend extends EventEmitter {
|
|
|
304
304
|
space_available_size: this.formatMemoryUsage(space.space_available_size),
|
|
305
305
|
physical_space_size: this.formatMemoryUsage(space.physical_space_size),
|
|
306
306
|
}));
|
|
307
|
-
const {
|
|
308
|
-
const
|
|
307
|
+
const { createRequire } = await import('node:module');
|
|
308
|
+
const require = createRequire(import.meta.url);
|
|
309
|
+
const cjsModules = Object.keys(require.cache).sort();
|
|
309
310
|
const memoryReport = {
|
|
310
311
|
memoryUsage,
|
|
311
312
|
heapStats,
|
|
312
313
|
heapSpaces,
|
|
313
|
-
|
|
314
|
+
cjsModules,
|
|
314
315
|
};
|
|
315
316
|
res.status(200).json(memoryReport);
|
|
316
317
|
});
|
|
@@ -324,30 +325,30 @@ export class Frontend extends EventEmitter {
|
|
|
324
325
|
});
|
|
325
326
|
this.expressApp.get('/api/devices', async (req, res) => {
|
|
326
327
|
this.log.debug('The frontend sent /api/devices');
|
|
327
|
-
const devices =
|
|
328
|
+
const devices = this.getDevices();
|
|
328
329
|
res.json(devices);
|
|
329
330
|
});
|
|
330
331
|
this.expressApp.get('/api/view-mblog', async (req, res) => {
|
|
331
332
|
this.log.debug('The frontend sent /api/view-mblog');
|
|
332
333
|
try {
|
|
333
|
-
const data = await fs.readFile(path.join(this.matterbridge.matterbridgeDirectory,
|
|
334
|
+
const data = await fs.readFile(path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), 'utf8');
|
|
334
335
|
res.type('text/plain');
|
|
335
336
|
res.send(data);
|
|
336
337
|
}
|
|
337
338
|
catch (error) {
|
|
338
|
-
this.log.error(`Error reading matterbridge log file ${
|
|
339
|
+
this.log.error(`Error reading matterbridge log file ${MATTERBRIDGE_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
339
340
|
res.status(500).send('Error reading matterbridge log file. Please enable the matterbridge log on file in the settings.');
|
|
340
341
|
}
|
|
341
342
|
});
|
|
342
343
|
this.expressApp.get('/api/view-mjlog', async (req, res) => {
|
|
343
344
|
this.log.debug('The frontend sent /api/view-mjlog');
|
|
344
345
|
try {
|
|
345
|
-
const data = await fs.readFile(path.join(this.matterbridge.matterbridgeDirectory,
|
|
346
|
+
const data = await fs.readFile(path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE), 'utf8');
|
|
346
347
|
res.type('text/plain');
|
|
347
348
|
res.send(data);
|
|
348
349
|
}
|
|
349
350
|
catch (error) {
|
|
350
|
-
this.log.error(`Error reading matter log file ${
|
|
351
|
+
this.log.error(`Error reading matter log file ${MATTER_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
351
352
|
res.status(500).send('Error reading matter log file. Please enable the matter log on file in the settings.');
|
|
352
353
|
}
|
|
353
354
|
});
|
|
@@ -393,7 +394,7 @@ export class Frontend extends EventEmitter {
|
|
|
393
394
|
res.send(data.slice(29));
|
|
394
395
|
}
|
|
395
396
|
catch (error) {
|
|
396
|
-
this.log.error(`Error reading diagnostic log file ${
|
|
397
|
+
this.log.error(`Error reading diagnostic log file ${MATTER_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
397
398
|
res.status(500).send('Error reading diagnostic log file.');
|
|
398
399
|
}
|
|
399
400
|
});
|
|
@@ -405,44 +406,44 @@ export class Frontend extends EventEmitter {
|
|
|
405
406
|
res.send(data);
|
|
406
407
|
}
|
|
407
408
|
catch (error) {
|
|
408
|
-
this.log.error(`Error reading shelly log file ${
|
|
409
|
+
this.log.error(`Error reading shelly log file ${MATTERBRIDGE_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
409
410
|
res.status(500).send('Error reading shelly log file. Please create the shelly system log before loading it.');
|
|
410
411
|
}
|
|
411
412
|
});
|
|
412
413
|
this.expressApp.get('/api/download-mblog', async (req, res) => {
|
|
413
|
-
this.log.debug(`The frontend sent /api/download-mblog ${path.join(this.matterbridge.matterbridgeDirectory,
|
|
414
|
+
this.log.debug(`The frontend sent /api/download-mblog ${path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE)}`);
|
|
414
415
|
try {
|
|
415
|
-
await fs.access(path.join(this.matterbridge.matterbridgeDirectory,
|
|
416
|
-
const data = await fs.readFile(path.join(this.matterbridge.matterbridgeDirectory,
|
|
417
|
-
await fs.writeFile(path.join(os.tmpdir(),
|
|
416
|
+
await fs.access(path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), fs.constants.F_OK);
|
|
417
|
+
const data = await fs.readFile(path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), 'utf8');
|
|
418
|
+
await fs.writeFile(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), data, 'utf-8');
|
|
418
419
|
}
|
|
419
420
|
catch (error) {
|
|
420
|
-
await fs.writeFile(path.join(os.tmpdir(),
|
|
421
|
+
await fs.writeFile(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), 'Enable the matterbridge log on file in the settings to download the matterbridge log.', 'utf-8');
|
|
421
422
|
this.log.debug(`Error in /api/download-mblog: ${error instanceof Error ? error.message : error}`);
|
|
422
423
|
}
|
|
423
424
|
res.type('text/plain');
|
|
424
|
-
res.download(path.join(os.tmpdir(),
|
|
425
|
+
res.download(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), 'matterbridge.log', (error) => {
|
|
425
426
|
if (error) {
|
|
426
|
-
this.log.error(`Error downloading log file ${
|
|
427
|
+
this.log.error(`Error downloading log file ${MATTERBRIDGE_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
427
428
|
res.status(500).send('Error downloading the matterbridge log file');
|
|
428
429
|
}
|
|
429
430
|
});
|
|
430
431
|
});
|
|
431
432
|
this.expressApp.get('/api/download-mjlog', async (req, res) => {
|
|
432
|
-
this.log.debug(`The frontend sent /api/download-mjlog ${path.join(this.matterbridge.matterbridgeDirectory,
|
|
433
|
+
this.log.debug(`The frontend sent /api/download-mjlog ${path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE)}`);
|
|
433
434
|
try {
|
|
434
|
-
await fs.access(path.join(this.matterbridge.matterbridgeDirectory,
|
|
435
|
-
const data = await fs.readFile(path.join(this.matterbridge.matterbridgeDirectory,
|
|
436
|
-
await fs.writeFile(path.join(os.tmpdir(),
|
|
435
|
+
await fs.access(path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE), fs.constants.F_OK);
|
|
436
|
+
const data = await fs.readFile(path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE), 'utf8');
|
|
437
|
+
await fs.writeFile(path.join(os.tmpdir(), MATTER_LOGGER_FILE), data, 'utf-8');
|
|
437
438
|
}
|
|
438
439
|
catch (error) {
|
|
439
|
-
await fs.writeFile(path.join(os.tmpdir(),
|
|
440
|
+
await fs.writeFile(path.join(os.tmpdir(), MATTER_LOGGER_FILE), 'Enable the matter log on file in the settings to download the matter log.', 'utf-8');
|
|
440
441
|
this.log.debug(`Error in /api/download-mblog: ${error instanceof Error ? error.message : error}`);
|
|
441
442
|
}
|
|
442
443
|
res.type('text/plain');
|
|
443
|
-
res.download(path.join(os.tmpdir(),
|
|
444
|
+
res.download(path.join(os.tmpdir(), MATTER_LOGGER_FILE), 'matter.log', (error) => {
|
|
444
445
|
if (error) {
|
|
445
|
-
this.log.error(`Error downloading log file ${
|
|
446
|
+
this.log.error(`Error downloading log file ${MATTER_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
446
447
|
res.status(500).send('Error downloading the matter log file');
|
|
447
448
|
}
|
|
448
449
|
});
|
|
@@ -468,20 +469,20 @@ export class Frontend extends EventEmitter {
|
|
|
468
469
|
});
|
|
469
470
|
this.expressApp.get('/api/download-mbstorage', async (req, res) => {
|
|
470
471
|
this.log.debug('The frontend sent /api/download-mbstorage');
|
|
471
|
-
await createZip(path.join(os.tmpdir(), `matterbridge.${
|
|
472
|
-
res.download(path.join(os.tmpdir(), `matterbridge.${
|
|
472
|
+
await createZip(path.join(os.tmpdir(), `matterbridge.${NODE_STORAGE_DIR}.zip`), path.join(this.matterbridge.matterbridgeDirectory, NODE_STORAGE_DIR));
|
|
473
|
+
res.download(path.join(os.tmpdir(), `matterbridge.${NODE_STORAGE_DIR}.zip`), `matterbridge.${NODE_STORAGE_DIR}.zip`, (error) => {
|
|
473
474
|
if (error) {
|
|
474
|
-
this.log.error(`Error downloading file ${`matterbridge.${
|
|
475
|
+
this.log.error(`Error downloading file ${`matterbridge.${NODE_STORAGE_DIR}.zip`}: ${error instanceof Error ? error.message : error}`);
|
|
475
476
|
res.status(500).send('Error downloading the matterbridge storage file');
|
|
476
477
|
}
|
|
477
478
|
});
|
|
478
479
|
});
|
|
479
480
|
this.expressApp.get('/api/download-mjstorage', async (req, res) => {
|
|
480
481
|
this.log.debug('The frontend sent /api/download-mjstorage');
|
|
481
|
-
await createZip(path.join(os.tmpdir(), `matterbridge.${
|
|
482
|
-
res.download(path.join(os.tmpdir(), `matterbridge.${
|
|
482
|
+
await createZip(path.join(os.tmpdir(), `matterbridge.${MATTER_STORAGE_NAME}.zip`), path.join(this.matterbridge.matterbridgeDirectory, MATTER_STORAGE_NAME));
|
|
483
|
+
res.download(path.join(os.tmpdir(), `matterbridge.${MATTER_STORAGE_NAME}.zip`), `matterbridge.${MATTER_STORAGE_NAME}.zip`, (error) => {
|
|
483
484
|
if (error) {
|
|
484
|
-
this.log.error(`Error downloading the matter storage matterbridge.${
|
|
485
|
+
this.log.error(`Error downloading the matter storage matterbridge.${MATTER_STORAGE_NAME}.zip: ${error instanceof Error ? error.message : error}`);
|
|
485
486
|
res.status(500).send('Error downloading the matter storage zip file');
|
|
486
487
|
}
|
|
487
488
|
});
|
|
@@ -835,7 +836,7 @@ export class Frontend extends EventEmitter {
|
|
|
835
836
|
}
|
|
836
837
|
return baseRegisteredPlugins;
|
|
837
838
|
}
|
|
838
|
-
|
|
839
|
+
getDevices(pluginName) {
|
|
839
840
|
if (this.matterbridge.hasCleanupStarted)
|
|
840
841
|
return [];
|
|
841
842
|
const devices = [];
|
|
@@ -1336,7 +1337,7 @@ export class Frontend extends EventEmitter {
|
|
|
1336
1337
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true, response: plugins });
|
|
1337
1338
|
}
|
|
1338
1339
|
else if (data.method === '/api/devices') {
|
|
1339
|
-
const devices =
|
|
1340
|
+
const devices = this.getDevices(isValidString(data.params.pluginName) ? data.params.pluginName : undefined);
|
|
1340
1341
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true, response: devices });
|
|
1341
1342
|
}
|
|
1342
1343
|
else if (data.method === '/api/clusters') {
|
|
@@ -1463,7 +1464,7 @@ export class Frontend extends EventEmitter {
|
|
|
1463
1464
|
this.matterbridge.matterbridgeInformation.fileLogger = data.params.value;
|
|
1464
1465
|
await this.matterbridge.nodeContext?.set('matterbridgeFileLog', data.params.value);
|
|
1465
1466
|
if (data.params.value)
|
|
1466
|
-
AnsiLogger.setGlobalLogfile(path.join(this.matterbridge.matterbridgeDirectory,
|
|
1467
|
+
AnsiLogger.setGlobalLogfile(path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), this.matterbridge.matterbridgeInformation.loggerLevel, true);
|
|
1467
1468
|
else
|
|
1468
1469
|
AnsiLogger.setGlobalLogfile(undefined);
|
|
1469
1470
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
@@ -1501,7 +1502,7 @@ export class Frontend extends EventEmitter {
|
|
|
1501
1502
|
this.matterbridge.matterbridgeInformation.matterFileLogger = data.params.value;
|
|
1502
1503
|
await this.matterbridge.nodeContext?.set('matterFileLog', data.params.value);
|
|
1503
1504
|
if (data.params.value) {
|
|
1504
|
-
this.matterbridge.matterLog.logFilePath = path.join(this.matterbridge.matterbridgeDirectory,
|
|
1505
|
+
this.matterbridge.matterLog.logFilePath = path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE);
|
|
1505
1506
|
}
|
|
1506
1507
|
else {
|
|
1507
1508
|
this.matterbridge.matterLog.logFilePath = undefined;
|
package/dist/matterbridge.js
CHANGED
|
@@ -11,7 +11,7 @@ import { AggregatorEndpoint } from '@matter/main/endpoints';
|
|
|
11
11
|
import { BasicInformationServer } from '@matter/main/behaviors/basic-information';
|
|
12
12
|
import { getParameter, getIntParameter, hasParameter, copyDirectory, isValidString, parseVersionString, isValidNumber, createDirectory } from './utils/export.js';
|
|
13
13
|
import { withTimeout, waiter, wait } from './utils/wait.js';
|
|
14
|
-
import { dev, plg, typ } from './matterbridgeTypes.js';
|
|
14
|
+
import { dev, MATTER_LOGGER_FILE, MATTER_STORAGE_NAME, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg, typ, } from './matterbridgeTypes.js';
|
|
15
15
|
import { PluginManager } from './pluginManager.js';
|
|
16
16
|
import { DeviceManager } from './deviceManager.js';
|
|
17
17
|
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
@@ -87,13 +87,10 @@ export class Matterbridge extends EventEmitter {
|
|
|
87
87
|
shutdown = false;
|
|
88
88
|
failCountLimit = hasParameter('shelly') ? 600 : 120;
|
|
89
89
|
log = new AnsiLogger({ logName: 'Matterbridge', logTimestampFormat: 4, logLevel: hasParameter('debug') ? "debug" : "info" });
|
|
90
|
-
matterbridgeLoggerFile = 'matterbridge.log';
|
|
91
90
|
matterLog = new AnsiLogger({ logName: 'Matter', logTimestampFormat: 4, logLevel: "debug" });
|
|
92
|
-
matterLoggerFile = 'matter.log';
|
|
93
91
|
plugins = new PluginManager(this);
|
|
94
92
|
devices = new DeviceManager(this);
|
|
95
93
|
frontend = new Frontend(this);
|
|
96
|
-
nodeStorageName = 'storage';
|
|
97
94
|
nodeStorage;
|
|
98
95
|
nodeContext;
|
|
99
96
|
hasCleanupStarted = false;
|
|
@@ -109,7 +106,6 @@ export class Matterbridge extends EventEmitter {
|
|
|
109
106
|
exceptionHandler;
|
|
110
107
|
rejectionHandler;
|
|
111
108
|
environment = Environment.default;
|
|
112
|
-
matterStorageName = 'matterstorage';
|
|
113
109
|
matterStorageService;
|
|
114
110
|
matterStorageManager;
|
|
115
111
|
matterbridgeContext;
|
|
@@ -226,13 +222,13 @@ export class Matterbridge extends EventEmitter {
|
|
|
226
222
|
this.matterbridgeInformation.rootDirectory = this.rootDirectory;
|
|
227
223
|
this.environment.vars.set('log.level', MatterLogLevel.INFO);
|
|
228
224
|
this.environment.vars.set('log.format', MatterLogFormat.ANSI);
|
|
229
|
-
this.environment.vars.set('path.root', path.join(this.matterbridgeDirectory,
|
|
225
|
+
this.environment.vars.set('path.root', path.join(this.matterbridgeDirectory, MATTER_STORAGE_NAME));
|
|
230
226
|
this.environment.vars.set('runtime.signals', false);
|
|
231
227
|
this.environment.vars.set('runtime.exitcode', false);
|
|
232
228
|
this.registerProcessHandlers();
|
|
233
229
|
try {
|
|
234
|
-
this.log.debug(`Creating node storage manager: ${CYAN}${
|
|
235
|
-
this.nodeStorage = new NodeStorageManager({ dir: path.join(this.matterbridgeDirectory,
|
|
230
|
+
this.log.debug(`Creating node storage manager: ${CYAN}${NODE_STORAGE_DIR}${db}`);
|
|
231
|
+
this.nodeStorage = new NodeStorageManager({ dir: path.join(this.matterbridgeDirectory, NODE_STORAGE_DIR), writeQueue: false, expiredInterval: undefined, logging: false });
|
|
236
232
|
this.log.debug('Creating node storage context for matterbridge');
|
|
237
233
|
this.nodeContext = await this.nodeStorage.createStorage('matterbridge');
|
|
238
234
|
const keys = (await this.nodeStorage?.storage.keys());
|
|
@@ -251,7 +247,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
251
247
|
});
|
|
252
248
|
}
|
|
253
249
|
this.log.debug('Creating node storage backup...');
|
|
254
|
-
await copyDirectory(path.join(this.matterbridgeDirectory,
|
|
250
|
+
await copyDirectory(path.join(this.matterbridgeDirectory, NODE_STORAGE_DIR), path.join(this.matterbridgeDirectory, NODE_STORAGE_DIR + '.backup'));
|
|
255
251
|
this.log.debug('Created node storage backup');
|
|
256
252
|
}
|
|
257
253
|
catch (error) {
|
|
@@ -261,7 +257,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
261
257
|
}
|
|
262
258
|
else {
|
|
263
259
|
this.log.notice(`The matterbridge storage is corrupted. Restoring it with backup...`);
|
|
264
|
-
await copyDirectory(path.join(this.matterbridgeDirectory,
|
|
260
|
+
await copyDirectory(path.join(this.matterbridgeDirectory, NODE_STORAGE_DIR + '.backup'), path.join(this.matterbridgeDirectory, NODE_STORAGE_DIR));
|
|
265
261
|
this.log.notice(`The matterbridge storage has been restored with backup`);
|
|
266
262
|
}
|
|
267
263
|
}
|
|
@@ -359,7 +355,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
359
355
|
MatterbridgeEndpoint.logLevel = this.log.logLevel;
|
|
360
356
|
this.matterbridgeInformation.loggerLevel = this.log.logLevel;
|
|
361
357
|
if (hasParameter('filelogger') || (await this.nodeContext.get('matterbridgeFileLog', false))) {
|
|
362
|
-
AnsiLogger.setGlobalLogfile(path.join(this.matterbridgeDirectory,
|
|
358
|
+
AnsiLogger.setGlobalLogfile(path.join(this.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), this.log.logLevel, true);
|
|
363
359
|
this.matterbridgeInformation.fileLogger = true;
|
|
364
360
|
}
|
|
365
361
|
this.log.notice('Matterbridge is starting...');
|
|
@@ -908,7 +904,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
908
904
|
createDestinationMatterLogger(fileLogger) {
|
|
909
905
|
this.matterLog.logNameColor = '\x1b[34m';
|
|
910
906
|
if (fileLogger) {
|
|
911
|
-
this.matterLog.logFilePath = path.join(this.matterbridgeDirectory,
|
|
907
|
+
this.matterLog.logFilePath = path.join(this.matterbridgeDirectory, MATTER_LOGGER_FILE);
|
|
912
908
|
}
|
|
913
909
|
return (text, message) => {
|
|
914
910
|
const logger = text.slice(44, 44 + 20).trim();
|
|
@@ -1092,10 +1088,10 @@ export class Matterbridge extends EventEmitter {
|
|
|
1092
1088
|
this.devices.clear();
|
|
1093
1089
|
if (message === 'shutting down with factory reset...') {
|
|
1094
1090
|
try {
|
|
1095
|
-
const dir = path.join(this.matterbridgeDirectory,
|
|
1091
|
+
const dir = path.join(this.matterbridgeDirectory, MATTER_STORAGE_NAME);
|
|
1096
1092
|
this.log.info(`Removing matter storage directory: ${dir}`);
|
|
1097
1093
|
await fs.rm(dir, { recursive: true });
|
|
1098
|
-
const backup = path.join(this.matterbridgeDirectory,
|
|
1094
|
+
const backup = path.join(this.matterbridgeDirectory, MATTER_STORAGE_NAME + '.backup');
|
|
1099
1095
|
this.log.info(`Removing matter storage backup directory: ${backup}`);
|
|
1100
1096
|
await fs.rm(backup, { recursive: true });
|
|
1101
1097
|
}
|
|
@@ -1105,10 +1101,10 @@ export class Matterbridge extends EventEmitter {
|
|
|
1105
1101
|
}
|
|
1106
1102
|
}
|
|
1107
1103
|
try {
|
|
1108
|
-
const dir = path.join(this.matterbridgeDirectory,
|
|
1104
|
+
const dir = path.join(this.matterbridgeDirectory, NODE_STORAGE_DIR);
|
|
1109
1105
|
this.log.info(`Removing matterbridge storage directory: ${dir}`);
|
|
1110
1106
|
await fs.rm(dir, { recursive: true });
|
|
1111
|
-
const backup = path.join(this.matterbridgeDirectory,
|
|
1107
|
+
const backup = path.join(this.matterbridgeDirectory, NODE_STORAGE_DIR + '.backup');
|
|
1112
1108
|
this.log.info(`Removing matterbridge storage backup directory: ${backup}`);
|
|
1113
1109
|
await fs.rm(backup, { recursive: true });
|
|
1114
1110
|
}
|
|
@@ -1333,7 +1329,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1333
1329
|
this.log.info('Matter node storage manager "Matterbridge" created');
|
|
1334
1330
|
this.matterbridgeContext = await this.createServerNodeContext('Matterbridge', 'Matterbridge', this.aggregatorDeviceType, this.aggregatorVendorId, this.aggregatorVendorName, this.aggregatorProductId, this.aggregatorProductName, this.aggregatorSerialNumber, this.aggregatorUniqueId);
|
|
1335
1331
|
this.log.info('Matter node storage started');
|
|
1336
|
-
await this.backupMatterStorage(path.join(this.matterbridgeDirectory,
|
|
1332
|
+
await this.backupMatterStorage(path.join(this.matterbridgeDirectory, MATTER_STORAGE_NAME), path.join(this.matterbridgeDirectory, MATTER_STORAGE_NAME + '.backup'));
|
|
1337
1333
|
}
|
|
1338
1334
|
async backupMatterStorage(storageName, backupName) {
|
|
1339
1335
|
this.log.info('Creating matter node storage backup...');
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export const plg = '\u001B[38;5;33m';
|
|
2
2
|
export const dev = '\u001B[38;5;79m';
|
|
3
3
|
export const typ = '\u001B[38;5;207m';
|
|
4
|
+
export const MATTERBRIDGE_LOGGER_FILE = 'matterbridge.log';
|
|
5
|
+
export const MATTER_LOGGER_FILE = 'matter.log';
|
|
6
|
+
export const NODE_STORAGE_DIR = 'storage';
|
|
7
|
+
export const MATTER_STORAGE_NAME = 'matterstorage';
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "3.3.0-dev-
|
|
3
|
+
"version": "3.3.0-dev-20251004-43d8106",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "3.3.0-dev-
|
|
9
|
+
"version": "3.3.0-dev-20251004-43d8106",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "0.15.4",
|
package/package.json
CHANGED