matterbridge 2.1.5-dev.1 → 2.1.5-dev.3
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 +6 -1
- package/dist/frontend.js +88 -20
- package/dist/matterbridge.js +3 -1
- package/dist/matterbridgeEndpoint.js +5 -20
- package/dist/matterbridgeEndpointHelpers.js +20 -0
- package/dist/utils/utils.js +3 -3
- package/frontend/build/asset-manifest.json +3 -3
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/js/{main.26dbf9b9.js → main.1c3bc5a8.js} +4 -4
- package/frontend/build/static/js/main.1c3bc5a8.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/frontend/build/static/js/main.26dbf9b9.js.map +0 -1
- /package/frontend/build/static/js/{main.26dbf9b9.js.LICENSE.txt → main.1c3bc5a8.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -33,13 +33,18 @@ matterbridge-zigbee2mqtt v. 2.4.4
|
|
|
33
33
|
matterbridge-somfy-tahoma v. 1.2.3
|
|
34
34
|
matterbridge-hass v. 0.0.8
|
|
35
35
|
|
|
36
|
-
## [2.1.5] - 2025-02-
|
|
36
|
+
## [2.1.5] - 2025-02-09
|
|
37
37
|
|
|
38
38
|
### Added
|
|
39
39
|
|
|
40
|
+
- [frontend]: Frontend v.2.4.1.
|
|
41
|
+
- [frontend]: Optimized rendering of all pages.
|
|
42
|
+
- [frontend]: Added cpuUsed, rss and heapUsed to SystemInformation.
|
|
43
|
+
|
|
40
44
|
### Changed
|
|
41
45
|
|
|
42
46
|
- [matterbridge]: Calls getNpmPackageVersion() instead of npm to get latest version.
|
|
47
|
+
- [matterbridge]: Memory optimization on MatterbridgeEndpoint.
|
|
43
48
|
|
|
44
49
|
### Fixed
|
|
45
50
|
|
package/dist/frontend.js
CHANGED
|
@@ -7,12 +7,14 @@ import os from 'os';
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { promises as fs } from 'fs';
|
|
9
9
|
import { AnsiLogger, CYAN, db, debugStringify, er, nf, rs, stringify, UNDERLINE, UNDERLINEOFF, wr, YELLOW } from './logger/export.js';
|
|
10
|
-
import { createZip, getIntParameter, hasParameter, isValidNumber, isValidObject, isValidString } from './utils/utils.js';
|
|
10
|
+
import { createZip, deepCopy, getIntParameter, hasParameter, isValidNumber, isValidObject, isValidString } from './utils/utils.js';
|
|
11
11
|
import { plg } from './matterbridgeTypes.js';
|
|
12
12
|
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
13
13
|
export const WS_ID_LOG = 0;
|
|
14
14
|
export const WS_ID_REFRESH_NEEDED = 1;
|
|
15
15
|
export const WS_ID_RESTART_NEEDED = 2;
|
|
16
|
+
export const WS_ID_CPU_UPDATE = 3;
|
|
17
|
+
export const WS_ID_MEMORY_UPDATE = 4;
|
|
16
18
|
export class Frontend {
|
|
17
19
|
matterbridge;
|
|
18
20
|
log;
|
|
@@ -22,7 +24,8 @@ export class Frontend {
|
|
|
22
24
|
httpServer;
|
|
23
25
|
httpsServer;
|
|
24
26
|
webSocketServer;
|
|
25
|
-
prevCpus = os.cpus();
|
|
27
|
+
prevCpus = deepCopy(os.cpus());
|
|
28
|
+
lastCpuUsage = 0;
|
|
26
29
|
memoryData = [];
|
|
27
30
|
memoryInterval;
|
|
28
31
|
memoryTimeout;
|
|
@@ -792,28 +795,61 @@ export class Frontend {
|
|
|
792
795
|
}
|
|
793
796
|
}
|
|
794
797
|
formatMemoryUsage = (bytes) => {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
+
if (bytes >= 1024 ** 3) {
|
|
799
|
+
return `${(bytes / 1024 ** 3).toFixed(2)} GB`;
|
|
800
|
+
}
|
|
801
|
+
else if (bytes >= 1024 ** 2) {
|
|
802
|
+
return `${(bytes / 1024 ** 2).toFixed(2)} MB`;
|
|
803
|
+
}
|
|
804
|
+
else {
|
|
805
|
+
return `${(bytes / 1024).toFixed(2)} KB`;
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
formatOsUpTime = () => {
|
|
809
|
+
const seconds = os.uptime();
|
|
810
|
+
if (seconds >= 86400) {
|
|
811
|
+
const days = Math.floor(seconds / 86400);
|
|
812
|
+
return `${days} day${days !== 1 ? 's' : ''}`;
|
|
813
|
+
}
|
|
814
|
+
if (seconds >= 3600) {
|
|
815
|
+
const hours = Math.floor(seconds / 3600);
|
|
816
|
+
return `${hours} hour${hours !== 1 ? 's' : ''}`;
|
|
817
|
+
}
|
|
818
|
+
if (seconds >= 60) {
|
|
819
|
+
const minutes = Math.floor(seconds / 60);
|
|
820
|
+
return `${minutes} minute${minutes !== 1 ? 's' : ''}`;
|
|
821
|
+
}
|
|
822
|
+
return `${seconds} second${seconds !== 1 ? 's' : ''}`;
|
|
823
|
+
};
|
|
824
|
+
getCpuUsage = () => {
|
|
825
|
+
const currCpus = os.cpus();
|
|
826
|
+
if (currCpus.length !== this.prevCpus.length) {
|
|
827
|
+
this.prevCpus = deepCopy(currCpus);
|
|
828
|
+
this.log.debug(`***Cpu usage reset. Current cpus: ${currCpus.length}. Previous cpus: ${this.prevCpus.length}.`);
|
|
829
|
+
return this.lastCpuUsage.toFixed(2);
|
|
830
|
+
}
|
|
831
|
+
let totalIdle = 0, totalTick = 0;
|
|
832
|
+
this.prevCpus.forEach((prevCpu, i) => {
|
|
833
|
+
const currCpu = currCpus[i];
|
|
834
|
+
const idleDiff = currCpu.times.idle - prevCpu.times.idle;
|
|
835
|
+
const totalDiff = Object.keys(currCpu.times).reduce((acc, key) => acc + (currCpu.times[key] - prevCpu.times[key]), 0);
|
|
836
|
+
totalIdle += idleDiff;
|
|
837
|
+
totalTick += totalDiff;
|
|
838
|
+
});
|
|
839
|
+
const cpuUsage = 100 - (totalIdle / totalTick) * 100;
|
|
840
|
+
if (totalTick === 0 || isNaN(cpuUsage) || !isFinite(cpuUsage) || cpuUsage <= 0) {
|
|
841
|
+
this.log.debug('***Invalid cpu usage. Returning the previous one.');
|
|
842
|
+
return this.lastCpuUsage.toFixed(2);
|
|
843
|
+
}
|
|
844
|
+
this.prevCpus = deepCopy(currCpus);
|
|
845
|
+
this.lastCpuUsage = cpuUsage;
|
|
846
|
+
return cpuUsage.toFixed(2);
|
|
798
847
|
};
|
|
799
848
|
startCpuMemoryDump() {
|
|
800
849
|
clearInterval(this.memoryInterval);
|
|
801
850
|
clearTimeout(this.memoryTimeout);
|
|
802
851
|
const interval = () => {
|
|
803
|
-
const
|
|
804
|
-
if (currCpus.length !== this.prevCpus.length) {
|
|
805
|
-
this.prevCpus = currCpus;
|
|
806
|
-
}
|
|
807
|
-
let totalIdle = 0, totalTick = 0;
|
|
808
|
-
this.prevCpus.forEach((prevCpu, i) => {
|
|
809
|
-
const currCpu = currCpus[i];
|
|
810
|
-
const idleDiff = currCpu.times.idle - prevCpu.times.idle;
|
|
811
|
-
const totalDiff = Object.keys(currCpu.times).reduce((acc, key) => acc + (currCpu.times[key] - prevCpu.times[key]), 0);
|
|
812
|
-
totalIdle += idleDiff;
|
|
813
|
-
totalTick += totalDiff;
|
|
814
|
-
});
|
|
815
|
-
const cpuUsage = (100 - (totalIdle / totalTick) * 100).toFixed(2);
|
|
816
|
-
this.prevCpus = currCpus;
|
|
852
|
+
const cpuUsage = this.getCpuUsage();
|
|
817
853
|
const memoryUsageRaw = process.memoryUsage();
|
|
818
854
|
this.memoryData.push({ ...memoryUsageRaw, cpu: cpuUsage });
|
|
819
855
|
const memoryUsage = {
|
|
@@ -824,6 +860,15 @@ export class Frontend {
|
|
|
824
860
|
arrayBuffers: this.formatMemoryUsage(memoryUsageRaw.arrayBuffers),
|
|
825
861
|
};
|
|
826
862
|
this.log.debug(`***Cpu usage: ${CYAN}${cpuUsage.padStart(6, ' ')} %${db} - Memory usage: rss ${CYAN}${memoryUsage.rss}${db} heapTotal ${CYAN}${memoryUsage.heapTotal}${db} heapUsed ${CYAN}${memoryUsage.heapUsed}${db} external ${memoryUsage.external} arrayBuffers ${memoryUsage.arrayBuffers}`);
|
|
863
|
+
this.matterbridge.systemInformation.freeMemory = this.formatMemoryUsage(os.freemem());
|
|
864
|
+
this.matterbridge.systemInformation.totalMemory = this.formatMemoryUsage(os.totalmem());
|
|
865
|
+
this.matterbridge.systemInformation.systemUptime = this.formatOsUpTime();
|
|
866
|
+
this.matterbridge.systemInformation.cpuUsed = cpuUsage;
|
|
867
|
+
this.matterbridge.systemInformation.rss = this.formatMemoryUsage(process.memoryUsage().rss);
|
|
868
|
+
this.matterbridge.systemInformation.heapTotal = this.formatMemoryUsage(process.memoryUsage().heapTotal);
|
|
869
|
+
this.matterbridge.systemInformation.heapUsed = this.formatMemoryUsage(process.memoryUsage().heapUsed);
|
|
870
|
+
this.wssSendCpuUpdate(this.matterbridge.systemInformation.cpuUsed);
|
|
871
|
+
this.wssSendMemoryUpdate(this.matterbridge.systemInformation.freeMemory, this.matterbridge.systemInformation.totalMemory, this.matterbridge.systemInformation.systemUptime, this.matterbridge.systemInformation.rss, this.matterbridge.systemInformation.heapUsed, this.matterbridge.systemInformation.heapTotal);
|
|
827
872
|
};
|
|
828
873
|
interval();
|
|
829
874
|
this.memoryInterval = setInterval(interval, getIntParameter('memoryinterval') ?? 1000);
|
|
@@ -852,8 +897,13 @@ export class Frontend {
|
|
|
852
897
|
this.prevCpus = [];
|
|
853
898
|
}
|
|
854
899
|
async getApiSettings() {
|
|
900
|
+
this.matterbridge.systemInformation.totalMemory = this.formatMemoryUsage(os.totalmem());
|
|
901
|
+
this.matterbridge.systemInformation.freeMemory = this.formatMemoryUsage(os.freemem());
|
|
902
|
+
this.matterbridge.systemInformation.systemUptime = this.formatOsUpTime();
|
|
903
|
+
this.matterbridge.systemInformation.cpuUsed = this.getCpuUsage();
|
|
855
904
|
this.matterbridge.systemInformation.rss = this.formatMemoryUsage(process.memoryUsage().rss);
|
|
856
|
-
this.matterbridge.systemInformation.
|
|
905
|
+
this.matterbridge.systemInformation.heapTotal = this.formatMemoryUsage(process.memoryUsage().heapTotal);
|
|
906
|
+
this.matterbridge.systemInformation.heapUsed = this.formatMemoryUsage(process.memoryUsage().heapUsed);
|
|
857
907
|
this.matterbridge.matterbridgeInformation.bridgeMode = this.matterbridge.bridgeMode;
|
|
858
908
|
this.matterbridge.matterbridgeInformation.restartMode = this.matterbridge.restartMode;
|
|
859
909
|
this.matterbridge.matterbridgeInformation.loggerLevel = this.matterbridge.log.logLevel;
|
|
@@ -1316,4 +1366,22 @@ export class Frontend {
|
|
|
1316
1366
|
}
|
|
1317
1367
|
});
|
|
1318
1368
|
}
|
|
1369
|
+
wssSendCpuUpdate(cpuUsed) {
|
|
1370
|
+
this.log.debug('Sending a memory update message to all connected clients');
|
|
1371
|
+
this.matterbridge.matterbridgeInformation.restartRequired = true;
|
|
1372
|
+
this.webSocketServer?.clients.forEach((client) => {
|
|
1373
|
+
if (client.readyState === WebSocket.OPEN) {
|
|
1374
|
+
client.send(JSON.stringify({ id: WS_ID_CPU_UPDATE, src: 'Matterbridge', dst: 'Frontend', method: 'cpu_update', params: { cpuUsed } }));
|
|
1375
|
+
}
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
wssSendMemoryUpdate(freeMemory, totalMemory, systemUptime, rss, heapUsed, heapTotal) {
|
|
1379
|
+
this.log.debug('Sending a cpu update message to all connected clients');
|
|
1380
|
+
this.matterbridge.matterbridgeInformation.restartRequired = true;
|
|
1381
|
+
this.webSocketServer?.clients.forEach((client) => {
|
|
1382
|
+
if (client.readyState === WebSocket.OPEN) {
|
|
1383
|
+
client.send(JSON.stringify({ id: WS_ID_MEMORY_UPDATE, src: 'Matterbridge', dst: 'Frontend', method: 'memory_update', params: { freeMemory, totalMemory, systemUptime, rss, heapUsed, heapTotal } }));
|
|
1384
|
+
}
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1319
1387
|
}
|
package/dist/matterbridge.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } fr
|
|
|
2
2
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
3
3
|
import { isValidNumber, isValidObject } from './utils/utils.js';
|
|
4
4
|
import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, } from './matterbridgeBehaviors.js';
|
|
5
|
-
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, } from './matterbridgeEndpointHelpers.js';
|
|
5
|
+
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
6
6
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, VendorId } from '@matter/main';
|
|
7
7
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
8
8
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
@@ -130,7 +130,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
130
130
|
}
|
|
131
131
|
else
|
|
132
132
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
133
|
-
this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
133
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
134
134
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
135
135
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
136
136
|
this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
|
|
@@ -171,24 +171,8 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
171
171
|
async updateAttribute(cluster, attribute, value, log) {
|
|
172
172
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
173
173
|
}
|
|
174
|
-
async subscribeAttribute(
|
|
175
|
-
|
|
176
|
-
if (this.construction.status !== Lifecycle.Status.Active) {
|
|
177
|
-
await this.construction.ready;
|
|
178
|
-
}
|
|
179
|
-
const events = this.events;
|
|
180
|
-
if (!(clusterName in events)) {
|
|
181
|
-
this.log.error(`subscribeAttribute ${hk}${attribute}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er}`);
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
attribute = lowercaseFirstLetter(attribute) + '$Changed';
|
|
185
|
-
if (!(attribute in events[clusterName])) {
|
|
186
|
-
this.log.error(`subscribeAttribute error: Attribute ${hk}${attribute}${er} not found on Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} on endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er}`);
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
events[clusterName][attribute].on(listener);
|
|
190
|
-
log?.info(`${db}Subscribed endpoint ${or}${this.id}${db}:${or}${this.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
191
|
-
return true;
|
|
174
|
+
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
175
|
+
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
192
176
|
}
|
|
193
177
|
async triggerEvent(clusterId, event, payload, log) {
|
|
194
178
|
const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
@@ -207,6 +191,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
207
191
|
}
|
|
208
192
|
addClusterServers(serverList) {
|
|
209
193
|
addClusterServers(this, serverList);
|
|
194
|
+
return this;
|
|
210
195
|
}
|
|
211
196
|
async addFixedLabel(label, value) {
|
|
212
197
|
await addFixedLabel(this, label, value);
|
|
@@ -479,6 +479,26 @@ export async function updateAttribute(endpoint, cluster, attribute, value, log)
|
|
|
479
479
|
`to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
480
480
|
return true;
|
|
481
481
|
}
|
|
482
|
+
export async function subscribeAttribute(endpoint, cluster, attribute, listener, log) {
|
|
483
|
+
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
484
|
+
if (!clusterName) {
|
|
485
|
+
endpoint.log.error(`subscribeAttribute ${hk}${attribute}${er} error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
489
|
+
endpoint.log.debug(`subscribeAttribute ${hk}${clusterName}.${attribute}${db}: Endpoint ${or}${endpoint.maybeId}${db}:${or}${endpoint.maybeNumber}${db} is in the ${BLUE}${endpoint.construction.status}${db} state`);
|
|
490
|
+
await endpoint.construction.ready;
|
|
491
|
+
}
|
|
492
|
+
const events = endpoint.events;
|
|
493
|
+
attribute = lowercaseFirstLetter(attribute) + '$Changed';
|
|
494
|
+
if (!(clusterName in events) || !(attribute in events[clusterName])) {
|
|
495
|
+
endpoint.log.error(`subscribeAttribute error: Attribute ${hk}${attribute.replace('$Changed', '')}${er} not found on Cluster ${'0x' + getClusterId(endpoint, clusterName)?.toString(16).padStart(4, '0')}:${clusterName} on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
496
|
+
return false;
|
|
497
|
+
}
|
|
498
|
+
events[clusterName][attribute].on(listener);
|
|
499
|
+
log?.info(`${db}Subscribed endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
500
|
+
return true;
|
|
501
|
+
}
|
|
482
502
|
export function getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
483
503
|
return optionsFor(TemperatureMeasurementServer, {
|
|
484
504
|
measuredValue,
|
package/dist/utils/utils.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { createWriteStream, statSync } from 'fs';
|
|
4
|
-
import { promises as fs } from 'fs';
|
|
5
|
-
import * as dns from 'dns';
|
|
6
3
|
import { AnsiLogger, idn, rs } from 'node-ansi-logger';
|
|
7
4
|
const log = new AnsiLogger({ logName: 'MatterbridgeUtils', logTimestampFormat: 4, logLevel: "info" });
|
|
8
5
|
export function deepEqual(a, b, excludeProperties = []) {
|
|
@@ -263,6 +260,7 @@ export async function wait(timeout = 1000, name, debug = false) {
|
|
|
263
260
|
export async function createZip(outputPath, ...sourcePaths) {
|
|
264
261
|
const { default: archiver } = await import('archiver');
|
|
265
262
|
const { glob } = await import('glob');
|
|
263
|
+
const { createWriteStream, statSync } = await import('fs');
|
|
266
264
|
log.logLevel = "info";
|
|
267
265
|
log.logName = 'Archive';
|
|
268
266
|
log.debug(`creating archive ${outputPath} from ${sourcePaths.join(', ')} ...`);
|
|
@@ -328,6 +326,7 @@ export async function createZip(outputPath, ...sourcePaths) {
|
|
|
328
326
|
});
|
|
329
327
|
}
|
|
330
328
|
export async function copyDirectory(srcDir, destDir) {
|
|
329
|
+
const fs = await import('fs').then((mod) => mod.promises);
|
|
331
330
|
log.debug(`copyDirectory: copying directory from ${srcDir} to ${destDir}`);
|
|
332
331
|
try {
|
|
333
332
|
await fs.mkdir(destDir, { recursive: true });
|
|
@@ -350,6 +349,7 @@ export async function copyDirectory(srcDir, destDir) {
|
|
|
350
349
|
}
|
|
351
350
|
}
|
|
352
351
|
export async function resolveHostname(hostname, family = 4) {
|
|
352
|
+
const dns = await import('dns');
|
|
353
353
|
try {
|
|
354
354
|
const addresses = await dns.promises.lookup(hostname.toLowerCase(), { family });
|
|
355
355
|
return addresses.address;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "./static/css/main.cf25d33e.css",
|
|
4
|
-
"main.js": "./static/js/main.
|
|
4
|
+
"main.js": "./static/js/main.1c3bc5a8.js",
|
|
5
5
|
"static/js/453.abd36b29.chunk.js": "./static/js/453.abd36b29.chunk.js",
|
|
6
6
|
"static/media/roboto-latin-700-normal.woff2": "./static/media/roboto-latin-700-normal.4535474e1cf8598695ad.woff2",
|
|
7
7
|
"static/media/roboto-latin-500-normal.woff2": "./static/media/roboto-latin-500-normal.7077203b1982951ecf76.woff2",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"static/media/roboto-greek-ext-400-normal.woff": "./static/media/roboto-greek-ext-400-normal.16eb83b4a3b1ea994243.woff",
|
|
62
62
|
"index.html": "./index.html",
|
|
63
63
|
"main.cf25d33e.css.map": "./static/css/main.cf25d33e.css.map",
|
|
64
|
-
"main.
|
|
64
|
+
"main.1c3bc5a8.js.map": "./static/js/main.1c3bc5a8.js.map",
|
|
65
65
|
"453.abd36b29.chunk.js.map": "./static/js/453.abd36b29.chunk.js.map"
|
|
66
66
|
},
|
|
67
67
|
"entrypoints": [
|
|
68
68
|
"static/css/main.cf25d33e.css",
|
|
69
|
-
"static/js/main.
|
|
69
|
+
"static/js/main.1c3bc5a8.js"
|
|
70
70
|
]
|
|
71
71
|
}
|
|
@@ -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.
|
|
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.1c3bc5a8.js"></script><link href="./static/css/main.cf25d33e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|