homebridge-config-ui-x 5.9.1-beta.1 → 5.9.1-beta.10
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 +23 -3
- package/TODO-MATTER.md +15 -0
- package/dist/app.controller.d.ts +1 -1
- package/dist/app.controller.js +14 -12
- package/dist/app.controller.js.map +1 -1
- package/dist/app.gateway.js +7 -10
- package/dist/app.gateway.js.map +1 -1
- package/dist/app.module.js +42 -43
- package/dist/app.module.js.map +1 -1
- package/dist/app.service.js +4 -7
- package/dist/app.service.js.map +1 -1
- package/dist/bin/base-platform.d.ts +1 -1
- package/dist/bin/base-platform.js +11 -17
- package/dist/bin/base-platform.js.map +1 -1
- package/dist/bin/fork.js +7 -45
- package/dist/bin/fork.js.map +1 -1
- package/dist/bin/hb-service.js +224 -243
- package/dist/bin/hb-service.js.map +1 -1
- package/dist/bin/platforms/darwin.d.ts +1 -1
- package/dist/bin/platforms/darwin.js +61 -65
- package/dist/bin/platforms/darwin.js.map +1 -1
- package/dist/bin/platforms/freebsd.d.ts +1 -1
- package/dist/bin/platforms/freebsd.js +42 -47
- package/dist/bin/platforms/freebsd.js.map +1 -1
- package/dist/bin/platforms/linux.d.ts +1 -1
- package/dist/bin/platforms/linux.js +127 -132
- package/dist/bin/platforms/linux.js.map +1 -1
- package/dist/bin/platforms/win32.d.ts +1 -1
- package/dist/bin/platforms/win32.js +30 -36
- package/dist/bin/platforms/win32.js.map +1 -1
- package/dist/bin/standalone.js +15 -53
- package/dist/bin/standalone.js.map +1 -1
- package/dist/core/auth/auth.controller.d.ts +5 -4
- package/dist/core/auth/auth.controller.js +40 -39
- package/dist/core/auth/auth.controller.js.map +1 -1
- package/dist/core/auth/auth.dto.js +17 -18
- package/dist/core/auth/auth.dto.js.map +1 -1
- package/dist/core/auth/auth.module.js +28 -31
- package/dist/core/auth/auth.module.js.map +1 -1
- package/dist/core/auth/auth.service.d.ts +3 -3
- package/dist/core/auth/auth.service.js +65 -62
- package/dist/core/auth/auth.service.js.map +1 -1
- package/dist/core/auth/guards/admin.guard.js +4 -7
- package/dist/core/auth/guards/admin.guard.js.map +1 -1
- package/dist/core/auth/guards/custom.guard.js +6 -9
- package/dist/core/auth/guards/custom.guard.js.map +1 -1
- package/dist/core/auth/guards/ws-admin-guard.d.ts +2 -2
- package/dist/core/auth/guards/ws-admin-guard.js +13 -11
- package/dist/core/auth/guards/ws-admin-guard.js.map +1 -1
- package/dist/core/auth/guards/ws.guard.d.ts +2 -2
- package/dist/core/auth/guards/ws.guard.js +13 -11
- package/dist/core/auth/guards/ws.guard.js.map +1 -1
- package/dist/core/auth/jwt.strategy.d.ts +3 -2
- package/dist/core/auth/jwt.strategy.js +21 -16
- package/dist/core/auth/jwt.strategy.js.map +1 -1
- package/dist/core/config/config.interfaces.d.ts +8 -1
- package/dist/core/config/config.interfaces.js +1 -2
- package/dist/core/config/config.module.js +8 -10
- package/dist/core/config/config.module.js.map +1 -1
- package/dist/core/config/config.service.d.ts +4 -3
- package/dist/core/config/config.service.js +90 -83
- package/dist/core/config/config.service.js.map +1 -1
- package/dist/core/config/config.startup.d.ts +1 -1
- package/dist/core/config/config.startup.js +23 -28
- package/dist/core/config/config.startup.js.map +1 -1
- package/dist/core/feature-flags/feature-flags.registry.js +2 -5
- package/dist/core/feature-flags/feature-flags.registry.js.map +1 -1
- package/dist/core/homebridge-ipc/homebridge-ipc.module.js +11 -14
- package/dist/core/homebridge-ipc/homebridge-ipc.module.js.map +1 -1
- package/dist/core/homebridge-ipc/homebridge-ipc.service.d.ts +4 -4
- package/dist/core/homebridge-ipc/homebridge-ipc.service.js +25 -19
- package/dist/core/homebridge-ipc/homebridge-ipc.service.js.map +1 -1
- package/dist/core/logger/logger.module.js +8 -10
- package/dist/core/logger/logger.module.js.map +1 -1
- package/dist/core/logger/logger.service.js +13 -23
- package/dist/core/logger/logger.service.js.map +1 -1
- package/dist/core/node-pty/node-pty.module.js +7 -10
- package/dist/core/node-pty/node-pty.module.js.map +1 -1
- package/dist/core/node-pty/node-pty.service.js +6 -11
- package/dist/core/node-pty/node-pty.service.js.map +1 -1
- package/dist/core/node-version.constants.js +4 -11
- package/dist/core/node-version.constants.js.map +1 -1
- package/dist/core/scheduler/scheduler.module.js +15 -10
- package/dist/core/scheduler/scheduler.module.js.map +1 -1
- package/dist/core/scheduler/scheduler.service.d.ts +12 -1
- package/dist/core/scheduler/scheduler.service.js +101 -13
- package/dist/core/scheduler/scheduler.service.js.map +1 -1
- package/dist/core/spa/spa-html.service.js +9 -15
- package/dist/core/spa/spa-html.service.js.map +1 -1
- package/dist/core/spa/spa.filter.d.ts +1 -1
- package/dist/core/spa/spa.filter.js +11 -16
- package/dist/core/spa/spa.filter.js.map +1 -1
- package/dist/core/ssl/ssl-cert-generator.service.js +34 -36
- package/dist/core/ssl/ssl-cert-generator.service.js.map +1 -1
- package/dist/env-setup.d.ts +1 -0
- package/dist/env-setup.js +7 -0
- package/dist/env-setup.js.map +1 -0
- package/dist/globalDefaults.d.ts +1 -0
- package/dist/globalDefaults.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -19
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +5 -3
- package/dist/main.js +44 -51
- package/dist/main.js.map +1 -1
- package/dist/modules/accessories/accessories.controller.d.ts +3 -3
- package/dist/modules/accessories/accessories.controller.js +28 -29
- package/dist/modules/accessories/accessories.controller.js.map +1 -1
- package/dist/modules/accessories/accessories.dto.js +11 -13
- package/dist/modules/accessories/accessories.dto.js.map +1 -1
- package/dist/modules/accessories/accessories.gateway.d.ts +2 -2
- package/dist/modules/accessories/accessories.gateway.js +18 -16
- package/dist/modules/accessories/accessories.gateway.js.map +1 -1
- package/dist/modules/accessories/accessories.interfaces.d.ts +94 -0
- package/dist/modules/accessories/accessories.interfaces.js +2 -0
- package/dist/modules/accessories/accessories.interfaces.js.map +1 -0
- package/dist/modules/accessories/accessories.module.js +19 -20
- package/dist/modules/accessories/accessories.module.js.map +1 -1
- package/dist/modules/accessories/accessories.service.d.ts +23 -5
- package/dist/modules/accessories/accessories.service.js +316 -51
- package/dist/modules/accessories/accessories.service.js.map +1 -1
- package/dist/modules/backup/backup.controller.d.ts +4 -4
- package/dist/modules/backup/backup.controller.js +68 -67
- package/dist/modules/backup/backup.controller.js.map +1 -1
- package/dist/modules/backup/backup.gateway.d.ts +4 -4
- package/dist/modules/backup/backup.gateway.js +25 -21
- package/dist/modules/backup/backup.gateway.js.map +1 -1
- package/dist/modules/backup/backup.module.js +22 -25
- package/dist/modules/backup/backup.module.js.map +1 -1
- package/dist/modules/backup/backup.service.d.ts +5 -5
- package/dist/modules/backup/backup.service.js +143 -133
- package/dist/modules/backup/backup.service.js.map +1 -1
- package/dist/modules/child-bridges/child-bridges.gateway.d.ts +3 -3
- package/dist/modules/child-bridges/child-bridges.gateway.js +23 -21
- package/dist/modules/child-bridges/child-bridges.gateway.js.map +1 -1
- package/dist/modules/child-bridges/child-bridges.interfaces.js +1 -2
- package/dist/modules/child-bridges/child-bridges.module.js +19 -22
- package/dist/modules/child-bridges/child-bridges.module.js.map +1 -1
- package/dist/modules/child-bridges/child-bridges.service.d.ts +3 -3
- package/dist/modules/child-bridges/child-bridges.service.js +15 -11
- package/dist/modules/child-bridges/child-bridges.service.js.map +1 -1
- package/dist/modules/config-editor/config-editor.controller.d.ts +13 -11
- package/dist/modules/config-editor/config-editor.controller.js +168 -103
- package/dist/modules/config-editor/config-editor.controller.js.map +1 -1
- package/dist/modules/config-editor/config-editor.dto.d.ts +6 -0
- package/dist/modules/config-editor/config-editor.dto.js +40 -0
- package/dist/modules/config-editor/config-editor.dto.js.map +1 -0
- package/dist/modules/config-editor/config-editor.module.js +21 -24
- package/dist/modules/config-editor/config-editor.module.js.map +1 -1
- package/dist/modules/config-editor/config-editor.service.d.ts +11 -8
- package/dist/modules/config-editor/config-editor.service.js +123 -66
- package/dist/modules/config-editor/config-editor.service.js.map +1 -1
- package/dist/modules/custom-plugins/custom-plugins.module.js +10 -13
- package/dist/modules/custom-plugins/custom-plugins.module.js.map +1 -1
- package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.d.ts +2 -2
- package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.js +21 -19
- package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.js.map +1 -1
- package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.js +14 -17
- package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.js.map +1 -1
- package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.d.ts +2 -2
- package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.js +18 -15
- package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.js.map +1 -1
- package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.d.ts +2 -2
- package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.js +21 -19
- package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.js.map +1 -1
- package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.module.js +14 -17
- package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.module.js.map +1 -1
- package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.d.ts +2 -2
- package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.js +18 -15
- package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.js.map +1 -1
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.d.ts +2 -2
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js +18 -19
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js.map +1 -1
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.d.ts +2 -2
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.js +15 -13
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.js.map +1 -1
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.module.js +18 -21
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.module.js.map +1 -1
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.d.ts +8 -8
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js +47 -41
- package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js.map +1 -1
- package/dist/modules/log/log.gateway.d.ts +3 -3
- package/dist/modules/log/log.gateway.js +15 -13
- package/dist/modules/log/log.gateway.js.map +1 -1
- package/dist/modules/log/log.interfaces.js +1 -2
- package/dist/modules/log/log.module.js +14 -17
- package/dist/modules/log/log.module.js.map +1 -1
- package/dist/modules/log/log.service.d.ts +5 -5
- package/dist/modules/log/log.service.js +47 -43
- package/dist/modules/log/log.service.js.map +1 -1
- package/dist/modules/platform-tools/docker/docker.controller.d.ts +1 -1
- package/dist/modules/platform-tools/docker/docker.controller.js +24 -25
- package/dist/modules/platform-tools/docker/docker.controller.js.map +1 -1
- package/dist/modules/platform-tools/docker/docker.module.js +14 -17
- package/dist/modules/platform-tools/docker/docker.module.js.map +1 -1
- package/dist/modules/platform-tools/docker/docker.service.d.ts +2 -2
- package/dist/modules/platform-tools/docker/docker.service.js +20 -16
- package/dist/modules/platform-tools/docker/docker.service.js.map +1 -1
- package/dist/modules/platform-tools/hb-service/hb-service.controller.d.ts +2 -2
- package/dist/modules/platform-tools/hb-service/hb-service.controller.js +35 -36
- package/dist/modules/platform-tools/hb-service/hb-service.controller.js.map +1 -1
- package/dist/modules/platform-tools/hb-service/hb-service.dto.js +20 -19
- package/dist/modules/platform-tools/hb-service/hb-service.dto.js.map +1 -1
- package/dist/modules/platform-tools/hb-service/hb-service.module.js +14 -17
- package/dist/modules/platform-tools/hb-service/hb-service.module.js.map +1 -1
- package/dist/modules/platform-tools/hb-service/hb-service.service.d.ts +3 -3
- package/dist/modules/platform-tools/hb-service/hb-service.service.js +37 -30
- package/dist/modules/platform-tools/hb-service/hb-service.service.js.map +1 -1
- package/dist/modules/platform-tools/linux/linux.controller.d.ts +1 -1
- package/dist/modules/platform-tools/linux/linux.controller.js +23 -21
- package/dist/modules/platform-tools/linux/linux.controller.js.map +1 -1
- package/dist/modules/platform-tools/linux/linux.module.js +14 -17
- package/dist/modules/platform-tools/linux/linux.module.js.map +1 -1
- package/dist/modules/platform-tools/linux/linux.service.d.ts +2 -2
- package/dist/modules/platform-tools/linux/linux.service.js +18 -14
- package/dist/modules/platform-tools/linux/linux.service.js.map +1 -1
- package/dist/modules/platform-tools/platform-tools.module.js +12 -15
- package/dist/modules/platform-tools/platform-tools.module.js.map +1 -1
- package/dist/modules/platform-tools/terminal/terminal.controller.d.ts +1 -1
- package/dist/modules/platform-tools/terminal/terminal.controller.js +15 -13
- package/dist/modules/platform-tools/terminal/terminal.controller.js.map +1 -1
- package/dist/modules/platform-tools/terminal/terminal.gateway.d.ts +2 -2
- package/dist/modules/platform-tools/terminal/terminal.gateway.js +17 -15
- package/dist/modules/platform-tools/terminal/terminal.gateway.js.map +1 -1
- package/dist/modules/platform-tools/terminal/terminal.interfaces.js +1 -2
- package/dist/modules/platform-tools/terminal/terminal.module.js +18 -21
- package/dist/modules/platform-tools/terminal/terminal.module.js.map +1 -1
- package/dist/modules/platform-tools/terminal/terminal.service.d.ts +7 -7
- package/dist/modules/platform-tools/terminal/terminal.service.js +33 -28
- package/dist/modules/platform-tools/terminal/terminal.service.js.map +1 -1
- package/dist/modules/plugins/plugins.controller.d.ts +12 -7
- package/dist/modules/plugins/plugins.controller.js +100 -52
- package/dist/modules/plugins/plugins.controller.js.map +1 -1
- package/dist/modules/plugins/plugins.dto.js +26 -24
- package/dist/modules/plugins/plugins.dto.js.map +1 -1
- package/dist/modules/plugins/plugins.gateway.d.ts +5 -5
- package/dist/modules/plugins/plugins.gateway.js +38 -34
- package/dist/modules/plugins/plugins.gateway.js.map +1 -1
- package/dist/modules/plugins/plugins.interfaces.js +1 -2
- package/dist/modules/plugins/plugins.module.js +27 -26
- package/dist/modules/plugins/plugins.module.js.map +1 -1
- package/dist/modules/plugins/plugins.service.d.ts +26 -13
- package/dist/modules/plugins/plugins.service.js +365 -203
- package/dist/modules/plugins/plugins.service.js.map +1 -1
- package/dist/modules/server/server.controller.d.ts +7 -7
- package/dist/modules/server/server.controller.js +208 -205
- package/dist/modules/server/server.controller.js.map +1 -1
- package/dist/modules/server/server.dto.js +13 -16
- package/dist/modules/server/server.dto.js.map +1 -1
- package/dist/modules/server/server.module.js +23 -26
- package/dist/modules/server/server.module.js.map +1 -1
- package/dist/modules/server/server.service.d.ts +6 -6
- package/dist/modules/server/server.service.js +202 -224
- package/dist/modules/server/server.service.js.map +1 -1
- package/dist/modules/setup-wizard/setup-wizard.controller.d.ts +3 -3
- package/dist/modules/setup-wizard/setup-wizard.controller.js +19 -20
- package/dist/modules/setup-wizard/setup-wizard.controller.js.map +1 -1
- package/dist/modules/setup-wizard/setup-wizard.gateway.d.ts +4 -4
- package/dist/modules/setup-wizard/setup-wizard.gateway.js +25 -21
- package/dist/modules/setup-wizard/setup-wizard.gateway.js.map +1 -1
- package/dist/modules/setup-wizard/setup-wizard.guard.d.ts +2 -2
- package/dist/modules/setup-wizard/setup-wizard.guard.js +11 -9
- package/dist/modules/setup-wizard/setup-wizard.guard.js.map +1 -1
- package/dist/modules/setup-wizard/setup-wizard.module.js +12 -15
- package/dist/modules/setup-wizard/setup-wizard.module.js.map +1 -1
- package/dist/modules/status/status.controller.d.ts +5 -5
- package/dist/modules/status/status.controller.js +40 -36
- package/dist/modules/status/status.controller.js.map +1 -1
- package/dist/modules/status/status.gateway.d.ts +11 -11
- package/dist/modules/status/status.gateway.js +51 -47
- package/dist/modules/status/status.gateway.js.map +1 -1
- package/dist/modules/status/status.interfaces.js +2 -5
- package/dist/modules/status/status.interfaces.js.map +1 -1
- package/dist/modules/status/status.module.js +26 -29
- package/dist/modules/status/status.module.js.map +1 -1
- package/dist/modules/status/status.service.d.ts +13 -13
- package/dist/modules/status/status.service.js +100 -88
- package/dist/modules/status/status.service.js.map +1 -1
- package/dist/modules/users/users.controller.d.ts +3 -3
- package/dist/modules/users/users.controller.js +59 -60
- package/dist/modules/users/users.controller.js.map +1 -1
- package/dist/modules/users/users.dto.js +51 -45
- package/dist/modules/users/users.dto.js.map +1 -1
- package/dist/modules/users/users.module.js +14 -17
- package/dist/modules/users/users.module.js.map +1 -1
- package/dist/self-check.js +25 -25
- package/dist/self-check.js.map +1 -1
- package/package.json +14 -12
- package/public/3rdpartylicenses.txt +26 -26
- package/public/{chunk-6KT3BYU6.js → chunk-2UCXG3TD.js} +1 -1
- package/public/{chunk-5T4JHJYL.js → chunk-2VYE34OE.js} +1 -1
- package/public/{chunk-TOYVIOBH.js → chunk-4AG5CIDJ.js} +1 -1
- package/public/{chunk-RMZRXORR.js → chunk-4H57TZAE.js} +1 -1
- package/public/{chunk-73TX7DHV.js → chunk-5CCE4FIL.js} +1 -1
- package/public/{chunk-2CNQY2E7.js → chunk-5RBSMCFS.js} +1 -1
- package/public/{chunk-LZOHFRHN.js → chunk-6O32KEYY.js} +1 -1
- package/public/{chunk-EAGKQ5OJ.js → chunk-7K67C3PU.js} +1 -1
- package/public/{chunk-732XLY23.js → chunk-7PEOCUE2.js} +3 -3
- package/public/{chunk-W3SNJ7TC.js → chunk-7RXQUWCY.js} +1 -1
- package/public/{chunk-EVND2DL5.js → chunk-7SZF43OV.js} +1 -1
- package/public/chunk-AEYQANK4.js +68 -0
- package/public/{chunk-2KEG7SYT.js → chunk-AU2Q4PYM.js} +1 -1
- package/public/chunk-AZIULTML.js +1 -0
- package/public/chunk-B63E4PTS.js +19 -0
- package/public/{chunk-X5AKILHJ.js → chunk-CT6TS63V.js} +1 -1
- package/public/{chunk-LWAL5JUG.js → chunk-DGS32J2V.js} +1 -1
- package/public/{chunk-D5RKKI2A.js → chunk-DWAKEAKY.js} +1 -1
- package/public/chunk-DZVJNQPQ.js +1 -0
- package/public/chunk-E26RJWMZ.js +4 -0
- package/public/{chunk-7UDDRMZZ.js → chunk-H22EEHWT.js} +1 -1
- package/public/{chunk-2FNQEOXF.js → chunk-HZFYCQBZ.js} +1 -1
- package/public/{chunk-OS2SEJZU.js → chunk-I24Z7SXB.js} +1 -1
- package/public/{chunk-7IYTG6GP.js → chunk-IA43FDJ7.js} +1 -1
- package/public/{chunk-WLGXJQPD.js → chunk-IHMVNP7Y.js} +1 -1
- package/public/{chunk-TSFGO3MA.js → chunk-IJNJ3FHH.js} +1 -1
- package/public/{chunk-ZJJ3EOBP.js → chunk-IM4LXJ36.js} +1 -1
- package/public/chunk-J4AYRIB4.js +1 -0
- package/public/{chunk-NKNWXFAK.js → chunk-JXJXX7ID.js} +1 -1
- package/public/chunk-K73OEMZP.js +1 -0
- package/public/chunk-KAZYWBPX.js +1 -0
- package/public/chunk-KGXF4YD5.js +1 -0
- package/public/chunk-KN2SQNGB.js +1 -0
- package/public/chunk-LN3BMCV4.js +1 -0
- package/public/{chunk-5ETJWAIW.js → chunk-LOQEG2RD.js} +1 -1
- package/public/chunk-M3HVG4RQ.js +1 -0
- package/public/{chunk-CYBDQV2B.js → chunk-MNT5ZGV3.js} +1 -1
- package/public/{chunk-UF2IM5BE.js → chunk-NTFDKV64.js} +1 -1
- package/public/chunk-PF7M52WR.js +1 -0
- package/public/chunk-PFWD43QS.js +2 -0
- package/public/{chunk-4QXLJX7D.js → chunk-PHND6FV5.js} +1 -1
- package/public/chunk-PSYU6RB3.js +1 -0
- package/public/{chunk-3E2NZ5JW.js → chunk-Q7T3F2Y7.js} +1 -1
- package/public/chunk-QKKTMQUU.js +1 -0
- package/public/chunk-QT6XPFQS.js +1 -0
- package/public/{chunk-3IZSIVEA.js → chunk-R2WI5YTX.js} +1 -1
- package/public/chunk-R44T3ZI7.js +50 -0
- package/public/{chunk-YNONXMOG.js → chunk-R6KWC4OQ.js} +1 -1
- package/public/{chunk-SY4VNLXW.js → chunk-RDOYYGV5.js} +1 -1
- package/public/chunk-RERUZJD4.js +5 -0
- package/public/chunk-S5IG2PNV.js +1 -0
- package/public/{chunk-AI6E5JVH.js → chunk-SVVZYE76.js} +1 -1
- package/public/{chunk-325LPX6W.js → chunk-T3SFHTRG.js} +1 -1
- package/public/{chunk-ADW6BF5G.js → chunk-TJ6P7UCH.js} +1 -1
- package/public/{chunk-ASKB5DLO.js → chunk-U3NNN7U4.js} +1 -1
- package/public/{chunk-BLT2YCDN.js → chunk-UBLR5WZR.js} +1 -1
- package/public/{chunk-YH6MRXGX.js → chunk-UZHUIPNT.js} +1 -1
- package/public/{chunk-BTBGWLKK.js → chunk-VNXIDOPC.js} +1 -1
- package/public/{chunk-WWSLIQVD.js → chunk-W6VJMRO6.js} +1 -1
- package/public/{chunk-3IJXQMYZ.js → chunk-WFVVY4KI.js} +1 -1
- package/public/{chunk-QK4V5DVW.js → chunk-WHSTHY5K.js} +1 -1
- package/public/chunk-XMBCOKOA.js +1 -0
- package/public/{chunk-OAHDGV32.js → chunk-XQACD65E.js} +1 -1
- package/public/{chunk-ZEI3HZ6P.js → chunk-XQCLQKCG.js} +2 -2
- package/public/{chunk-2UOYBCTN.js → chunk-XS55KH6X.js} +1 -1
- package/public/{chunk-VYC5JLE6.js → chunk-YFMEPI62.js} +1 -1
- package/public/chunk-Z4E6BJST.js +1 -0
- package/public/{chunk-OK5EJ7US.js → chunk-ZSWIXPXA.js} +1 -1
- package/public/index.html +2 -2
- package/public/{main-27RPBS22.js → main-WFXBCXTF.js} +1 -1
- package/public/{styles-CSF457UW.css → styles-WNHDEKE4.css} +1 -1
- package/scripts/extract-plugin-alias.js +8 -4
- package/public/chunk-2LXNPXT5.js +0 -1
- package/public/chunk-3XDYZNNE.js +0 -1
- package/public/chunk-57DUDNZJ.js +0 -1
- package/public/chunk-FM6ZYPKR.js +0 -4
- package/public/chunk-JJ7TVAIH.js +0 -5
- package/public/chunk-L43N56JA.js +0 -1
- package/public/chunk-L5I3DZ23.js +0 -1
- package/public/chunk-LH2LMHIZ.js +0 -1
- package/public/chunk-N2TWGDNX.js +0 -1
- package/public/chunk-O4SS7KVP.js +0 -40
- package/public/chunk-ONTEIYY3.js +0 -19
- package/public/chunk-P7TZIGJS.js +0 -50
- package/public/chunk-Q2IS3QQY.js +0 -1
- package/public/chunk-QQ5VZZQG.js +0 -1
- package/public/chunk-RYTGW6B7.js +0 -1
- package/public/chunk-SOT54YHI.js +0 -1
- package/public/chunk-TGZNYEGN.js +0 -1
- package/public/chunk-U5JF2ZOK.js +0 -1
- package/public/chunk-UNGEHXRN.js +0 -1
- package/public/chunk-VEGMNMLG.js +0 -1
- package/public/chunk-Y5FP6C55.js +0 -2
- package/public/chunk-YYJG2ENF.js +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -8,31 +7,37 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
|
-
var
|
|
12
|
-
return (
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
12
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const pump =
|
|
13
|
+
import { EventEmitter } from 'node:events';
|
|
14
|
+
import { constants, createReadStream, statSync } from 'node:fs';
|
|
15
|
+
import { access, lstat, mkdtemp, readdir, realpath } from 'node:fs/promises';
|
|
16
|
+
import { platform, tmpdir } from 'node:os';
|
|
17
|
+
import { basename, join, resolve } from 'node:path';
|
|
18
|
+
import process from 'node:process';
|
|
19
|
+
import { pipeline } from 'node:stream';
|
|
20
|
+
import { promisify } from 'node:util';
|
|
21
|
+
import { BadRequestException, Inject, Injectable, InternalServerErrorException, NotFoundException, StreamableFile, } from '@nestjs/common';
|
|
22
|
+
import { cyan, green, red, yellow } from 'bash-color';
|
|
23
|
+
import dayjs from 'dayjs';
|
|
24
|
+
import { copy, ensureDir, pathExists, readJson, remove, writeJson } from 'fs-extra/esm';
|
|
25
|
+
import { networkInterfaces } from 'systeminformation';
|
|
26
|
+
import { create, extract } from 'tar';
|
|
27
|
+
import { Extract } from 'unzipper';
|
|
28
|
+
import { ConfigService } from '../../core/config/config.service.js';
|
|
29
|
+
import { HomebridgeIpcService } from '../../core/homebridge-ipc/homebridge-ipc.service.js';
|
|
30
|
+
import { Logger } from '../../core/logger/logger.service.js';
|
|
31
|
+
import { SchedulerService } from '../../core/scheduler/scheduler.service.js';
|
|
32
|
+
import { PluginsService } from '../plugins/plugins.service.js';
|
|
33
|
+
const pump = promisify(pipeline);
|
|
35
34
|
let BackupService = class BackupService {
|
|
35
|
+
configService;
|
|
36
|
+
pluginsService;
|
|
37
|
+
schedulerService;
|
|
38
|
+
homebridgeIpcService;
|
|
39
|
+
logger;
|
|
40
|
+
restoreDirectory;
|
|
36
41
|
constructor(configService, pluginsService, schedulerService, homebridgeIpcService, logger) {
|
|
37
42
|
this.configService = configService;
|
|
38
43
|
this.pluginsService = pluginsService;
|
|
@@ -57,13 +62,13 @@ let BackupService = class BackupService {
|
|
|
57
62
|
}
|
|
58
63
|
async createBackup() {
|
|
59
64
|
const instanceId = this.configService.homebridgeConfig.bridge.username.replace(/:/g, '');
|
|
60
|
-
const backupDir = await
|
|
65
|
+
const backupDir = await mkdtemp(join(tmpdir(), 'homebridge-backup-'));
|
|
61
66
|
const backupFileName = `homebridge-backup-${instanceId}.${new Date().getTime().toString()}.tar.gz`;
|
|
62
|
-
const backupPath =
|
|
67
|
+
const backupPath = resolve(backupDir, backupFileName);
|
|
63
68
|
this.logger.log(`Creating temporary backup archive at ${backupPath}.`);
|
|
64
69
|
try {
|
|
65
|
-
const storagePath = await
|
|
66
|
-
await
|
|
70
|
+
const storagePath = await realpath(this.configService.storagePath);
|
|
71
|
+
await copy(storagePath, resolve(backupDir, 'storage'), {
|
|
67
72
|
filter: async (filePath) => {
|
|
68
73
|
if ([
|
|
69
74
|
'instance-backups',
|
|
@@ -88,11 +93,11 @@ let BackupService = class BackupService {
|
|
|
88
93
|
'@eaDir',
|
|
89
94
|
'.venv',
|
|
90
95
|
'.cache',
|
|
91
|
-
].includes(
|
|
96
|
+
].includes(basename(filePath))) {
|
|
92
97
|
return false;
|
|
93
98
|
}
|
|
94
99
|
try {
|
|
95
|
-
const stat = await
|
|
100
|
+
const stat = await lstat(filePath);
|
|
96
101
|
return (stat.isDirectory() || stat.isFile());
|
|
97
102
|
}
|
|
98
103
|
catch (e) {
|
|
@@ -101,14 +106,14 @@ let BackupService = class BackupService {
|
|
|
101
106
|
},
|
|
102
107
|
});
|
|
103
108
|
const installedPlugins = await this.pluginsService.getInstalledPlugins();
|
|
104
|
-
await
|
|
105
|
-
await
|
|
109
|
+
await writeJson(resolve(backupDir, 'plugins.json'), installedPlugins);
|
|
110
|
+
await writeJson(resolve(backupDir, 'info.json'), {
|
|
106
111
|
timestamp: new Date().toISOString(),
|
|
107
|
-
platform:
|
|
112
|
+
platform: platform(),
|
|
108
113
|
uix: this.configService.package.version,
|
|
109
|
-
node:
|
|
114
|
+
node: process.version,
|
|
110
115
|
});
|
|
111
|
-
await
|
|
116
|
+
await create({
|
|
112
117
|
portable: true,
|
|
113
118
|
gzip: true,
|
|
114
119
|
file: backupPath,
|
|
@@ -125,13 +130,13 @@ let BackupService = class BackupService {
|
|
|
125
130
|
'plugins.json',
|
|
126
131
|
'info.json',
|
|
127
132
|
]);
|
|
128
|
-
if (
|
|
129
|
-
this.logger.error(`Backup file exceeds maximum restore file size (${globalThis.backup.maxBackupSizeText}) ${(
|
|
133
|
+
if (statSync(backupPath).size > globalThis.backup.maxBackupSize) {
|
|
134
|
+
this.logger.error(`Backup file exceeds maximum restore file size (${globalThis.backup.maxBackupSizeText}) ${(statSync(backupPath).size / (1024 * 1024)).toFixed(1)}MB.`);
|
|
130
135
|
}
|
|
131
136
|
}
|
|
132
137
|
catch (e) {
|
|
133
138
|
this.logger.log(`Backup failed, removing ${backupDir}.`);
|
|
134
|
-
await
|
|
139
|
+
await remove(resolve(backupDir));
|
|
135
140
|
throw e;
|
|
136
141
|
}
|
|
137
142
|
return {
|
|
@@ -143,18 +148,18 @@ let BackupService = class BackupService {
|
|
|
143
148
|
}
|
|
144
149
|
async ensureScheduledBackupPath() {
|
|
145
150
|
if (this.configService.ui.scheduledBackupPath) {
|
|
146
|
-
if (!await
|
|
151
|
+
if (!await pathExists(this.configService.instanceBackupPath)) {
|
|
147
152
|
throw new Error('Custom instance backup path does not exist');
|
|
148
153
|
}
|
|
149
154
|
try {
|
|
150
|
-
await
|
|
155
|
+
await access(this.configService.instanceBackupPath, constants.W_OK | constants.R_OK);
|
|
151
156
|
}
|
|
152
157
|
catch (e) {
|
|
153
158
|
throw new Error(`Custom instance backup path is not writable / readable by service: ${e.message}`);
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
161
|
else {
|
|
157
|
-
return await
|
|
162
|
+
return await ensureDir(this.configService.instanceBackupPath);
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
async runScheduledBackupJob() {
|
|
@@ -167,8 +172,8 @@ let BackupService = class BackupService {
|
|
|
167
172
|
}
|
|
168
173
|
try {
|
|
169
174
|
const { backupDir, backupPath, instanceId } = await this.createBackup();
|
|
170
|
-
await
|
|
171
|
-
await
|
|
175
|
+
await copy(backupPath, resolve(this.configService.instanceBackupPath, `homebridge-backup-${instanceId}.${new Date().getTime().toString()}.tar.gz`));
|
|
176
|
+
await remove(resolve(backupDir));
|
|
172
177
|
}
|
|
173
178
|
catch (e) {
|
|
174
179
|
this.logger.warn(`Failed to create scheduled instance backup as ${e.message}.`);
|
|
@@ -176,8 +181,8 @@ let BackupService = class BackupService {
|
|
|
176
181
|
try {
|
|
177
182
|
const backups = await this.listScheduledBackups();
|
|
178
183
|
for (const backup of backups) {
|
|
179
|
-
if ((
|
|
180
|
-
await
|
|
184
|
+
if (dayjs().diff(dayjs(backup.timestamp), 'day') >= 7) {
|
|
185
|
+
await remove(resolve(this.configService.instanceBackupPath, backup.fileName));
|
|
181
186
|
}
|
|
182
187
|
}
|
|
183
188
|
}
|
|
@@ -200,7 +205,7 @@ let BackupService = class BackupService {
|
|
|
200
205
|
async listScheduledBackups() {
|
|
201
206
|
try {
|
|
202
207
|
await this.ensureScheduledBackupPath();
|
|
203
|
-
const dirContents = await
|
|
208
|
+
const dirContents = await readdir(this.configService.instanceBackupPath, { withFileTypes: true });
|
|
204
209
|
return dirContents
|
|
205
210
|
.filter(x => x.isFile() && x.name.match(/^homebridge-backup-[0-9A-Za-z]{12}.\d{09,15}.tar.gz/))
|
|
206
211
|
.map((x) => {
|
|
@@ -212,7 +217,7 @@ let BackupService = class BackupService {
|
|
|
212
217
|
instanceId: split[0].split('-')[2],
|
|
213
218
|
timestamp: new Date(Number.parseInt(split[1], 10)),
|
|
214
219
|
fileName: x.name,
|
|
215
|
-
size: (
|
|
220
|
+
size: (statSync(`${this.configService.instanceBackupPath}/${x.name}`).size / (1024 * 1024)).toFixed(1),
|
|
216
221
|
maxBackupSize: globalThis.backup.maxBackupSize / (1024 * 1024),
|
|
217
222
|
maxBackupSizeText: globalThis.backup.maxBackupSizeText,
|
|
218
223
|
};
|
|
@@ -236,38 +241,38 @@ let BackupService = class BackupService {
|
|
|
236
241
|
}
|
|
237
242
|
catch (e) {
|
|
238
243
|
this.logger.warn(`Could not get scheduled backups as ${e.message}.`);
|
|
239
|
-
throw new
|
|
244
|
+
throw new InternalServerErrorException(e.message);
|
|
240
245
|
}
|
|
241
246
|
}
|
|
242
247
|
async getScheduledBackup(backupId) {
|
|
243
|
-
const backupPath =
|
|
244
|
-
if (!await
|
|
245
|
-
throw new
|
|
248
|
+
const backupPath = resolve(this.configService.instanceBackupPath, `homebridge-backup-${backupId}.tar.gz`);
|
|
249
|
+
if (!await pathExists(backupPath)) {
|
|
250
|
+
throw new NotFoundException();
|
|
246
251
|
}
|
|
247
|
-
return new
|
|
252
|
+
return new StreamableFile(createReadStream(backupPath));
|
|
248
253
|
}
|
|
249
254
|
async deleteScheduledBackup(backupId) {
|
|
250
|
-
const backupPath =
|
|
251
|
-
if (!await
|
|
252
|
-
throw new
|
|
255
|
+
const backupPath = resolve(this.configService.instanceBackupPath, `homebridge-backup-${backupId}.tar.gz`);
|
|
256
|
+
if (!await pathExists(backupPath)) {
|
|
257
|
+
throw new NotFoundException();
|
|
253
258
|
}
|
|
254
259
|
try {
|
|
255
|
-
await
|
|
260
|
+
await remove(backupPath);
|
|
256
261
|
this.logger.warn(`Scheduled backup ${backupId} deleted by request.`);
|
|
257
262
|
}
|
|
258
263
|
catch (e) {
|
|
259
264
|
this.logger.warn(`Failed to delete scheduled backup by request as ${e.message}.`);
|
|
260
|
-
throw new
|
|
265
|
+
throw new InternalServerErrorException(e.message);
|
|
261
266
|
}
|
|
262
267
|
}
|
|
263
268
|
async restoreScheduledBackup(backupId) {
|
|
264
|
-
const backupPath =
|
|
265
|
-
if (!await
|
|
266
|
-
throw new
|
|
269
|
+
const backupPath = resolve(this.configService.instanceBackupPath, `homebridge-backup-${backupId}.tar.gz`);
|
|
270
|
+
if (!await pathExists(backupPath)) {
|
|
271
|
+
throw new NotFoundException();
|
|
267
272
|
}
|
|
268
273
|
this.restoreDirectory = undefined;
|
|
269
|
-
const restoreDir = await
|
|
270
|
-
await pump(
|
|
274
|
+
const restoreDir = await mkdtemp(join(tmpdir(), 'homebridge-backup-'));
|
|
275
|
+
await pump(createReadStream(backupPath), extract({
|
|
271
276
|
cwd: restoreDir,
|
|
272
277
|
}));
|
|
273
278
|
this.restoreDirectory = restoreDir;
|
|
@@ -280,7 +285,7 @@ let BackupService = class BackupService {
|
|
|
280
285
|
if (reply.request.hostname === 'localhost:8080') {
|
|
281
286
|
reply.raw.setHeader('access-control-allow-origin', 'http://localhost:4200');
|
|
282
287
|
}
|
|
283
|
-
return new
|
|
288
|
+
return new StreamableFile(createReadStream(backupPath).on('close', () => remove(resolve(backupDir))));
|
|
284
289
|
}
|
|
285
290
|
async createBackupInDirectory() {
|
|
286
291
|
try {
|
|
@@ -288,36 +293,36 @@ let BackupService = class BackupService {
|
|
|
288
293
|
}
|
|
289
294
|
catch (error) {
|
|
290
295
|
this.logger.error(`Create backup failed: ${error.message}`);
|
|
291
|
-
throw new
|
|
296
|
+
throw new NotFoundException();
|
|
292
297
|
}
|
|
293
298
|
try {
|
|
294
299
|
const { backupDir, backupPath, instanceId } = await this.createBackup();
|
|
295
|
-
await
|
|
296
|
-
await
|
|
300
|
+
await copy(backupPath, resolve(this.configService.instanceBackupPath, `homebridge-backup-${instanceId}.${new Date().getTime().toString()}.tar.gz`));
|
|
301
|
+
await remove(resolve(backupDir));
|
|
297
302
|
}
|
|
298
303
|
catch (error) {
|
|
299
304
|
this.logger.error(`Create backup failed: ${error.message}`);
|
|
300
|
-
throw new
|
|
305
|
+
throw new InternalServerErrorException(error.message);
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
308
|
async uploadBackupRestore(data) {
|
|
304
309
|
this.restoreDirectory = undefined;
|
|
305
|
-
const backupDir = await
|
|
306
|
-
await pump(data.file,
|
|
310
|
+
const backupDir = await mkdtemp(join(tmpdir(), 'homebridge-backup-'));
|
|
311
|
+
await pump(data.file, extract({
|
|
307
312
|
cwd: backupDir,
|
|
308
313
|
}));
|
|
309
314
|
this.restoreDirectory = backupDir;
|
|
310
315
|
}
|
|
311
316
|
async removeRestoreDirectory() {
|
|
312
317
|
if (this.restoreDirectory) {
|
|
313
|
-
return await
|
|
318
|
+
return await remove(this.restoreDirectory);
|
|
314
319
|
}
|
|
315
320
|
}
|
|
316
321
|
async triggerHeadlessRestore() {
|
|
317
|
-
if (!await
|
|
318
|
-
throw new
|
|
322
|
+
if (!await pathExists(this.restoreDirectory)) {
|
|
323
|
+
throw new BadRequestException('No backup file uploaded');
|
|
319
324
|
}
|
|
320
|
-
const client = new
|
|
325
|
+
const client = new EventEmitter();
|
|
321
326
|
client.on('stdout', (data) => {
|
|
322
327
|
this.logger.log(data);
|
|
323
328
|
});
|
|
@@ -329,78 +334,78 @@ let BackupService = class BackupService {
|
|
|
329
334
|
}
|
|
330
335
|
async restoreFromBackup(client, autoRestart = false) {
|
|
331
336
|
if (!this.restoreDirectory) {
|
|
332
|
-
throw new
|
|
337
|
+
throw new BadRequestException();
|
|
333
338
|
}
|
|
334
|
-
if (!await
|
|
339
|
+
if (!await pathExists(resolve(this.restoreDirectory, 'info.json'))) {
|
|
335
340
|
await this.removeRestoreDirectory();
|
|
336
341
|
throw new Error('Uploaded file is not a valid Homebridge Backup Archive.');
|
|
337
342
|
}
|
|
338
|
-
if (!await
|
|
343
|
+
if (!await pathExists(resolve(this.restoreDirectory, 'plugins.json'))) {
|
|
339
344
|
await this.removeRestoreDirectory();
|
|
340
345
|
throw new Error('Uploaded file is not a valid Homebridge Backup Archive.');
|
|
341
346
|
}
|
|
342
|
-
if (!await
|
|
347
|
+
if (!await pathExists(resolve(this.restoreDirectory, 'storage'))) {
|
|
343
348
|
await this.removeRestoreDirectory();
|
|
344
349
|
throw new Error('Uploaded file is not a valid Homebridge Backup Archive.');
|
|
345
350
|
}
|
|
346
|
-
const backupInfo = await
|
|
347
|
-
client.emit('stdout',
|
|
351
|
+
const backupInfo = await readJson(resolve(this.restoreDirectory, 'info.json'));
|
|
352
|
+
client.emit('stdout', cyan('Backup Archive Information\r\n'));
|
|
348
353
|
client.emit('stdout', `Source Node.js Version: ${backupInfo.node}\r\n`);
|
|
349
354
|
client.emit('stdout', `Source Homebridge UI Version: v${backupInfo.uix}\r\n`);
|
|
350
355
|
client.emit('stdout', `Source Platform: ${backupInfo.platform}\r\n`);
|
|
351
356
|
client.emit('stdout', `Created: ${backupInfo.timestamp}\r\n`);
|
|
352
357
|
this.logger.warn('Starting backup restore...');
|
|
353
|
-
client.emit('stdout',
|
|
358
|
+
client.emit('stdout', cyan('\r\nRestoring backup...\r\n\r\n'));
|
|
354
359
|
await new Promise(res => setTimeout(res, 1000));
|
|
355
360
|
const restoreFilter = [
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
361
|
+
join(this.restoreDirectory, 'storage', 'package.json'),
|
|
362
|
+
join(this.restoreDirectory, 'storage', 'package-lock.json'),
|
|
363
|
+
join(this.restoreDirectory, 'storage', '.npmrc'),
|
|
364
|
+
join(this.restoreDirectory, 'storage', 'docker-compose.yml'),
|
|
360
365
|
];
|
|
361
|
-
const storagePath = await
|
|
362
|
-
client.emit('stdout',
|
|
366
|
+
const storagePath = await realpath(this.configService.storagePath);
|
|
367
|
+
client.emit('stdout', yellow(`Restoring Homebridge storage to ${storagePath}\r\n`));
|
|
363
368
|
await new Promise(res => setTimeout(res, 100));
|
|
364
|
-
await
|
|
369
|
+
await copy(resolve(this.restoreDirectory, 'storage'), storagePath, {
|
|
365
370
|
filter: async (filePath) => {
|
|
366
371
|
if (restoreFilter.includes(filePath)) {
|
|
367
|
-
client.emit('stdout', `Skipping ${
|
|
372
|
+
client.emit('stdout', `Skipping ${basename(filePath)}\r\n`);
|
|
368
373
|
return false;
|
|
369
374
|
}
|
|
370
375
|
try {
|
|
371
|
-
const stat = await
|
|
376
|
+
const stat = await lstat(filePath);
|
|
372
377
|
if (stat.isDirectory() || stat.isFile()) {
|
|
373
|
-
client.emit('stdout', `Restoring ${
|
|
378
|
+
client.emit('stdout', `Restoring ${basename(filePath)}\r\n`);
|
|
374
379
|
return true;
|
|
375
380
|
}
|
|
376
381
|
else {
|
|
377
|
-
client.emit('stdout', `Skipping ${
|
|
382
|
+
client.emit('stdout', `Skipping ${basename(filePath)}\r\n`);
|
|
378
383
|
return false;
|
|
379
384
|
}
|
|
380
385
|
}
|
|
381
386
|
catch (e) {
|
|
382
|
-
client.emit('stdout', `Skipping ${
|
|
387
|
+
client.emit('stdout', `Skipping ${basename(filePath)}\r\n`);
|
|
383
388
|
return false;
|
|
384
389
|
}
|
|
385
390
|
},
|
|
386
391
|
});
|
|
387
|
-
client.emit('stdout',
|
|
392
|
+
client.emit('stdout', yellow('File restore complete.\r\n'));
|
|
388
393
|
await new Promise(res => setTimeout(res, 1000));
|
|
389
|
-
client.emit('stdout',
|
|
390
|
-
const plugins = (await
|
|
394
|
+
client.emit('stdout', cyan('\r\nRestoring plugins...\r\n'));
|
|
395
|
+
const plugins = (await readJson(resolve(this.restoreDirectory, 'plugins.json')))
|
|
391
396
|
.filter((x) => ![
|
|
392
397
|
'homebridge-config-ui-x',
|
|
393
398
|
].includes(x.name) && x.publicPackage);
|
|
394
399
|
for (const plugin of plugins) {
|
|
395
400
|
try {
|
|
396
|
-
client.emit('stdout',
|
|
401
|
+
client.emit('stdout', yellow(`\r\nInstalling ${plugin.name}...\r\n`));
|
|
397
402
|
await this.pluginsService.managePlugin('install', { name: plugin.name, version: plugin.installedVersion }, client);
|
|
398
403
|
}
|
|
399
404
|
catch (e) {
|
|
400
|
-
client.emit('stdout',
|
|
405
|
+
client.emit('stdout', red(`Failed to install ${plugin.name}.\r\n`));
|
|
401
406
|
}
|
|
402
407
|
}
|
|
403
|
-
const restoredConfig = await
|
|
408
|
+
const restoredConfig = await readJson(this.configService.configPath);
|
|
404
409
|
if (restoredConfig.bridge) {
|
|
405
410
|
restoredConfig.bridge.port = this.configService.homebridgeConfig.bridge.port;
|
|
406
411
|
}
|
|
@@ -421,9 +426,9 @@ let BackupService = class BackupService {
|
|
|
421
426
|
platform: 'config',
|
|
422
427
|
});
|
|
423
428
|
}
|
|
424
|
-
await
|
|
429
|
+
await writeJson(this.configService.configPath, restoredConfig, { spaces: 4 });
|
|
425
430
|
await this.removeRestoreDirectory();
|
|
426
|
-
client.emit('stdout',
|
|
431
|
+
client.emit('stdout', green('\r\nRestore Complete!\r\n'));
|
|
427
432
|
this.configService.hbServiceUiRestartRequired = true;
|
|
428
433
|
if (autoRestart) {
|
|
429
434
|
this.postBackupRestoreRestart();
|
|
@@ -432,59 +437,59 @@ let BackupService = class BackupService {
|
|
|
432
437
|
}
|
|
433
438
|
async uploadHbfxRestore(data) {
|
|
434
439
|
this.restoreDirectory = undefined;
|
|
435
|
-
const backupDir = await
|
|
440
|
+
const backupDir = await mkdtemp(join(tmpdir(), 'homebridge-backup-'));
|
|
436
441
|
this.logger.log(`Extracting .hbfx file to ${backupDir}.`);
|
|
437
|
-
await pump(data.file,
|
|
442
|
+
await pump(data.file, Extract({
|
|
438
443
|
path: backupDir,
|
|
439
444
|
}));
|
|
440
445
|
this.restoreDirectory = backupDir;
|
|
441
446
|
}
|
|
442
447
|
async restoreHbfxBackup(client) {
|
|
443
448
|
if (!this.restoreDirectory) {
|
|
444
|
-
throw new
|
|
449
|
+
throw new BadRequestException();
|
|
445
450
|
}
|
|
446
|
-
if (!await
|
|
451
|
+
if (!await pathExists(resolve(this.restoreDirectory, 'package.json'))) {
|
|
447
452
|
await this.removeRestoreDirectory();
|
|
448
453
|
throw new Error('Uploaded file is not a valid HBFX Backup Archive.');
|
|
449
454
|
}
|
|
450
|
-
if (!await
|
|
455
|
+
if (!await pathExists(resolve(this.restoreDirectory, 'etc', 'config.json'))) {
|
|
451
456
|
await this.removeRestoreDirectory();
|
|
452
457
|
throw new Error('Uploaded file is not a valid HBFX Backup Archive.');
|
|
453
458
|
}
|
|
454
|
-
const backupInfo = await
|
|
455
|
-
client.emit('stdout',
|
|
459
|
+
const backupInfo = await readJson(resolve(this.restoreDirectory, 'package.json'));
|
|
460
|
+
client.emit('stdout', cyan('Backup Archive Information\r\n'));
|
|
456
461
|
client.emit('stdout', `Backup Source: ${backupInfo.name}\r\n`);
|
|
457
462
|
client.emit('stdout', `Version: v${backupInfo.version}\r\n`);
|
|
458
463
|
this.logger.warn('Starting hbfx restore...');
|
|
459
|
-
client.emit('stdout',
|
|
464
|
+
client.emit('stdout', cyan('\r\nRestoring hbfx backup...\r\n\r\n'));
|
|
460
465
|
await new Promise(res => setTimeout(res, 1000));
|
|
461
|
-
const storagePath = await
|
|
462
|
-
client.emit('stdout',
|
|
463
|
-
await
|
|
466
|
+
const storagePath = await realpath(this.configService.storagePath);
|
|
467
|
+
client.emit('stdout', yellow(`Restoring Homebridge storage to ${storagePath}\r\n`));
|
|
468
|
+
await copy(resolve(this.restoreDirectory, 'etc'), resolve(storagePath), {
|
|
464
469
|
filter: (filePath) => {
|
|
465
470
|
if ([
|
|
466
471
|
'access.json',
|
|
467
472
|
'dashboard.json',
|
|
468
473
|
'layout.json',
|
|
469
474
|
'config.json',
|
|
470
|
-
].includes(
|
|
475
|
+
].includes(basename(filePath))) {
|
|
471
476
|
return false;
|
|
472
477
|
}
|
|
473
|
-
client.emit('stdout', `Restoring ${
|
|
478
|
+
client.emit('stdout', `Restoring ${basename(filePath)}\r\n`);
|
|
474
479
|
return true;
|
|
475
480
|
},
|
|
476
481
|
});
|
|
477
|
-
const sourceAccessoriesPath =
|
|
478
|
-
const targetAccessoriesPath =
|
|
479
|
-
if (await
|
|
480
|
-
await
|
|
482
|
+
const sourceAccessoriesPath = resolve(this.restoreDirectory, 'etc', 'accessories');
|
|
483
|
+
const targetAccessoriesPath = resolve(storagePath, 'accessories');
|
|
484
|
+
if (await pathExists(sourceAccessoriesPath)) {
|
|
485
|
+
await copy(sourceAccessoriesPath, targetAccessoriesPath, {
|
|
481
486
|
filter: (filePath) => {
|
|
482
|
-
client.emit('stdout', `Restoring ${
|
|
487
|
+
client.emit('stdout', `Restoring ${basename(filePath)}\r\n`);
|
|
483
488
|
return true;
|
|
484
489
|
},
|
|
485
490
|
});
|
|
486
491
|
}
|
|
487
|
-
const sourceConfig = await
|
|
492
|
+
const sourceConfig = await readJson(resolve(this.restoreDirectory, 'etc', 'config.json'));
|
|
488
493
|
const pluginMap = {
|
|
489
494
|
'hue': 'homebridge-hue',
|
|
490
495
|
'chamberlain': 'homebridge-chamberlain',
|
|
@@ -503,11 +508,11 @@ let BackupService = class BackupService {
|
|
|
503
508
|
plugin = pluginMap[plugin];
|
|
504
509
|
}
|
|
505
510
|
try {
|
|
506
|
-
client.emit('stdout',
|
|
511
|
+
client.emit('stdout', yellow(`\r\nInstalling ${plugin}...\r\n`));
|
|
507
512
|
await this.pluginsService.managePlugin('install', { name: plugin, version: 'latest' }, client);
|
|
508
513
|
}
|
|
509
514
|
catch (e) {
|
|
510
|
-
client.emit('stdout',
|
|
515
|
+
client.emit('stdout', red(`Failed to install ${plugin}.\r\n`));
|
|
511
516
|
}
|
|
512
517
|
}
|
|
513
518
|
}
|
|
@@ -534,9 +539,9 @@ let BackupService = class BackupService {
|
|
|
534
539
|
...this.configService.ui,
|
|
535
540
|
platform: 'config',
|
|
536
541
|
});
|
|
537
|
-
await
|
|
542
|
+
await writeJson(this.configService.configPath, targetConfig, { spaces: 4 });
|
|
538
543
|
await this.removeRestoreDirectory();
|
|
539
|
-
client.emit('stdout',
|
|
544
|
+
client.emit('stdout', green('\r\nRestore Complete!\r\n'));
|
|
540
545
|
this.configService.hbServiceUiRestartRequired = true;
|
|
541
546
|
return { status: 0 };
|
|
542
547
|
}
|
|
@@ -544,7 +549,7 @@ let BackupService = class BackupService {
|
|
|
544
549
|
setTimeout(() => {
|
|
545
550
|
this.homebridgeIpcService.killHomebridge();
|
|
546
551
|
setTimeout(() => {
|
|
547
|
-
|
|
552
|
+
process.kill(process.pid, 'SIGKILL');
|
|
548
553
|
}, 500);
|
|
549
554
|
}, 500);
|
|
550
555
|
return { status: 0 };
|
|
@@ -558,7 +563,7 @@ let BackupService = class BackupService {
|
|
|
558
563
|
delete restoredConfig.bridge.bind;
|
|
559
564
|
return;
|
|
560
565
|
}
|
|
561
|
-
const interfaces =
|
|
566
|
+
const interfaces = networkInterfaces();
|
|
562
567
|
restoredConfig.bridge.bind = restoredConfig.bridge.bind.filter(x => interfaces[x]);
|
|
563
568
|
if (!restoredConfig.bridge.bind) {
|
|
564
569
|
delete restoredConfig.bridge.bind;
|
|
@@ -566,13 +571,18 @@ let BackupService = class BackupService {
|
|
|
566
571
|
}
|
|
567
572
|
}
|
|
568
573
|
};
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
(0,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
574
|
+
BackupService = __decorate([
|
|
575
|
+
Injectable(),
|
|
576
|
+
__param(0, Inject(ConfigService)),
|
|
577
|
+
__param(1, Inject(PluginsService)),
|
|
578
|
+
__param(2, Inject(SchedulerService)),
|
|
579
|
+
__param(3, Inject(HomebridgeIpcService)),
|
|
580
|
+
__param(4, Inject(Logger)),
|
|
581
|
+
__metadata("design:paramtypes", [ConfigService,
|
|
582
|
+
PluginsService,
|
|
583
|
+
SchedulerService,
|
|
584
|
+
HomebridgeIpcService,
|
|
585
|
+
Logger])
|
|
577
586
|
], BackupService);
|
|
587
|
+
export { BackupService };
|
|
578
588
|
//# sourceMappingURL=backup.service.js.map
|