matterbridge 2.1.6-dev.4 → 2.1.6-dev.5
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 +1 -0
- package/dist/cli.js +91 -89
- package/dist/frontend.js +7 -6
- package/dist/index.js +6 -8
- package/dist/matterbridge.js +48 -62
- package/dist/matterbridgeEndpoint.js +1 -1
- package/dist/matterbridgeEndpointHelpers.js +2 -2
- package/dist/matterbridgePlatform.js +2 -2
- package/dist/utils/colorUtils.js +1 -1
- package/dist/utils/export.js +2 -0
- package/dist/utils/isvalid.js +50 -0
- package/dist/utils/parameter.js +26 -0
- package/dist/utils/utils.js +19 -81
- package/frontend/build/asset-manifest.json +3 -3
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/js/{main.257513e8.js → main.be75f5a3.js} +4 -4
- package/frontend/build/static/js/{main.257513e8.js.map → main.be75f5a3.js.map} +1 -1
- package/npm-shrinkwrap.json +44 -44
- package/package.json +2 -2
- /package/frontend/build/static/js/{main.257513e8.js.LICENSE.txt → main.be75f5a3.js.LICENSE.txt} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { checkNotLatinCharacters } from './matterbridgeEndpointHelpers.js';
|
|
2
|
-
import { isValidArray, isValidObject, isValidString } from './utils/
|
|
2
|
+
import { isValidArray, isValidObject, isValidString } from './utils/export.js';
|
|
3
3
|
import { CYAN, db, er, nf, wr } from './logger/export.js';
|
|
4
4
|
import { NodeStorageManager } from './storage/export.js';
|
|
5
|
-
import path from 'path';
|
|
5
|
+
import path from 'node:path';
|
|
6
6
|
export class MatterbridgePlatform {
|
|
7
7
|
matterbridge;
|
|
8
8
|
log;
|
package/dist/utils/colorUtils.js
CHANGED
package/dist/utils/export.js
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export function isValidIpv4Address(ipv4Address) {
|
|
2
|
+
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
3
|
+
return ipv4Regex.test(ipv4Address);
|
|
4
|
+
}
|
|
5
|
+
export function isValidNumber(value, min, max) {
|
|
6
|
+
if (value === undefined || value === null || typeof value !== 'number' || Number.isNaN(value))
|
|
7
|
+
return false;
|
|
8
|
+
if (min !== undefined && value < min)
|
|
9
|
+
return false;
|
|
10
|
+
if (max !== undefined && value > max)
|
|
11
|
+
return false;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
export function isValidBoolean(value) {
|
|
15
|
+
return value !== undefined && value !== null && typeof value === 'boolean';
|
|
16
|
+
}
|
|
17
|
+
export function isValidString(value, minLength, maxLength) {
|
|
18
|
+
if (value === undefined || value === null || typeof value !== 'string')
|
|
19
|
+
return false;
|
|
20
|
+
if (minLength !== undefined && value.length < minLength)
|
|
21
|
+
return false;
|
|
22
|
+
if (maxLength !== undefined && value.length > maxLength)
|
|
23
|
+
return false;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
export function isValidObject(value, minLength, maxLength) {
|
|
27
|
+
if (value === undefined || value === null || typeof value !== 'object' || Array.isArray(value))
|
|
28
|
+
return false;
|
|
29
|
+
const keys = Object.keys(value);
|
|
30
|
+
if (minLength !== undefined && keys.length < minLength)
|
|
31
|
+
return false;
|
|
32
|
+
if (maxLength !== undefined && keys.length > maxLength)
|
|
33
|
+
return false;
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
export function isValidArray(value, minLength, maxLength) {
|
|
37
|
+
if (value === undefined || value === null || !Array.isArray(value))
|
|
38
|
+
return false;
|
|
39
|
+
if (minLength !== undefined && value.length < minLength)
|
|
40
|
+
return false;
|
|
41
|
+
if (maxLength !== undefined && value.length > maxLength)
|
|
42
|
+
return false;
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
export function isValidNull(value) {
|
|
46
|
+
return value === null;
|
|
47
|
+
}
|
|
48
|
+
export function isValidUndefined(value) {
|
|
49
|
+
return value === undefined;
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isValidNumber } from './export.js';
|
|
2
|
+
export function getParameter(name) {
|
|
3
|
+
const commandArguments = process.argv.slice(2);
|
|
4
|
+
let markerIndex = commandArguments.indexOf(`-${name}`);
|
|
5
|
+
if (markerIndex === -1)
|
|
6
|
+
markerIndex = commandArguments.indexOf(`--${name}`);
|
|
7
|
+
if (markerIndex === -1 || markerIndex + 1 === commandArguments.length)
|
|
8
|
+
return undefined;
|
|
9
|
+
return commandArguments[markerIndex + 1];
|
|
10
|
+
}
|
|
11
|
+
export function hasParameter(name) {
|
|
12
|
+
const commandArguments = process.argv.slice(2);
|
|
13
|
+
let markerIncluded = commandArguments.includes(`-${name}`);
|
|
14
|
+
if (!markerIncluded)
|
|
15
|
+
markerIncluded = commandArguments.includes(`--${name}`);
|
|
16
|
+
return markerIncluded;
|
|
17
|
+
}
|
|
18
|
+
export function getIntParameter(name) {
|
|
19
|
+
const value = getParameter(name);
|
|
20
|
+
if (value === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
const intValue = parseInt(value, 10);
|
|
23
|
+
if (!isValidNumber(intValue))
|
|
24
|
+
return undefined;
|
|
25
|
+
return intValue;
|
|
26
|
+
}
|
package/dist/utils/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import os from 'os';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { AnsiLogger, idn, rs } from '
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { AnsiLogger, idn, rs } from '../logger/export.js';
|
|
4
4
|
const log = new AnsiLogger({ logName: 'MatterbridgeUtils', logTimestampFormat: 4, logLevel: "info" });
|
|
5
5
|
export function deepEqual(a, b, excludeProperties = []) {
|
|
6
6
|
const debug = false;
|
|
@@ -147,56 +147,6 @@ export function getMacAddress() {
|
|
|
147
147
|
}
|
|
148
148
|
return macAddress;
|
|
149
149
|
}
|
|
150
|
-
export function isValidIpv4Address(ipv4Address) {
|
|
151
|
-
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
152
|
-
return ipv4Regex.test(ipv4Address);
|
|
153
|
-
}
|
|
154
|
-
export function isValidNumber(value, min, max) {
|
|
155
|
-
if (value === undefined || value === null || typeof value !== 'number' || Number.isNaN(value))
|
|
156
|
-
return false;
|
|
157
|
-
if (min !== undefined && value < min)
|
|
158
|
-
return false;
|
|
159
|
-
if (max !== undefined && value > max)
|
|
160
|
-
return false;
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
export function isValidBoolean(value) {
|
|
164
|
-
return value !== undefined && value !== null && typeof value === 'boolean';
|
|
165
|
-
}
|
|
166
|
-
export function isValidString(value, minLength, maxLength) {
|
|
167
|
-
if (value === undefined || value === null || typeof value !== 'string')
|
|
168
|
-
return false;
|
|
169
|
-
if (minLength !== undefined && value.length < minLength)
|
|
170
|
-
return false;
|
|
171
|
-
if (maxLength !== undefined && value.length > maxLength)
|
|
172
|
-
return false;
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
export function isValidObject(value, minLength, maxLength) {
|
|
176
|
-
if (value === undefined || value === null || typeof value !== 'object' || Array.isArray(value))
|
|
177
|
-
return false;
|
|
178
|
-
const keys = Object.keys(value);
|
|
179
|
-
if (minLength !== undefined && keys.length < minLength)
|
|
180
|
-
return false;
|
|
181
|
-
if (maxLength !== undefined && keys.length > maxLength)
|
|
182
|
-
return false;
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
export function isValidArray(value, minLength, maxLength) {
|
|
186
|
-
if (value === undefined || value === null || !Array.isArray(value))
|
|
187
|
-
return false;
|
|
188
|
-
if (minLength !== undefined && value.length < minLength)
|
|
189
|
-
return false;
|
|
190
|
-
if (maxLength !== undefined && value.length > maxLength)
|
|
191
|
-
return false;
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
export function isValidNull(value) {
|
|
195
|
-
return value === null;
|
|
196
|
-
}
|
|
197
|
-
export function isValidUndefined(value) {
|
|
198
|
-
return value === undefined;
|
|
199
|
-
}
|
|
200
150
|
export function logInterfaces(debug = true) {
|
|
201
151
|
log.logLevel = "info";
|
|
202
152
|
log.logName = 'LogInterfaces';
|
|
@@ -260,7 +210,7 @@ export async function wait(timeout = 1000, name, debug = false) {
|
|
|
260
210
|
export async function createZip(outputPath, ...sourcePaths) {
|
|
261
211
|
const { default: archiver } = await import('archiver');
|
|
262
212
|
const { glob } = await import('glob');
|
|
263
|
-
const { createWriteStream, statSync } = await import('fs');
|
|
213
|
+
const { createWriteStream, statSync } = await import('node:fs');
|
|
264
214
|
log.logLevel = "info";
|
|
265
215
|
log.logName = 'Archive';
|
|
266
216
|
log.debug(`creating archive ${outputPath} from ${sourcePaths.join(', ')} ...`);
|
|
@@ -326,7 +276,7 @@ export async function createZip(outputPath, ...sourcePaths) {
|
|
|
326
276
|
});
|
|
327
277
|
}
|
|
328
278
|
export async function copyDirectory(srcDir, destDir) {
|
|
329
|
-
const fs = await import('fs').then((mod) => mod.promises);
|
|
279
|
+
const fs = await import('node:fs').then((mod) => mod.promises);
|
|
330
280
|
log.debug(`copyDirectory: copying directory from ${srcDir} to ${destDir}`);
|
|
331
281
|
try {
|
|
332
282
|
await fs.mkdir(destDir, { recursive: true });
|
|
@@ -349,7 +299,7 @@ export async function copyDirectory(srcDir, destDir) {
|
|
|
349
299
|
}
|
|
350
300
|
}
|
|
351
301
|
export async function resolveHostname(hostname, family = 4) {
|
|
352
|
-
const dns = await import('dns');
|
|
302
|
+
const dns = await import('node:dns');
|
|
353
303
|
try {
|
|
354
304
|
const addresses = await dns.promises.lookup(hostname.toLowerCase(), { family });
|
|
355
305
|
return addresses.address;
|
|
@@ -358,31 +308,6 @@ export async function resolveHostname(hostname, family = 4) {
|
|
|
358
308
|
return null;
|
|
359
309
|
}
|
|
360
310
|
}
|
|
361
|
-
export function getParameter(name) {
|
|
362
|
-
const commandArguments = process.argv.slice(2);
|
|
363
|
-
let markerIndex = commandArguments.indexOf(`-${name}`);
|
|
364
|
-
if (markerIndex === -1)
|
|
365
|
-
markerIndex = commandArguments.indexOf(`--${name}`);
|
|
366
|
-
if (markerIndex === -1 || markerIndex + 1 === commandArguments.length)
|
|
367
|
-
return undefined;
|
|
368
|
-
return commandArguments[markerIndex + 1];
|
|
369
|
-
}
|
|
370
|
-
export function hasParameter(name) {
|
|
371
|
-
const commandArguments = process.argv.slice(2);
|
|
372
|
-
let markerIncluded = commandArguments.includes(`-${name}`);
|
|
373
|
-
if (!markerIncluded)
|
|
374
|
-
markerIncluded = commandArguments.includes(`--${name}`);
|
|
375
|
-
return markerIncluded;
|
|
376
|
-
}
|
|
377
|
-
export function getIntParameter(name) {
|
|
378
|
-
const value = getParameter(name);
|
|
379
|
-
if (value === undefined)
|
|
380
|
-
return undefined;
|
|
381
|
-
const intValue = parseInt(value, 10);
|
|
382
|
-
if (!isValidNumber(intValue))
|
|
383
|
-
return undefined;
|
|
384
|
-
return intValue;
|
|
385
|
-
}
|
|
386
311
|
export async function getNpmPackageVersion(packageName, tag = 'latest', timeout = 5000) {
|
|
387
312
|
const https = await import('https');
|
|
388
313
|
return new Promise((resolve, reject) => {
|
|
@@ -427,3 +352,16 @@ export async function getNpmPackageVersion(packageName, tag = 'latest', timeout
|
|
|
427
352
|
});
|
|
428
353
|
});
|
|
429
354
|
}
|
|
355
|
+
export async function getGlobalNodeModules() {
|
|
356
|
+
const { exec } = await import('node:child_process');
|
|
357
|
+
return new Promise((resolve, reject) => {
|
|
358
|
+
exec('npm root -g', (error, stdout) => {
|
|
359
|
+
if (error) {
|
|
360
|
+
reject(error);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
resolve(stdout.trim());
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
}
|
|
@@ -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.be75f5a3.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.be75f5a3.js.map": "./static/js/main.be75f5a3.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.be75f5a3.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.be75f5a3.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>
|