matterbridge 1.2.6 → 1.2.7
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 +13 -0
- package/README.md +2 -2
- package/TODO.md +0 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/matterbridge.d.ts.map +1 -1
- package/dist/matterbridge.js +63 -38
- package/dist/matterbridge.js.map +1 -1
- package/dist/matterbridgeDevice.d.ts +37 -12
- package/dist/matterbridgeDevice.d.ts.map +1 -1
- package/dist/matterbridgeDevice.js +99 -17
- package/dist/matterbridgeDevice.js.map +1 -1
- package/dist/utils.d.ts +52 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +121 -1
- package/dist/utils.js.map +1 -1
- package/frontend/build/asset-manifest.json +3 -3
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/js/{main.6b861489.js → main.491fc08f.js} +3 -3
- package/frontend/build/static/js/main.491fc08f.js.map +1 -0
- package/matterbridge.service +1 -1
- package/package.json +2 -2
- package/frontend/build/static/js/main.6b861489.js.map +0 -1
- /package/frontend/build/static/js/{main.6b861489.js.LICENSE.txt → main.491fc08f.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.7] - 2024-04-14
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- [matterbridge]: The default frontend port is now 8283!.
|
|
10
|
+
- [matterbridge.service]: Updated matterbridge.service instructions to fix restart when Matterbridge runs as a daemon with systemctl.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- [frontend]: Added manual pairing code. Allows to pair Matterbridge without using the phone.
|
|
15
|
+
- [MatterbridgeDevice]: Added api to create child endpoints (see matterbridge-example-dynamic-platform).
|
|
16
|
+
- [MatterbridgeDevice]: Added FlowMeasurement cluster.
|
|
17
|
+
|
|
5
18
|
## [1.2.6] - 2024-04-11
|
|
6
19
|
|
|
7
20
|
### Added
|
package/README.md
CHANGED
|
@@ -239,7 +239,7 @@ matterbridge -reset [plugin path or plugin name]
|
|
|
239
239
|
matterbridge -factoryreset
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
This will
|
|
242
|
+
This will reset the internal starages. All commissioning informations will be lost. All plugins will be unregistered.
|
|
243
243
|
|
|
244
244
|
## How to create your plugin
|
|
245
245
|
|
|
@@ -315,7 +315,7 @@ After=network-online.target
|
|
|
315
315
|
|
|
316
316
|
[Service]
|
|
317
317
|
Type=simple
|
|
318
|
-
ExecStart=/usr/bin/matterbridge -bridge
|
|
318
|
+
ExecStart=/usr/bin/matterbridge -bridge -service
|
|
319
319
|
WorkingDirectory=/home/<USER>/Matterbridge
|
|
320
320
|
StandardOutput=inherit
|
|
321
321
|
StandardError=inherit
|
package/TODO.md
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,8BAA8B,CAAC;AAGtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,8BAA8B,CAAC;AAGtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export * from './matterbridgeAccessoryPlatform.js';
|
|
|
36
36
|
export * from './matterbridgeDynamicPlatform.js';
|
|
37
37
|
export * from './AirQualityCluster.js';
|
|
38
38
|
export * from './TvocCluster.js';
|
|
39
|
+
export * from './utils.js';
|
|
39
40
|
async function main() {
|
|
40
41
|
// eslint-disable-next-line no-console
|
|
41
42
|
console.log('MAIN: Matterbridge.loadInstance() called');
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAE3B,KAAK,UAAU,IAAI;IACjB,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,MAAM,YAAY,CAAC,YAAY,EAAE,CAAC;IAClC,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;AAC1D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,wDAAwD,KAAK,EAAE,CAAC,CAAC;AACjF,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matterbridge.d.ts","sourceRoot":"","sources":["../src/matterbrid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C;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IASlB;;;;;;OAMG;YACW,wBAAwB;IAkItC;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;;;OAIG;YACW,sBAAsB;IAuCpC;;OAEG;YACW,UAAU;IAcxB;;;;OAIG;YACW,gBAAgB;IAY9B;;;OAGG;YACW,oBAAoB;IAYlC;;OAEG;YACW,oBAAoB;IAmKlC;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAqBhC;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;;;OAIG;IACG,kBAAkB,CAAC,IAAI,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAqV5D;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;CAwBjC"}
|
package/dist/matterbridge.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { MatterbridgeDevice } from './matterbridgeDevice.js';
|
|
24
24
|
import { NodeStorageManager } from 'node-persist-manager';
|
|
25
|
-
import { AnsiLogger, BRIGHT, RESET, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, stringify, er, nf, rs, wr } from 'node-ansi-logger';
|
|
25
|
+
import { AnsiLogger, BRIGHT, RESET, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, stringify, er, nf, rs, wr, RED, GREEN } from 'node-ansi-logger';
|
|
26
26
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
27
27
|
import { promises as fs } from 'fs';
|
|
28
28
|
import { exec, spawn } from 'child_process';
|
|
@@ -199,25 +199,6 @@ export class Matterbridge extends EventEmitter {
|
|
|
199
199
|
// Set matter.js logger level and format
|
|
200
200
|
Logger.defaultLogLevel = this.debugEnabled ? Level.DEBUG : Level.INFO;
|
|
201
201
|
Logger.format = Format.ANSI;
|
|
202
|
-
// Initialize NodeStorage
|
|
203
|
-
/*
|
|
204
|
-
this.log.debug('Creating node storage manager');
|
|
205
|
-
this.nodeStorage = new NodeStorageManager({ dir: path.join(this.matterbridgeDirectory, 'storage'), logging: false });
|
|
206
|
-
this.log.debug('Creating node storage context for matterbridge');
|
|
207
|
-
this.nodeContext = await this.nodeStorage.createStorage('matterbridge');
|
|
208
|
-
// Get the plugins from node storage
|
|
209
|
-
this.registeredPlugins = await this.nodeContext.get<RegisteredPlugin[]>('plugins', []);
|
|
210
|
-
for (const plugin of this.registeredPlugins) {
|
|
211
|
-
this.log.debug(`Creating node storage context for plugin ${plugin.name}`);
|
|
212
|
-
plugin.nodeContext = await this.nodeStorage.createStorage(plugin.name);
|
|
213
|
-
await plugin.nodeContext.set<string>('name', plugin.name);
|
|
214
|
-
await plugin.nodeContext.set<string>('type', plugin.type);
|
|
215
|
-
await plugin.nodeContext.set<string>('path', plugin.path);
|
|
216
|
-
await plugin.nodeContext.set<string>('version', plugin.version);
|
|
217
|
-
await plugin.nodeContext.set<string>('description', plugin.description);
|
|
218
|
-
await plugin.nodeContext.set<string>('author', plugin.author);
|
|
219
|
-
}
|
|
220
|
-
*/
|
|
221
202
|
// Parse command line
|
|
222
203
|
this.parseCommandLine();
|
|
223
204
|
}
|
|
@@ -234,13 +215,13 @@ export class Matterbridge extends EventEmitter {
|
|
|
234
215
|
if (process.platform === 'win32' && command === 'npm') {
|
|
235
216
|
command = command + '.cmd';
|
|
236
217
|
}
|
|
237
|
-
if (process.platform === 'linux' && command === 'npm') {
|
|
218
|
+
if (process.platform === 'linux' && command === 'npm' && !hasParameter('docker')) {
|
|
238
219
|
args.unshift(command);
|
|
239
220
|
command = 'sudo';
|
|
240
221
|
}
|
|
241
222
|
return new Promise((resolve, reject) => {
|
|
242
223
|
const childProcess = spawn(command, args, {
|
|
243
|
-
stdio: 'inherit',
|
|
224
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
244
225
|
});
|
|
245
226
|
childProcess.on('error', (err) => {
|
|
246
227
|
this.log.error(`Failed to start child process: ${err.message}`);
|
|
@@ -263,6 +244,22 @@ export class Matterbridge extends EventEmitter {
|
|
|
263
244
|
childProcess.on('disconnect', () => {
|
|
264
245
|
this.log.info('Child process has been disconnected from the parent');
|
|
265
246
|
});
|
|
247
|
+
if (childProcess.stdout) {
|
|
248
|
+
childProcess.stdout.on('data', (data) => {
|
|
249
|
+
// Convert the Buffer data to a string.
|
|
250
|
+
const message = data.toString();
|
|
251
|
+
this.log.info(message);
|
|
252
|
+
// TODO: Send this message to the frontend.
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
if (childProcess.stderr) {
|
|
256
|
+
childProcess.stderr.on('data', (data) => {
|
|
257
|
+
// Convert the Buffer data to a string.
|
|
258
|
+
const message = data.toString();
|
|
259
|
+
this.log.error(message);
|
|
260
|
+
// TODO: Handle the error message.
|
|
261
|
+
});
|
|
262
|
+
}
|
|
266
263
|
});
|
|
267
264
|
}
|
|
268
265
|
/**
|
|
@@ -272,15 +269,27 @@ export class Matterbridge extends EventEmitter {
|
|
|
272
269
|
*/
|
|
273
270
|
async parseCommandLine() {
|
|
274
271
|
if (hasParameter('list')) {
|
|
275
|
-
this.log.info('Registered plugins
|
|
272
|
+
this.log.info('│ Registered plugins');
|
|
276
273
|
this.registeredPlugins.forEach((plugin, index) => {
|
|
277
|
-
if (index
|
|
278
|
-
this.log.info(
|
|
279
|
-
this.log.info(
|
|
274
|
+
if (index !== this.registeredPlugins.length - 1) {
|
|
275
|
+
this.log.info(`├─┬─ plugin ${plg}${plugin.name}${nf}: "${plg}${BRIGHT}${plugin.description}${RESET}${nf}" type: ${typ}${plugin.type}${nf} ${plugin.enabled ? GREEN : RED}enabled ${plugin.paired ? GREEN : RED}paired${nf}`);
|
|
276
|
+
this.log.info(`│ └─ entry ${UNDERLINE}${db}${plugin.path}${UNDERLINEOFF}${db}`);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.log.info(`└─┬─ plugin ${plg}${plugin.name}${nf}: "${plg}${BRIGHT}${plugin.description}${RESET}${nf}" type: ${typ}${plugin.type}${nf} ${plugin.enabled ? GREEN : RED}enabled ${plugin.paired ? GREEN : RED}paired${nf}`);
|
|
280
|
+
this.log.info(` └─ entry ${UNDERLINE}${db}${plugin.path}${UNDERLINEOFF}${db}`);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
const serializedRegisteredDevices = await this.nodeContext?.get('devices', []);
|
|
284
|
+
this.log.info('│ Registered devices');
|
|
285
|
+
serializedRegisteredDevices?.forEach((device, index) => {
|
|
286
|
+
if (index !== serializedRegisteredDevices.length - 1) {
|
|
287
|
+
this.log.info(`├─┬─ plugin ${plg}${device.pluginName}${nf} device: ${dev}${device.deviceName}${nf} uniqueId: ${YELLOW}${device.uniqueId}${nf}`);
|
|
288
|
+
this.log.info(`│ └─ endpoint ${RED}${device.endpoint}${nf} ${typ}${device.endpointName}${nf} ${debugStringify(device.clusterServersId)}`);
|
|
280
289
|
}
|
|
281
290
|
else {
|
|
282
|
-
this.log.info(
|
|
283
|
-
this.log.info(
|
|
291
|
+
this.log.info(`└─┬─ plugin ${plg}${device.pluginName}${nf} device: ${dev}${device.deviceName}${nf} uniqueId: ${YELLOW}${device.uniqueId}${nf}`);
|
|
292
|
+
this.log.info(` └─ endpoint ${RED}${device.endpoint}${nf} ${typ}${device.endpointName}${nf} ${debugStringify(device.clusterServersId)}`);
|
|
284
293
|
}
|
|
285
294
|
});
|
|
286
295
|
this.emit('shutdown');
|
|
@@ -641,7 +650,9 @@ export class Matterbridge extends EventEmitter {
|
|
|
641
650
|
this.log.info('Saving registered devices...');
|
|
642
651
|
const serializedRegisteredDevices = [];
|
|
643
652
|
this.registeredDevices.forEach((registeredDevice) => {
|
|
644
|
-
|
|
653
|
+
const serializedMatterbridgeDevice = registeredDevice.device.serialize(registeredDevice.plugin);
|
|
654
|
+
//this.log.info(`- ${serializedMatterbridgeDevice.deviceName}${rs}\n`, serializedMatterbridgeDevice);
|
|
655
|
+
serializedRegisteredDevices.push(serializedMatterbridgeDevice);
|
|
645
656
|
});
|
|
646
657
|
await this.nodeContext.set('devices', serializedRegisteredDevices);
|
|
647
658
|
this.log.info('Saved registered devices');
|
|
@@ -812,10 +823,10 @@ export class Matterbridge extends EventEmitter {
|
|
|
812
823
|
if (plugin.addedDevices !== undefined)
|
|
813
824
|
plugin.addedDevices--;
|
|
814
825
|
}
|
|
815
|
-
//
|
|
826
|
+
// Remove the device in childbridge mode
|
|
816
827
|
if (this.bridgeMode === 'childbridge') {
|
|
817
828
|
if (plugin.type === 'AccessoryPlatform') {
|
|
818
|
-
this.log.
|
|
829
|
+
this.log.info(`Removing bridged device ${dev}${device.deviceName}${nf} (${dev}${device.name}${nf}) for plugin ${plg}${pluginName}${nf}: AccessoryPlatform not supported in childbridge mode`);
|
|
819
830
|
}
|
|
820
831
|
else if (plugin.type === 'DynamicPlatform') {
|
|
821
832
|
this.registeredDevices.forEach((registeredDevice, index) => {
|
|
@@ -844,7 +855,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
844
855
|
async removeAllBridgedDevices(pluginName) {
|
|
845
856
|
const plugin = this.findPlugin(pluginName);
|
|
846
857
|
if (this.bridgeMode === 'childbridge' && plugin?.type === 'AccessoryPlatform') {
|
|
847
|
-
this.log.
|
|
858
|
+
this.log.info(`Removing devices for plugin ${plg}${pluginName}${nf}: AccessoryPlatform not supported in childbridge mode`);
|
|
848
859
|
return;
|
|
849
860
|
}
|
|
850
861
|
const devicesToRemove = [];
|
|
@@ -2168,7 +2179,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2168
2179
|
*
|
|
2169
2180
|
* @param port The port number to run the frontend server on. Default is 3000.
|
|
2170
2181
|
*/
|
|
2171
|
-
async initializeFrontend(port =
|
|
2182
|
+
async initializeFrontend(port = 8283) {
|
|
2172
2183
|
this.log.debug(`Initializing the frontend on port ${YELLOW}${port}${db} static ${UNDERLINE}${path.join(this.rootDirectory, 'frontend/build')}${UNDERLINEOFF}${rs}`);
|
|
2173
2184
|
this.expressApp = express();
|
|
2174
2185
|
// Serve React build directory
|
|
@@ -2193,6 +2204,24 @@ export class Matterbridge extends EventEmitter {
|
|
|
2193
2204
|
res.json({ valid: false });
|
|
2194
2205
|
}
|
|
2195
2206
|
});
|
|
2207
|
+
// Endpoint to provide manual pairing code
|
|
2208
|
+
this.expressApp.get('/api/pairing-code', (req, res) => {
|
|
2209
|
+
this.log.debug('The frontend sent /api/pairing-code');
|
|
2210
|
+
if (!this.matterbridgeContext) {
|
|
2211
|
+
this.log.error('/api/pairing-code matterbridgeContext not found');
|
|
2212
|
+
res.json([]);
|
|
2213
|
+
return;
|
|
2214
|
+
}
|
|
2215
|
+
try {
|
|
2216
|
+
const qrData = { qrPairingCode: this.matterbridgeContext.get('qrPairingCode'), manualPairingCode: this.matterbridgeContext.get('manualPairingCode') };
|
|
2217
|
+
res.json(qrData);
|
|
2218
|
+
}
|
|
2219
|
+
catch (error) {
|
|
2220
|
+
if (this.bridgeMode === 'bridge')
|
|
2221
|
+
this.log.error('qrPairingCode for /api/qr-code not found');
|
|
2222
|
+
res.json({});
|
|
2223
|
+
}
|
|
2224
|
+
});
|
|
2196
2225
|
// Endpoint to provide QR pairing code
|
|
2197
2226
|
this.expressApp.get('/api/qr-code', (req, res) => {
|
|
2198
2227
|
this.log.debug('The frontend sent /api/qr-code');
|
|
@@ -2307,7 +2336,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2307
2336
|
res.status(400).json({ error: 'No command provided' });
|
|
2308
2337
|
return;
|
|
2309
2338
|
}
|
|
2310
|
-
this.log.
|
|
2339
|
+
this.log.info(`Received frontend command: ${command}:${param}`);
|
|
2311
2340
|
// Handle the command setpassword from Settings
|
|
2312
2341
|
if (command === 'setpassword') {
|
|
2313
2342
|
const password = param.slice(1, -1); // Remove the first and last characters
|
|
@@ -2357,10 +2386,6 @@ export class Matterbridge extends EventEmitter {
|
|
|
2357
2386
|
}
|
|
2358
2387
|
this.updateProcess();
|
|
2359
2388
|
}
|
|
2360
|
-
// Handle the command update from Header
|
|
2361
|
-
if (command === 'update') {
|
|
2362
|
-
this.log.warn(`The /api/command/${command} is not yet implemented`);
|
|
2363
|
-
}
|
|
2364
2389
|
// Handle the command installplugin from Home
|
|
2365
2390
|
if (command === 'installplugin') {
|
|
2366
2391
|
param = param.replace(/\*/g, '\\');
|