@matterbridge/core 3.6.2-dev-20260314-f95be8a → 3.6.2-dev-20260315-d23fd18
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.d.ts +1 -0
- package/dist/frontend.js +149 -100
- package/package.json +5 -7
package/dist/frontend.d.ts
CHANGED
|
@@ -56,5 +56,6 @@ export declare class Frontend extends EventEmitter<FrontendEvents> {
|
|
|
56
56
|
wssSendCloseSnackbarMessage(message: string): void;
|
|
57
57
|
wssSendAttributeChangedMessage(plugin: string, serialNumber: string, uniqueId: string, number: EndpointNumber, id: string, cluster: string, attribute: string, value: number | string | boolean | null): void;
|
|
58
58
|
wssBroadcastMessage(msg: WsMessageBroadcast): void;
|
|
59
|
+
zip(command: 'zip' | 'verify' | 'unzip', archivePath: string, sourcePaths: string[], destinationPath: string): void;
|
|
59
60
|
}
|
|
60
61
|
export {};
|
package/dist/frontend.js
CHANGED
|
@@ -16,7 +16,6 @@ import { inspectError } from '@matterbridge/utils/error';
|
|
|
16
16
|
import { formatBytes, formatPercent, formatUptime } from '@matterbridge/utils/format';
|
|
17
17
|
import { isValidArray, isValidBoolean, isValidNumber, isValidObject, isValidString } from '@matterbridge/utils/validate';
|
|
18
18
|
import { wait, withTimeout } from '@matterbridge/utils/wait';
|
|
19
|
-
import { createZip } from '@matterbridge/utils/zip';
|
|
20
19
|
import { AnsiLogger, CYAN, db, debugStringify, er, nf, nt, rs, stringify, UNDERLINE, UNDERLINEOFF, YELLOW } from 'node-ansi-logger';
|
|
21
20
|
import { cliEmitter, lastOsCpuUsage, lastProcessCpuUsage } from './cliEmitter.js';
|
|
22
21
|
import { generateHistoryPage } from './cliHistory.js';
|
|
@@ -134,6 +133,29 @@ export class Frontend extends EventEmitter {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
break;
|
|
136
|
+
case 'manager_archive_response':
|
|
137
|
+
if (msg.result &&
|
|
138
|
+
msg.result.success &&
|
|
139
|
+
isValidString(msg.result.command) &&
|
|
140
|
+
isValidString(msg.result.archivePath) &&
|
|
141
|
+
isValidArray(msg.result.sourcePaths) &&
|
|
142
|
+
isValidString(msg.result.destinationPath)) {
|
|
143
|
+
this.log.debug(`***Received broadcast response ${CYAN}${msg.type}${db} from ${CYAN}${msg.src}${db}: ${debugStringify(msg)}${db}`);
|
|
144
|
+
this.wssBroadcastMessage({
|
|
145
|
+
id: 0,
|
|
146
|
+
src: 'Matterbridge',
|
|
147
|
+
dst: 'Frontend',
|
|
148
|
+
method: 'archive',
|
|
149
|
+
success: true,
|
|
150
|
+
response: {
|
|
151
|
+
command: msg.result.command,
|
|
152
|
+
archivePath: msg.result.archivePath,
|
|
153
|
+
sourcePaths: msg.result.sourcePaths,
|
|
154
|
+
destinationPath: msg.result.destinationPath,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
137
159
|
}
|
|
138
160
|
}
|
|
139
161
|
}
|
|
@@ -496,6 +518,31 @@ export class Frontend extends EventEmitter {
|
|
|
496
518
|
res.status(500).send('Error reading matterbridge log file. Please enable the matterbridge log on file in the settings.');
|
|
497
519
|
}
|
|
498
520
|
});
|
|
521
|
+
this.expressApp.get('/api/download-mblog', async (req, res) => {
|
|
522
|
+
this.log.debug(`The frontend sent /api/download-mblog ${path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE)}`);
|
|
523
|
+
if (!this.validateReq(req, res))
|
|
524
|
+
return;
|
|
525
|
+
const fs = await import('node:fs');
|
|
526
|
+
try {
|
|
527
|
+
await fs.promises.access(path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), fs.constants.F_OK);
|
|
528
|
+
const data = await fs.promises.readFile(path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), 'utf8');
|
|
529
|
+
await fs.promises.writeFile(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), data, 'utf-8');
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
await fs.promises.writeFile(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), 'Enable the matterbridge log on file in the settings to download the matterbridge log.', 'utf-8');
|
|
533
|
+
this.log.debug(`Error in /api/download-mblog: ${error instanceof Error ? error.message : error}`);
|
|
534
|
+
}
|
|
535
|
+
res.type('text/plain; charset=utf-8');
|
|
536
|
+
res.download(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), 'matterbridge.log', (error) => {
|
|
537
|
+
if (error) {
|
|
538
|
+
this.log.error(`Error downloading log file ${MATTERBRIDGE_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
539
|
+
res.status(500).send('Error downloading the matterbridge log file');
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
this.log.debug(`Matterbridge log file ${MATTERBRIDGE_LOGGER_FILE} downloaded successfully`);
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
});
|
|
499
546
|
this.expressApp.get('/api/view-mjlog', async (req, res) => {
|
|
500
547
|
this.log.debug('The frontend sent /api/view-mjlog');
|
|
501
548
|
if (!this.validateReq(req, res))
|
|
@@ -511,6 +558,31 @@ export class Frontend extends EventEmitter {
|
|
|
511
558
|
res.status(500).send('Error reading matter log file. Please enable the matter log on file in the settings.');
|
|
512
559
|
}
|
|
513
560
|
});
|
|
561
|
+
this.expressApp.get('/api/download-mjlog', async (req, res) => {
|
|
562
|
+
this.log.debug(`The frontend sent /api/download-mjlog ${path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE)}`);
|
|
563
|
+
if (!this.validateReq(req, res))
|
|
564
|
+
return;
|
|
565
|
+
const fs = await import('node:fs');
|
|
566
|
+
try {
|
|
567
|
+
await fs.promises.access(path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE), fs.constants.F_OK);
|
|
568
|
+
const data = await fs.promises.readFile(path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE), 'utf8');
|
|
569
|
+
await fs.promises.writeFile(path.join(os.tmpdir(), MATTER_LOGGER_FILE), data, 'utf-8');
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
await fs.promises.writeFile(path.join(os.tmpdir(), MATTER_LOGGER_FILE), 'Enable the matter log on file in the settings to download the matter log.', 'utf-8');
|
|
573
|
+
this.log.debug(`Error in /api/download-mjlog: ${error instanceof Error ? error.message : error}`);
|
|
574
|
+
}
|
|
575
|
+
res.type('text/plain; charset=utf-8');
|
|
576
|
+
res.download(path.join(os.tmpdir(), MATTER_LOGGER_FILE), 'matter.log', (error) => {
|
|
577
|
+
if (error) {
|
|
578
|
+
this.log.error(`Error downloading log file ${MATTER_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
579
|
+
res.status(500).send('Error downloading the matter log file');
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
this.log.debug(`Matter log file ${MATTER_LOGGER_FILE} downloaded successfully`);
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
});
|
|
514
586
|
this.expressApp.get('/api/view-diagnostic', async (req, res) => {
|
|
515
587
|
this.log.debug('The frontend sent /api/view-diagnostic');
|
|
516
588
|
if (!this.validateReq(req, res))
|
|
@@ -547,6 +619,9 @@ export class Frontend extends EventEmitter {
|
|
|
547
619
|
this.log.error(`Error downloading file ${MATTERBRIDGE_DIAGNOSTIC_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
548
620
|
res.status(500).send('Error downloading the diagnostic log file');
|
|
549
621
|
}
|
|
622
|
+
else {
|
|
623
|
+
this.log.debug(`Diagnostic log file ${MATTERBRIDGE_DIAGNOSTIC_FILE} downloaded successfully`);
|
|
624
|
+
}
|
|
550
625
|
});
|
|
551
626
|
});
|
|
552
627
|
this.expressApp.get('/api/viewhistory', async (req, res) => {
|
|
@@ -579,6 +654,9 @@ export class Frontend extends EventEmitter {
|
|
|
579
654
|
this.log.error(`Error in /api/downloadhistory downloading history file ${MATTERBRIDGE_HISTORY_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
580
655
|
res.status(500).send('Error downloading history file');
|
|
581
656
|
}
|
|
657
|
+
else {
|
|
658
|
+
this.log.debug(`History file ${MATTERBRIDGE_HISTORY_FILE} downloaded successfully`);
|
|
659
|
+
}
|
|
582
660
|
});
|
|
583
661
|
}
|
|
584
662
|
catch (error) {
|
|
@@ -586,84 +664,18 @@ export class Frontend extends EventEmitter {
|
|
|
586
664
|
res.status(500).send('Error reading history file.');
|
|
587
665
|
}
|
|
588
666
|
});
|
|
589
|
-
this.expressApp.get('/api/
|
|
590
|
-
this.log.debug('The frontend sent /api/
|
|
591
|
-
if (!this.validateReq(req, res))
|
|
592
|
-
return;
|
|
593
|
-
try {
|
|
594
|
-
const fs = await import('node:fs');
|
|
595
|
-
const data = await fs.promises.readFile(path.join(this.matterbridge.matterbridgeDirectory, 'shelly.log'), 'utf8');
|
|
596
|
-
res.type('text/plain; charset=utf-8');
|
|
597
|
-
res.send(data);
|
|
598
|
-
}
|
|
599
|
-
catch (error) {
|
|
600
|
-
this.log.error(`Error reading shelly log file ${MATTERBRIDGE_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
601
|
-
res.status(500).send('Error reading shelly log file. Please create the shelly system log before loading it.');
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
this.expressApp.get('/api/download-mblog', async (req, res) => {
|
|
605
|
-
this.log.debug(`The frontend sent /api/download-mblog ${path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE)}`);
|
|
606
|
-
if (!this.validateReq(req, res))
|
|
607
|
-
return;
|
|
608
|
-
const fs = await import('node:fs');
|
|
609
|
-
try {
|
|
610
|
-
await fs.promises.access(path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), fs.constants.F_OK);
|
|
611
|
-
const data = await fs.promises.readFile(path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE), 'utf8');
|
|
612
|
-
await fs.promises.writeFile(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), data, 'utf-8');
|
|
613
|
-
}
|
|
614
|
-
catch (error) {
|
|
615
|
-
await fs.promises.writeFile(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), 'Enable the matterbridge log on file in the settings to download the matterbridge log.', 'utf-8');
|
|
616
|
-
this.log.debug(`Error in /api/download-mblog: ${error instanceof Error ? error.message : error}`);
|
|
617
|
-
}
|
|
618
|
-
res.type('text/plain; charset=utf-8');
|
|
619
|
-
res.download(path.join(os.tmpdir(), MATTERBRIDGE_LOGGER_FILE), 'matterbridge.log', (error) => {
|
|
620
|
-
if (error) {
|
|
621
|
-
this.log.error(`Error downloading log file ${MATTERBRIDGE_LOGGER_FILE}: ${error instanceof Error ? error.message : error}`);
|
|
622
|
-
res.status(500).send('Error downloading the matterbridge log file');
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
});
|
|
626
|
-
this.expressApp.get('/api/download-mjlog', async (req, res) => {
|
|
627
|
-
this.log.debug(`The frontend sent /api/download-mjlog ${path.join(this.matterbridge.matterbridgeDirectory, MATTERBRIDGE_LOGGER_FILE)}`);
|
|
667
|
+
this.expressApp.get('/api/download-backup', async (req, res) => {
|
|
668
|
+
this.log.debug('The frontend sent /api/download-backup');
|
|
628
669
|
if (!this.validateReq(req, res))
|
|
629
670
|
return;
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
await fs.promises.access(path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE), fs.constants.F_OK);
|
|
633
|
-
const data = await fs.promises.readFile(path.join(this.matterbridge.matterbridgeDirectory, MATTER_LOGGER_FILE), 'utf8');
|
|
634
|
-
await fs.promises.writeFile(path.join(os.tmpdir(), MATTER_LOGGER_FILE), data, 'utf-8');
|
|
635
|
-
}
|
|
636
|
-
catch (error) {
|
|
637
|
-
await fs.promises.writeFile(path.join(os.tmpdir(), MATTER_LOGGER_FILE), 'Enable the matter log on file in the settings to download the matter log.', 'utf-8');
|
|
638
|
-
this.log.debug(`Error in /api/download-mblog: ${error instanceof Error ? error.message : error}`);
|
|
639
|
-
}
|
|
640
|
-
res.type('text/plain; charset=utf-8');
|
|
641
|
-
res.download(path.join(os.tmpdir(), MATTER_LOGGER_FILE), 'matter.log', (error) => {
|
|
671
|
+
res.download(path.join(os.tmpdir(), `matterbridge.backup.zip`), `matterbridge.backup.zip`, (error) => {
|
|
672
|
+
this.wssSendCloseSnackbarMessage('Creating matterbridge backup...');
|
|
642
673
|
if (error) {
|
|
643
|
-
this.log.error(`Error downloading
|
|
644
|
-
res.status(500).send(
|
|
674
|
+
this.log.error(`Error downloading file matterbridge.backup.zip: ${error instanceof Error ? error.message : error}`);
|
|
675
|
+
res.status(500).send(`Error downloading file matterbridge.backup.zip: ${error instanceof Error ? error.message : error}`);
|
|
645
676
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
this.expressApp.get('/api/shellydownloadsystemlog', async (req, res) => {
|
|
649
|
-
this.log.debug('The frontend sent /api/shellydownloadsystemlog');
|
|
650
|
-
if (!this.validateReq(req, res))
|
|
651
|
-
return;
|
|
652
|
-
const fs = await import('node:fs');
|
|
653
|
-
try {
|
|
654
|
-
await fs.promises.access(path.join(this.matterbridge.matterbridgeDirectory, 'shelly.log'), fs.constants.F_OK);
|
|
655
|
-
const data = await fs.promises.readFile(path.join(this.matterbridge.matterbridgeDirectory, 'shelly.log'), 'utf8');
|
|
656
|
-
await fs.promises.writeFile(path.join(os.tmpdir(), 'shelly.log'), data, 'utf-8');
|
|
657
|
-
}
|
|
658
|
-
catch (error) {
|
|
659
|
-
await fs.promises.writeFile(path.join(os.tmpdir(), 'shelly.log'), 'Create the Shelly system log before downloading it.', 'utf-8');
|
|
660
|
-
this.log.debug(`Error in /api/shellydownloadsystemlog: ${error instanceof Error ? error.message : error}`);
|
|
661
|
-
}
|
|
662
|
-
res.type('text/plain; charset=utf-8');
|
|
663
|
-
res.download(path.join(os.tmpdir(), 'shelly.log'), 'shelly.log', (error) => {
|
|
664
|
-
if (error) {
|
|
665
|
-
this.log.error(`Error downloading Shelly system log file: ${error instanceof Error ? error.message : error}`);
|
|
666
|
-
res.status(500).send('Error downloading Shelly system log file');
|
|
677
|
+
else {
|
|
678
|
+
this.log.debug('Backup matterbridge.backup.zip downloaded successfully');
|
|
667
679
|
}
|
|
668
680
|
});
|
|
669
681
|
});
|
|
@@ -671,58 +683,59 @@ export class Frontend extends EventEmitter {
|
|
|
671
683
|
this.log.debug('The frontend sent /api/download-mbstorage');
|
|
672
684
|
if (!this.validateReq(req, res))
|
|
673
685
|
return;
|
|
674
|
-
await createZip(path.join(os.tmpdir(), `matterbridge.${NODE_STORAGE_DIR}.zip`), path.join(this.matterbridge.matterbridgeDirectory, NODE_STORAGE_DIR));
|
|
675
686
|
res.download(path.join(os.tmpdir(), `matterbridge.${NODE_STORAGE_DIR}.zip`), `matterbridge.${NODE_STORAGE_DIR}.zip`, (error) => {
|
|
687
|
+
this.wssSendCloseSnackbarMessage('Creating matterbridge storage backup...');
|
|
676
688
|
if (error) {
|
|
677
689
|
this.log.error(`Error downloading file ${`matterbridge.${NODE_STORAGE_DIR}.zip`}: ${error instanceof Error ? error.message : error}`);
|
|
678
690
|
res.status(500).send('Error downloading the matterbridge storage file');
|
|
679
691
|
}
|
|
692
|
+
else {
|
|
693
|
+
this.log.debug(`Matterbridge storage matterbridge.${NODE_STORAGE_DIR}.zip downloaded successfully`);
|
|
694
|
+
}
|
|
680
695
|
});
|
|
681
696
|
});
|
|
682
697
|
this.expressApp.get('/api/download-mjstorage', async (req, res) => {
|
|
683
698
|
this.log.debug('The frontend sent /api/download-mjstorage');
|
|
684
699
|
if (!this.validateReq(req, res))
|
|
685
700
|
return;
|
|
686
|
-
await createZip(path.join(os.tmpdir(), `matterbridge.${MATTER_STORAGE_NAME}.zip`), path.join(this.matterbridge.matterbridgeDirectory, MATTER_STORAGE_NAME));
|
|
687
701
|
res.download(path.join(os.tmpdir(), `matterbridge.${MATTER_STORAGE_NAME}.zip`), `matterbridge.${MATTER_STORAGE_NAME}.zip`, (error) => {
|
|
702
|
+
this.wssSendCloseSnackbarMessage('Creating matter storage backup...');
|
|
688
703
|
if (error) {
|
|
689
704
|
this.log.error(`Error downloading the matter storage matterbridge.${MATTER_STORAGE_NAME}.zip: ${error instanceof Error ? error.message : error}`);
|
|
690
705
|
res.status(500).send('Error downloading the matter storage zip file');
|
|
691
706
|
}
|
|
707
|
+
else {
|
|
708
|
+
this.log.debug(`Matter storage matterbridge.${MATTER_STORAGE_NAME}.zip downloaded successfully`);
|
|
709
|
+
}
|
|
692
710
|
});
|
|
693
711
|
});
|
|
694
712
|
this.expressApp.get('/api/download-pluginstorage', async (req, res) => {
|
|
695
713
|
this.log.debug('The frontend sent /api/download-pluginstorage');
|
|
696
714
|
if (!this.validateReq(req, res))
|
|
697
715
|
return;
|
|
698
|
-
await createZip(path.join(os.tmpdir(), `matterbridge.pluginstorage.zip`), this.matterbridge.matterbridgePluginDirectory);
|
|
699
716
|
res.download(path.join(os.tmpdir(), `matterbridge.pluginstorage.zip`), `matterbridge.pluginstorage.zip`, (error) => {
|
|
717
|
+
this.wssSendCloseSnackbarMessage('Creating plugin backup...');
|
|
700
718
|
if (error) {
|
|
701
719
|
this.log.error(`Error downloading file matterbridge.pluginstorage.zip: ${error instanceof Error ? error.message : error}`);
|
|
702
720
|
res.status(500).send('Error downloading the matterbridge plugin storage file');
|
|
703
721
|
}
|
|
722
|
+
else {
|
|
723
|
+
this.log.debug('Plugin storage matterbridge.pluginstorage.zip downloaded successfully');
|
|
724
|
+
}
|
|
704
725
|
});
|
|
705
726
|
});
|
|
706
727
|
this.expressApp.get('/api/download-pluginconfig', async (req, res) => {
|
|
707
728
|
this.log.debug('The frontend sent /api/download-pluginconfig');
|
|
708
729
|
if (!this.validateReq(req, res))
|
|
709
730
|
return;
|
|
710
|
-
await createZip(path.join(os.tmpdir(), `matterbridge.pluginconfig.zip`), path.relative(process.cwd(), path.join(this.matterbridge.matterbridgeDirectory, '*.config.json')));
|
|
711
731
|
res.download(path.join(os.tmpdir(), `matterbridge.pluginconfig.zip`), `matterbridge.pluginconfig.zip`, (error) => {
|
|
732
|
+
this.wssSendCloseSnackbarMessage('Creating config backup...');
|
|
712
733
|
if (error) {
|
|
713
734
|
this.log.error(`Error downloading file matterbridge.pluginconfig.zip: ${error instanceof Error ? error.message : error}`);
|
|
714
735
|
res.status(500).send('Error downloading the matterbridge plugin config file');
|
|
715
736
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
this.expressApp.get('/api/download-backup', async (req, res) => {
|
|
719
|
-
this.log.debug('The frontend sent /api/download-backup');
|
|
720
|
-
if (!this.validateReq(req, res))
|
|
721
|
-
return;
|
|
722
|
-
res.download(path.join(os.tmpdir(), `matterbridge.backup.zip`), `matterbridge.backup.zip`, (error) => {
|
|
723
|
-
if (error) {
|
|
724
|
-
this.log.error(`Error downloading file matterbridge.backup.zip: ${error instanceof Error ? error.message : error}`);
|
|
725
|
-
res.status(500).send(`Error downloading file matterbridge.backup.zip: ${error instanceof Error ? error.message : error}`);
|
|
737
|
+
else {
|
|
738
|
+
this.log.debug('Plugin config matterbridge.pluginconfig.zip downloaded successfully');
|
|
726
739
|
}
|
|
727
740
|
});
|
|
728
741
|
});
|
|
@@ -1231,11 +1244,7 @@ export class Frontend extends EventEmitter {
|
|
|
1231
1244
|
};
|
|
1232
1245
|
try {
|
|
1233
1246
|
data = JSON.parse(message.toString());
|
|
1234
|
-
if (!isValidNumber(data.id) ||
|
|
1235
|
-
!isValidString(data.dst) ||
|
|
1236
|
-
!isValidString(data.src) ||
|
|
1237
|
-
!isValidString(data.method) ||
|
|
1238
|
-
data.dst !== 'Matterbridge') {
|
|
1247
|
+
if (!isValidNumber(data.id) || !isValidString(data.dst) || !isValidString(data.src) || !isValidString(data.method) || data.dst !== 'Matterbridge') {
|
|
1239
1248
|
this.log.error(`Invalid message from websocket client: ${debugStringify(data)}`);
|
|
1240
1249
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: 'Invalid message' });
|
|
1241
1250
|
return;
|
|
@@ -1490,12 +1499,35 @@ export class Frontend extends EventEmitter {
|
|
|
1490
1499
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1491
1500
|
}
|
|
1492
1501
|
else if (data.method === '/api/create-backup') {
|
|
1493
|
-
this.wssSendSnackbarMessage('Creating backup...', 0);
|
|
1494
|
-
this.log.notice(`Creating
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1502
|
+
this.wssSendSnackbarMessage('Creating matterbridge backup...', 0);
|
|
1503
|
+
this.log.notice(`Creating matterbridge backup...`);
|
|
1504
|
+
this.zip('zip', path.join(os.tmpdir(), `matterbridge.backup.zip`), [this.matterbridge.matterbridgeDirectory, this.matterbridge.matterbridgePluginDirectory, this.matterbridge.matterbridgeCertDirectory], '');
|
|
1505
|
+
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1506
|
+
}
|
|
1507
|
+
else if (data.method === '/api/create-matterbridge-storage-backup') {
|
|
1508
|
+
this.wssSendSnackbarMessage('Creating matterbridge storage backup...', 0);
|
|
1509
|
+
this.log.notice(`Creating matterbridge storage backup...`);
|
|
1510
|
+
this.zip('zip', path.join(os.tmpdir(), `matterbridge.${NODE_STORAGE_DIR}.zip`), [path.join(this.matterbridge.matterbridgeDirectory, NODE_STORAGE_DIR)], '');
|
|
1511
|
+
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1512
|
+
}
|
|
1513
|
+
else if (data.method === '/api/create-matter-storage-backup') {
|
|
1514
|
+
this.wssSendSnackbarMessage('Creating matter storage backup...', 0);
|
|
1515
|
+
this.log.notice(`Creating matter storage backup...`);
|
|
1516
|
+
this.zip('zip', path.join(os.tmpdir(), `matterbridge.${MATTER_STORAGE_NAME}.zip`), [path.join(this.matterbridge.matterbridgeDirectory, MATTER_STORAGE_NAME)], '');
|
|
1517
|
+
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1518
|
+
}
|
|
1519
|
+
else if (data.method === '/api/create-plugin-backup') {
|
|
1520
|
+
this.wssSendSnackbarMessage('Creating plugin backup...', 0);
|
|
1521
|
+
this.log.notice(`Creating plugin backup...`);
|
|
1522
|
+
this.zip('zip', path.join(os.tmpdir(), `matterbridge.pluginstorage.zip`), [this.matterbridge.matterbridgePluginDirectory], '');
|
|
1523
|
+
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1524
|
+
}
|
|
1525
|
+
else if (data.method === '/api/create-config-backup') {
|
|
1526
|
+
this.wssSendSnackbarMessage('Creating config backup...', 0);
|
|
1527
|
+
this.log.notice(`Creating config backup...`);
|
|
1528
|
+
const plugins = (await this.server.fetch({ type: 'plugins_storagepluginarray', src: this.server.name, dst: 'plugins' }, 5000)).result.plugins || [];
|
|
1529
|
+
const pluginsPaths = plugins.map((p) => path.join(this.matterbridge.matterbridgeDirectory, p.name + '.config.json'));
|
|
1530
|
+
this.zip('zip', path.join(os.tmpdir(), `matterbridge.pluginconfig.zip`), pluginsPaths, '');
|
|
1499
1531
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1500
1532
|
}
|
|
1501
1533
|
else if (data.method === '/api/unregister') {
|
|
@@ -2120,4 +2152,21 @@ export class Frontend extends EventEmitter {
|
|
|
2120
2152
|
}
|
|
2121
2153
|
});
|
|
2122
2154
|
}
|
|
2155
|
+
zip(command, archivePath, sourcePaths, destinationPath) {
|
|
2156
|
+
this.server.request({
|
|
2157
|
+
type: 'manager_run',
|
|
2158
|
+
src: 'frontend',
|
|
2159
|
+
dst: 'manager',
|
|
2160
|
+
params: {
|
|
2161
|
+
name: 'ArchiveCommand',
|
|
2162
|
+
workerData: {
|
|
2163
|
+
threadName: 'ArchiveCommand',
|
|
2164
|
+
command,
|
|
2165
|
+
archivePath,
|
|
2166
|
+
sourcePaths,
|
|
2167
|
+
destinationPath,
|
|
2168
|
+
},
|
|
2169
|
+
},
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2123
2172
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.6.2-dev-
|
|
3
|
+
"version": "3.6.2-dev-20260315-d23fd18",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -122,13 +122,11 @@
|
|
|
122
122
|
],
|
|
123
123
|
"dependencies": {
|
|
124
124
|
"@matter/main": "0.16.10",
|
|
125
|
-
"@matterbridge/dgram": "3.6.2-dev-
|
|
126
|
-
"@matterbridge/thread": "3.6.2-dev-
|
|
127
|
-
"@matterbridge/types": "3.6.2-dev-
|
|
128
|
-
"@matterbridge/utils": "3.6.2-dev-
|
|
129
|
-
"archiver": "7.0.1",
|
|
125
|
+
"@matterbridge/dgram": "3.6.2-dev-20260315-d23fd18",
|
|
126
|
+
"@matterbridge/thread": "3.6.2-dev-20260315-d23fd18",
|
|
127
|
+
"@matterbridge/types": "3.6.2-dev-20260315-d23fd18",
|
|
128
|
+
"@matterbridge/utils": "3.6.2-dev-20260315-d23fd18",
|
|
130
129
|
"express": "5.2.1",
|
|
131
|
-
"glob": "13.0.6",
|
|
132
130
|
"multer": "2.1.1",
|
|
133
131
|
"node-ansi-logger": "3.2.0",
|
|
134
132
|
"node-persist-manager": "2.0.1",
|