@matterbridge/core 3.9.4-dev-20260705-b684a91 → 3.9.4-dev-20260706-08fe8ef
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/matterbridge.d.ts +5 -0
- package/dist/matterbridge.js +28 -4
- package/package.json +5 -5
package/dist/matterbridge.d.ts
CHANGED
|
@@ -71,6 +71,11 @@ export declare class Matterbridge extends EventEmitter<MatterbridgeEvents> {
|
|
|
71
71
|
private readonly failCountLimit;
|
|
72
72
|
hasCleanupStarted: boolean;
|
|
73
73
|
private initialized;
|
|
74
|
+
private readonly isShutdownCommand;
|
|
75
|
+
private startupAt;
|
|
76
|
+
private shutdownAt;
|
|
77
|
+
private runningTimes;
|
|
78
|
+
private runningDays;
|
|
74
79
|
private startMatterInterval;
|
|
75
80
|
private readonly startMatterIntervalMs;
|
|
76
81
|
private checkUpdateInterval;
|
package/dist/matterbridge.js
CHANGED
|
@@ -104,6 +104,11 @@ export class Matterbridge extends EventEmitter {
|
|
|
104
104
|
failCountLimit = 300;
|
|
105
105
|
hasCleanupStarted = false;
|
|
106
106
|
initialized = false;
|
|
107
|
+
isShutdownCommand = hasAnyParameter('list', 'logstorage', 'loginterfaces', 'systemcheck', 'add', 'remove', 'enable', 'disable', 'reset', 'factoryreset');
|
|
108
|
+
startupAt = 0;
|
|
109
|
+
shutdownAt = 0;
|
|
110
|
+
runningTimes = 0;
|
|
111
|
+
runningDays = 0;
|
|
107
112
|
startMatterInterval;
|
|
108
113
|
startMatterIntervalMs = 1000;
|
|
109
114
|
checkUpdateInterval;
|
|
@@ -454,6 +459,19 @@ export class Matterbridge extends EventEmitter {
|
|
|
454
459
|
if (!this.nodeStorage || !this.nodeContext) {
|
|
455
460
|
throw new Error('Fatal error creating node storage manager and context for matterbridge');
|
|
456
461
|
}
|
|
462
|
+
if (!this.isShutdownCommand) {
|
|
463
|
+
const lastStartupAt = await this.nodeContext.get('lastStartupAt', 0);
|
|
464
|
+
const lastShutdownAt = await this.nodeContext.get('lastShutdownAt', 0);
|
|
465
|
+
if (lastStartupAt && lastShutdownAt && lastShutdownAt < lastStartupAt) {
|
|
466
|
+
this.log.warn(`Matterbridge was not shut down properly. Last started at ${CYAN}${new Date(lastStartupAt).toLocaleString()}${db}, last shut down at ${CYAN}${new Date(lastShutdownAt).toLocaleString()}${db}`);
|
|
467
|
+
}
|
|
468
|
+
this.startupAt = Date.now();
|
|
469
|
+
this.runningTimes = (await this.nodeContext.get('runningTimes', 0)) + 1;
|
|
470
|
+
this.runningDays = await this.nodeContext.get('runningDays', 0);
|
|
471
|
+
await this.nodeContext.set('runningTimes', this.runningTimes);
|
|
472
|
+
await this.nodeContext.set('runningDays', this.runningDays);
|
|
473
|
+
await this.nodeContext.set('lastStartupAt', this.startupAt);
|
|
474
|
+
}
|
|
457
475
|
this.initialPort = this.port = getIntParameter('port') ?? (await this.nodeContext.get('matterport', 5540)) ?? 5540;
|
|
458
476
|
this.initialPasscode = this.passcode =
|
|
459
477
|
getIntParameter('passcode') ?? (await this.nodeContext.get('matterpasscode')) ?? PaseClient.generateRandomPasscode(this.environment.get(Crypto));
|
|
@@ -723,8 +741,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
723
741
|
this.log.debug(`Parsing plugin ${plg}${plugin.name}${db} from path ${CYAN}${plugin.path}${db} ` +
|
|
724
742
|
`with version ${CYAN}${plugin.version}${db} type ${CYAN}${plugin.type}${db} local ${CYAN}${isLocal}${db} linked ${CYAN}${isLinked}${db} ` +
|
|
725
743
|
`private ${CYAN}${plugin.private}${db} tarball ${CYAN}${plugin.tarballPath}${db}.`);
|
|
726
|
-
if ((isLocal && fs.existsSync(plugin.path) && !isLinked && !
|
|
727
|
-
process.env.MATTERBRIDGE_LINK_LOCAL_PLUGINS === 'jest') {
|
|
744
|
+
if ((isLocal && fs.existsSync(plugin.path) && !isLinked && !this.isShutdownCommand) || process.env.MATTERBRIDGE_LINK_LOCAL_PLUGINS === 'jest') {
|
|
728
745
|
const { execSync } = await import('node:child_process');
|
|
729
746
|
try {
|
|
730
747
|
execSync(isBun() ? 'bun link matterbridge --silent' : 'npm link matterbridge --no-fund --no-audit --silent', { cwd: path.dirname(plugin.path) });
|
|
@@ -737,8 +754,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
737
754
|
continue;
|
|
738
755
|
}
|
|
739
756
|
}
|
|
740
|
-
if ((!isLocal && !fs.existsSync(plugin.path) && !
|
|
741
|
-
process.env.MATTERBRIDGE_REINSTALL_PLUGINS === 'jest') {
|
|
757
|
+
if ((!isLocal && !fs.existsSync(plugin.path) && !this.isShutdownCommand) || process.env.MATTERBRIDGE_REINSTALL_PLUGINS === 'jest') {
|
|
742
758
|
const { execSync } = await import('node:child_process');
|
|
743
759
|
const sudo = hasParameter('sudo') || (process.platform !== 'win32' && !hasParameter('docker') && !hasParameter('nosudo') && !process.env.PATH?.includes('/.nvm/versions/node/'));
|
|
744
760
|
try {
|
|
@@ -1404,6 +1420,14 @@ export class Matterbridge extends EventEmitter {
|
|
|
1404
1420
|
}
|
|
1405
1421
|
}
|
|
1406
1422
|
this.server.request({ type: 'frontend_matterbridgestatusupdate', src: 'matterbridge', dst: 'frontend', params: { status: (this.bridgeStatus = 'stopped') } });
|
|
1423
|
+
if (!this.isShutdownCommand) {
|
|
1424
|
+
this.shutdownAt = Date.now();
|
|
1425
|
+
this.runningDays = this.runningDays + Math.floor((this.shutdownAt - this.startupAt) / (1000 * 60 * 60 * 24));
|
|
1426
|
+
await this.nodeContext?.set('runningDays', this.runningDays);
|
|
1427
|
+
await this.nodeContext?.set('lastShutdownAt', this.shutdownAt);
|
|
1428
|
+
this.log.info(`Matterbridge has run ${this.runningTimes} times for a total of ${this.runningDays} days.`);
|
|
1429
|
+
this.log.info(`Matterbridge last started at ${new Date(this.startupAt).toLocaleString()} and shut down at ${new Date(this.shutdownAt).toLocaleString()}`);
|
|
1430
|
+
}
|
|
1407
1431
|
await this.frontend.stop();
|
|
1408
1432
|
this.frontend.destroy();
|
|
1409
1433
|
this.plugins.destroy();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.9.4-dev-
|
|
3
|
+
"version": "3.9.4-dev-20260706-08fe8ef",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -130,10 +130,10 @@
|
|
|
130
130
|
],
|
|
131
131
|
"dependencies": {
|
|
132
132
|
"@matter/main": "0.17.4",
|
|
133
|
-
"@matterbridge/dgram": "3.9.4-dev-
|
|
134
|
-
"@matterbridge/thread": "3.9.4-dev-
|
|
135
|
-
"@matterbridge/types": "3.9.4-dev-
|
|
136
|
-
"@matterbridge/utils": "3.9.4-dev-
|
|
133
|
+
"@matterbridge/dgram": "3.9.4-dev-20260706-08fe8ef",
|
|
134
|
+
"@matterbridge/thread": "3.9.4-dev-20260706-08fe8ef",
|
|
135
|
+
"@matterbridge/types": "3.9.4-dev-20260706-08fe8ef",
|
|
136
|
+
"@matterbridge/utils": "3.9.4-dev-20260706-08fe8ef",
|
|
137
137
|
"escape-html": "1.0.3",
|
|
138
138
|
"express": "5.2.1",
|
|
139
139
|
"express-rate-limit": "8.5.2",
|