homebridge-config-ui-x 5.9.1-beta.1 → 5.9.1-beta.2
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 +7 -3
- 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 +40 -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 +3 -3
- 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 +1 -1
- 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 +1 -1
- 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.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 +2 -2
- package/dist/core/config/config.service.js +88 -82
- 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 +1 -4
- 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 +2 -2
- package/dist/core/homebridge-ipc/homebridge-ipc.service.js +24 -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 +7 -10
- package/dist/core/scheduler/scheduler.module.js.map +1 -1
- package/dist/core/scheduler/scheduler.service.js +9 -14
- 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 +2 -2
- package/dist/modules/accessories/accessories.controller.js +27 -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 +1 -1
- package/dist/modules/accessories/accessories.gateway.js +18 -16
- package/dist/modules/accessories/accessories.gateway.js.map +1 -1
- package/dist/modules/accessories/accessories.module.js +17 -20
- package/dist/modules/accessories/accessories.module.js.map +1 -1
- package/dist/modules/accessories/accessories.service.d.ts +2 -2
- package/dist/modules/accessories/accessories.service.js +37 -35
- package/dist/modules/accessories/accessories.service.js.map +1 -1
- package/dist/modules/backup/backup.controller.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +6 -6
- package/dist/modules/config-editor/config-editor.controller.js +94 -95
- package/dist/modules/config-editor/config-editor.controller.js.map +1 -1
- 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 +6 -6
- package/dist/modules/config-editor/config-editor.service.js +65 -57
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +4 -4
- 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 +2 -2
- 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 +3 -3
- 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 +4 -4
- 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 +6 -6
- package/dist/modules/plugins/plugins.controller.js +51 -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 +3 -3
- 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 +23 -26
- package/dist/modules/plugins/plugins.module.js.map +1 -1
- package/dist/modules/plugins/plugins.service.d.ts +9 -7
- package/dist/modules/plugins/plugins.service.js +230 -202
- package/dist/modules/plugins/plugins.service.js.map +1 -1
- package/dist/modules/server/server.controller.d.ts +4 -4
- 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 +2 -2
- 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 +2 -2
- 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 +1 -1
- 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 +9 -9
- 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 +7 -7
- 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 +2 -2
- 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 +6 -7
- package/public/{chunk-732XLY23.js → chunk-2SCTALGY.js} +1 -1
- package/public/{chunk-TGZNYEGN.js → chunk-425ZEUU6.js} +1 -1
- package/public/{chunk-BTBGWLKK.js → chunk-4T6CM7M3.js} +1 -1
- package/public/{chunk-325LPX6W.js → chunk-7SKTJO5M.js} +1 -1
- package/public/{chunk-QK4V5DVW.js → chunk-ATMY4YI2.js} +1 -1
- package/public/{chunk-YH6MRXGX.js → chunk-AZIRJR4B.js} +1 -1
- package/public/{chunk-2CNQY2E7.js → chunk-B2XE365J.js} +1 -1
- package/public/{chunk-O4SS7KVP.js → chunk-BMKJTHFC.js} +1 -1
- package/public/{chunk-2KEG7SYT.js → chunk-CGYD722J.js} +1 -1
- package/public/{chunk-FM6ZYPKR.js → chunk-CQREAKPC.js} +4 -4
- package/public/{chunk-WLGXJQPD.js → chunk-FGNMMSZH.js} +1 -1
- package/public/{chunk-TOYVIOBH.js → chunk-FTKWC2Q2.js} +1 -1
- package/public/{chunk-2LXNPXT5.js → chunk-HFW5E2OW.js} +1 -1
- package/public/chunk-IIDLQ7XY.js +1 -0
- package/public/{chunk-UNGEHXRN.js → chunk-INX52LH2.js} +1 -1
- package/public/{chunk-73TX7DHV.js → chunk-JD5JQTN5.js} +1 -1
- package/public/{chunk-EVND2DL5.js → chunk-JFRCT5V7.js} +1 -1
- package/public/{chunk-X5AKILHJ.js → chunk-JPCV77W6.js} +1 -1
- package/public/{chunk-3XDYZNNE.js → chunk-K7D2P3SM.js} +1 -1
- package/public/chunk-L66ATRVT.js +1 -0
- package/public/{chunk-2UOYBCTN.js → chunk-LARQLRNL.js} +1 -1
- package/public/{chunk-L5I3DZ23.js → chunk-LHCMU3MO.js} +1 -1
- package/public/{chunk-ZJJ3EOBP.js → chunk-LZQVKA4S.js} +1 -1
- package/public/{chunk-BLT2YCDN.js → chunk-M7QUT5ZZ.js} +1 -1
- package/public/{chunk-57DUDNZJ.js → chunk-MDBZMB6Y.js} +1 -1
- package/public/{chunk-LZOHFRHN.js → chunk-MNVUSYOZ.js} +1 -1
- package/public/{chunk-7IYTG6GP.js → chunk-PXSEH255.js} +1 -1
- package/public/{chunk-6KT3BYU6.js → chunk-PZ2ZCCFR.js} +1 -1
- package/public/{chunk-L43N56JA.js → chunk-QCZ4VVDL.js} +1 -1
- package/public/{chunk-UF2IM5BE.js → chunk-QSVZNI3M.js} +1 -1
- package/public/{chunk-3E2NZ5JW.js → chunk-QUA46GZJ.js} +1 -1
- package/public/{chunk-Q2IS3QQY.js → chunk-QVLCTKQH.js} +1 -1
- package/public/{chunk-Y5FP6C55.js → chunk-RQ4B2IIV.js} +1 -1
- package/public/{chunk-OK5EJ7US.js → chunk-RQAFAZAK.js} +1 -1
- package/public/{chunk-LH2LMHIZ.js → chunk-S4OE2ITZ.js} +1 -1
- package/public/{chunk-RMZRXORR.js → chunk-SA5C7QVC.js} +1 -1
- package/public/{chunk-ADW6BF5G.js → chunk-SSZBNSOM.js} +1 -1
- package/public/{chunk-4QXLJX7D.js → chunk-TA6DOQC5.js} +1 -1
- package/public/{chunk-OAHDGV32.js → chunk-TC77PFBQ.js} +1 -1
- package/public/{chunk-W3SNJ7TC.js → chunk-TKGKVKOW.js} +1 -1
- package/public/{chunk-U5JF2ZOK.js → chunk-UEDMHOPK.js} +1 -1
- package/public/{chunk-AI6E5JVH.js → chunk-UOPWP4RR.js} +1 -1
- package/public/chunk-UTFHCUKB.js +1 -0
- package/public/{chunk-ONTEIYY3.js → chunk-UTN2R7WG.js} +1 -1
- package/public/{chunk-QQ5VZZQG.js → chunk-UV24H47X.js} +1 -1
- package/public/{chunk-5ETJWAIW.js → chunk-VSBBKD6B.js} +1 -1
- package/public/{chunk-ASKB5DLO.js → chunk-W7UNXMCL.js} +1 -1
- package/public/{chunk-SY4VNLXW.js → chunk-WVCOONJF.js} +1 -1
- package/public/{chunk-YYJG2ENF.js → chunk-X3IVSHIL.js} +1 -1
- package/public/{chunk-3IZSIVEA.js → chunk-XE5VJDQL.js} +1 -1
- package/public/chunk-XMNXI4QP.js +50 -0
- package/public/{chunk-5T4JHJYL.js → chunk-XX5GWADI.js} +1 -1
- package/public/{chunk-LWAL5JUG.js → chunk-Y5XBENWZ.js} +1 -1
- package/public/index.html +2 -2
- package/public/{main-27RPBS22.js → main-UGYHSCMY.js} +1 -1
- package/public/{styles-CSF457UW.css → styles-WNHDEKE4.css} +1 -1
- package/scripts/extract-plugin-alias.js +8 -4
- package/public/chunk-P7TZIGJS.js +0 -50
- package/public/chunk-RYTGW6B7.js +0 -1
- package/public/chunk-SOT54YHI.js +0 -1
- package/public/chunk-VEGMNMLG.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,66 +7,92 @@ 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
13
|
var PluginsService_1;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
14
|
+
import { execSync, fork, spawn } from 'node:child_process';
|
|
15
|
+
import { constants, existsSync } from 'node:fs';
|
|
16
|
+
import { access, readdir, readFile, realpath, stat } from 'node:fs/promises';
|
|
17
|
+
import { createRequire } from 'node:module';
|
|
18
|
+
import { arch, cpus, platform, userInfo } from 'node:os';
|
|
19
|
+
import { basename, delimiter, dirname, join, resolve, sep, } from 'node:path';
|
|
20
|
+
import process from 'node:process';
|
|
21
|
+
import { HttpService } from '@nestjs/axios';
|
|
22
|
+
import { BadRequestException, Inject, Injectable, InternalServerErrorException, NotFoundException } from '@nestjs/common';
|
|
23
|
+
import axios from 'axios';
|
|
24
|
+
import { cyan, green, red, yellow } from 'bash-color';
|
|
25
|
+
import { createFile, ensureDir, pathExists, pathExistsSync, readJson, remove } from 'fs-extra/esm';
|
|
26
|
+
import _ from 'lodash';
|
|
27
|
+
import NodeCache from 'node-cache';
|
|
28
|
+
import pLimit from 'p-limit';
|
|
29
|
+
import { firstValueFrom } from 'rxjs';
|
|
30
|
+
import { gt, lt, parse, satisfies } from 'semver';
|
|
31
|
+
import { ConfigService } from '../../core/config/config.service.js';
|
|
32
|
+
import { Logger } from '../../core/logger/logger.service.js';
|
|
33
|
+
import { NodePtyService } from '../../core/node-pty/node-pty.service.js';
|
|
34
|
+
const { orderBy, uniq } = _;
|
|
35
|
+
const require = createRequire(import.meta.url);
|
|
36
|
+
let PluginsService = class PluginsService {
|
|
37
|
+
static { PluginsService_1 = this; }
|
|
38
|
+
httpService;
|
|
39
|
+
nodePtyService;
|
|
40
|
+
logger;
|
|
41
|
+
configService;
|
|
42
|
+
static PLUGIN_IDENTIFIER_PATTERN = /^(@[\w-]+(\.[\w-]+)*\/)?homebridge-[\w-]+$/;
|
|
43
|
+
_npm;
|
|
44
|
+
_paths;
|
|
45
|
+
get npm() {
|
|
46
|
+
if (!this._npm) {
|
|
47
|
+
this._npm = this.getNpmPath();
|
|
48
|
+
}
|
|
49
|
+
return this._npm;
|
|
50
|
+
}
|
|
51
|
+
get paths() {
|
|
52
|
+
if (!this._paths) {
|
|
53
|
+
this._paths = this.getBasePaths();
|
|
54
|
+
}
|
|
55
|
+
return this._paths;
|
|
56
|
+
}
|
|
57
|
+
installedPlugins;
|
|
58
|
+
npmPackage;
|
|
59
|
+
pluginListUrl = 'https://raw.githubusercontent.com/homebridge/plugins/latest/';
|
|
60
|
+
pluginListFile = `${this.pluginListUrl}assets/plugins-v2.min.json`;
|
|
61
|
+
pluginListRetryTimeout;
|
|
62
|
+
hiddenPlugins = [];
|
|
63
|
+
maintainedPlugins = [];
|
|
64
|
+
pluginIcons = {};
|
|
65
|
+
pluginAuthors = {};
|
|
66
|
+
pluginNames = {};
|
|
67
|
+
pluginChangelogs = {};
|
|
68
|
+
newScopePlugins = {};
|
|
69
|
+
verifiedPlugins = [];
|
|
70
|
+
verifiedPlusPlugins = [];
|
|
71
|
+
npmPluginCache = new NodeCache({ stdTTL: 300 });
|
|
72
|
+
pluginAliasCache = new NodeCache({ stdTTL: 86400 });
|
|
73
|
+
installedPluginsCache = new NodeCache({ stdTTL: 60 });
|
|
74
|
+
pluginAliasHints = {
|
|
75
|
+
'homebridge-broadlink-rm-pro': {
|
|
76
|
+
pluginAlias: 'BroadlinkRM',
|
|
77
|
+
pluginType: 'platform',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
35
80
|
constructor(httpService, nodePtyService, logger, configService) {
|
|
36
81
|
this.httpService = httpService;
|
|
37
82
|
this.nodePtyService = nodePtyService;
|
|
38
83
|
this.logger = logger;
|
|
39
84
|
this.configService = configService;
|
|
40
|
-
this.npm = this.getNpmPath();
|
|
41
|
-
this.paths = this.getBasePaths();
|
|
42
|
-
this.pluginListUrl = 'https://raw.githubusercontent.com/homebridge/plugins/latest/';
|
|
43
|
-
this.pluginListFile = `${this.pluginListUrl}assets/plugins-v2.min.json`;
|
|
44
|
-
this.hiddenPlugins = [];
|
|
45
|
-
this.maintainedPlugins = [];
|
|
46
|
-
this.pluginIcons = {};
|
|
47
|
-
this.pluginAuthors = {};
|
|
48
|
-
this.pluginNames = {};
|
|
49
|
-
this.pluginChangelogs = {};
|
|
50
|
-
this.newScopePlugins = {};
|
|
51
|
-
this.verifiedPlugins = [];
|
|
52
|
-
this.verifiedPlusPlugins = [];
|
|
53
|
-
this.npmPluginCache = new node_cache_1.default({ stdTTL: 300 });
|
|
54
|
-
this.pluginAliasCache = new node_cache_1.default({ stdTTL: 86400 });
|
|
55
|
-
this.installedPluginsCache = new node_cache_1.default({ stdTTL: 60 });
|
|
56
|
-
this.pluginAliasHints = {
|
|
57
|
-
'homebridge-broadlink-rm-pro': {
|
|
58
|
-
pluginAlias: 'BroadlinkRM',
|
|
59
|
-
pluginType: 'platform',
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
85
|
this.httpService.axiosRef.interceptors.request.use((config) => {
|
|
63
|
-
const source =
|
|
86
|
+
const source = axios.CancelToken.source();
|
|
64
87
|
config.cancelToken = source.token;
|
|
65
88
|
setTimeout(() => {
|
|
66
89
|
source.cancel('Timeout: request took more than 15 seconds');
|
|
67
90
|
}, 15000);
|
|
68
91
|
return config;
|
|
69
92
|
});
|
|
70
|
-
this.loadPluginList()
|
|
93
|
+
this.loadPluginList().catch((err) => {
|
|
94
|
+
this.logger.error('Failed to load plugin list during initialization:', err);
|
|
95
|
+
});
|
|
71
96
|
setInterval(this.loadPluginList.bind(this), 60000 * 60 * 12);
|
|
72
97
|
}
|
|
73
98
|
fixDisplayName(plugin) {
|
|
@@ -86,12 +111,12 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
86
111
|
const modules = await this.getInstalledModules();
|
|
87
112
|
const disabledPlugins = await this.getDisabledPlugins();
|
|
88
113
|
const homebridgePlugins = modules.filter(module => ((module.name.indexOf('homebridge-') === 0) || this.isScopedPlugin(module.name))
|
|
89
|
-
&&
|
|
90
|
-
const limit = (
|
|
114
|
+
&& pathExistsSync(join(module.installPath, 'package.json')));
|
|
115
|
+
const limit = pLimit(cpus().length);
|
|
91
116
|
await Promise.all(homebridgePlugins.map(async (pkg) => {
|
|
92
117
|
return limit(async () => {
|
|
93
118
|
try {
|
|
94
|
-
const pkgJson = await
|
|
119
|
+
const pkgJson = await readJson(join(pkg.installPath, 'package.json'));
|
|
95
120
|
if (pkgJson.keywords && pkgJson.keywords.includes('homebridge-plugin')) {
|
|
96
121
|
const plugin = await this.parsePackageJson(pkgJson, pkg.path);
|
|
97
122
|
plugin.disabled = disabledPlugins.includes(plugin.name);
|
|
@@ -120,21 +145,21 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
120
145
|
}
|
|
121
146
|
async lookupPlugin(pluginName) {
|
|
122
147
|
if (!PluginsService_1.PLUGIN_IDENTIFIER_PATTERN.test(pluginName)) {
|
|
123
|
-
throw new
|
|
148
|
+
throw new BadRequestException('Invalid plugin name.');
|
|
124
149
|
}
|
|
125
150
|
const lookup = await this.searchNpmRegistrySingle(pluginName);
|
|
126
151
|
if (!lookup.length) {
|
|
127
|
-
throw new
|
|
152
|
+
throw new NotFoundException();
|
|
128
153
|
}
|
|
129
154
|
return lookup[0];
|
|
130
155
|
}
|
|
131
156
|
async getAvailablePluginVersions(pluginName) {
|
|
132
157
|
if (!PluginsService_1.PLUGIN_IDENTIFIER_PATTERN.test(pluginName) && pluginName !== 'homebridge') {
|
|
133
|
-
throw new
|
|
158
|
+
throw new BadRequestException('Invalid plugin name.');
|
|
134
159
|
}
|
|
135
160
|
try {
|
|
136
161
|
const fromCache = this.npmPluginCache.get(`lookup-${pluginName}`);
|
|
137
|
-
const pkg = fromCache || (await
|
|
162
|
+
const pkg = fromCache || (await firstValueFrom((this.httpService.get(`https://registry.npmjs.org/${encodeURIComponent(pluginName).replace(/%40/g, '@')}`, {
|
|
138
163
|
headers: {
|
|
139
164
|
accept: 'application/vnd.npm.install-v1+json',
|
|
140
165
|
},
|
|
@@ -156,7 +181,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
156
181
|
};
|
|
157
182
|
}
|
|
158
183
|
catch (e) {
|
|
159
|
-
throw new
|
|
184
|
+
throw new NotFoundException();
|
|
160
185
|
}
|
|
161
186
|
}
|
|
162
187
|
extractTerms(query, separator) {
|
|
@@ -210,11 +235,11 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
210
235
|
const q = `${normalizedQuery.substring(0, 15)}+keywords:homebridge-plugin+not:deprecated&size=99`;
|
|
211
236
|
let searchResults;
|
|
212
237
|
try {
|
|
213
|
-
searchResults = (await
|
|
238
|
+
searchResults = (await firstValueFrom(this.httpService.get(`https://registry.npmjs.org/-/v1/search?text=${q}`))).data;
|
|
214
239
|
}
|
|
215
240
|
catch (e) {
|
|
216
241
|
this.logger.error(`Failed to search the npm registry (see https://homebridge.io/w/JJSz6 for help) as ${e.message}.`);
|
|
217
|
-
throw new
|
|
242
|
+
throw new InternalServerErrorException(`Failed to search the npm registry as ${e.message}, see logs.`);
|
|
218
243
|
}
|
|
219
244
|
const hiddenPluginsSet = new Set(this.hiddenPlugins);
|
|
220
245
|
const plugins = searchResults.objects
|
|
@@ -260,7 +285,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
260
285
|
matchGroups[matchType].push(plugin);
|
|
261
286
|
}
|
|
262
287
|
}
|
|
263
|
-
const orderPlugins = (arr) =>
|
|
288
|
+
const orderPlugins = (arr) => orderBy(arr, ['isHbScoped', 'verifiedPlusPlugin', 'verifiedPlugin', 'lastUpdated'], ['desc', 'desc', 'desc']);
|
|
264
289
|
return [
|
|
265
290
|
...orderPlugins(matchGroups.exactName),
|
|
266
291
|
...orderPlugins(matchGroups.exactKeyword),
|
|
@@ -272,7 +297,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
272
297
|
async searchNpmRegistrySingle(query) {
|
|
273
298
|
try {
|
|
274
299
|
const fromCache = this.npmPluginCache.get(`lookup-${query}`);
|
|
275
|
-
const pkg = fromCache || (await
|
|
300
|
+
const pkg = fromCache || (await firstValueFrom((this.httpService.get(`https://registry.npmjs.org/${encodeURIComponent(query).replace(/%40/g, '@')}`)))).data;
|
|
276
301
|
if (!fromCache) {
|
|
277
302
|
this.npmPluginCache.set(`lookup-${query}`, pkg, 60);
|
|
278
303
|
}
|
|
@@ -343,8 +368,8 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
343
368
|
if (action === 'install' && pluginAction.version === 'latest') {
|
|
344
369
|
pluginAction.version = await this.getNpmModuleLatestVersion(pluginAction.name);
|
|
345
370
|
}
|
|
346
|
-
const userPlatform =
|
|
347
|
-
if (this.configService.ui.webroot &&
|
|
371
|
+
const userPlatform = platform();
|
|
372
|
+
if (this.configService.ui.webroot && lt(pluginAction.version, '5.9.1-alpha.0')) {
|
|
348
373
|
throw new Error(`Cannot install HB UI v${pluginAction.version} when a webroot is configured.\n\r`
|
|
349
374
|
+ 'Please either:\n\r'
|
|
350
375
|
+ ' - Remove the configured webroot, restart Homebridge, then try the install again, or\n\r'
|
|
@@ -365,20 +390,20 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
365
390
|
return true;
|
|
366
391
|
}
|
|
367
392
|
catch (e) {
|
|
368
|
-
client.emit('stdout',
|
|
393
|
+
client.emit('stdout', yellow('\r\nBundled update failed. Trying regular update using npm.\r\n\r\n'));
|
|
369
394
|
}
|
|
370
395
|
}
|
|
371
|
-
if (
|
|
372
|
-
client.emit('stdout',
|
|
373
|
-
client.emit('stdout',
|
|
374
|
-
client.emit('stdout',
|
|
375
|
-
client.emit('stdout',
|
|
396
|
+
if (cpus().length === 1 && arch() === 'arm') {
|
|
397
|
+
client.emit('stdout', yellow('***************************************************************\r\n'));
|
|
398
|
+
client.emit('stdout', yellow(`Please be patient while ${this.configService.name} updates.\r\n`));
|
|
399
|
+
client.emit('stdout', yellow('This process may take 5-15 minutes to complete on your device.\r\n'));
|
|
400
|
+
client.emit('stdout', yellow('***************************************************************\r\n\r\n'));
|
|
376
401
|
}
|
|
377
402
|
const installOptions = [];
|
|
378
|
-
if (installPath === this.configService.customPluginPath && await
|
|
403
|
+
if (installPath === this.configService.customPluginPath && await pathExists(resolve(installPath, '../package.json'))) {
|
|
379
404
|
installOptions.push('--save');
|
|
380
405
|
}
|
|
381
|
-
installPath =
|
|
406
|
+
installPath = resolve(installPath, '../');
|
|
382
407
|
if (!this.configService.customPluginPath || userPlatform === 'win32' || existingPlugin?.globalInstall === true) {
|
|
383
408
|
installOptions.push('-g');
|
|
384
409
|
}
|
|
@@ -411,16 +436,16 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
411
436
|
return true;
|
|
412
437
|
}
|
|
413
438
|
catch (e) {
|
|
414
|
-
client.emit('stdout',
|
|
439
|
+
client.emit('stdout', yellow('\r\nBundled install / update could not complete. Trying regular install / update using npm.\r\n\r\n'));
|
|
415
440
|
}
|
|
416
441
|
}
|
|
417
442
|
const installOptions = [];
|
|
418
443
|
let npmPluginLabel = pluginAction.name;
|
|
419
|
-
if (installPath === this.configService.customPluginPath && await
|
|
444
|
+
if (installPath === this.configService.customPluginPath && await pathExists(resolve(installPath, '../package.json'))) {
|
|
420
445
|
installOptions.push('--save');
|
|
421
446
|
}
|
|
422
|
-
installPath =
|
|
423
|
-
if (!this.configService.customPluginPath ||
|
|
447
|
+
installPath = resolve(installPath, '../');
|
|
448
|
+
if (!this.configService.customPluginPath || platform() === 'win32' || existingPlugin?.globalInstall === true) {
|
|
424
449
|
installOptions.push('-g');
|
|
425
450
|
}
|
|
426
451
|
if (action === 'install') {
|
|
@@ -434,9 +459,9 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
434
459
|
}
|
|
435
460
|
async getHomebridgePackage() {
|
|
436
461
|
if (this.configService.ui.homebridgePackagePath) {
|
|
437
|
-
const pkgJsonPath =
|
|
438
|
-
if (await
|
|
439
|
-
return await this.parsePackageJson(await
|
|
462
|
+
const pkgJsonPath = join(this.configService.ui.homebridgePackagePath, 'package.json');
|
|
463
|
+
if (await pathExists(pkgJsonPath)) {
|
|
464
|
+
return await this.parsePackageJson(await readJson(pkgJsonPath), this.configService.ui.homebridgePackagePath);
|
|
440
465
|
}
|
|
441
466
|
else {
|
|
442
467
|
this.logger.error(`The Homebridge path ${this.configService.ui.homebridgePackagePath} does not exist.`);
|
|
@@ -456,20 +481,20 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
456
481
|
throw new Error('Unable To Find Homebridge Installation.');
|
|
457
482
|
}
|
|
458
483
|
const homebridgeModule = homebridgeInstalls[0];
|
|
459
|
-
const pkgJson = await
|
|
484
|
+
const pkgJson = await readJson(join(homebridgeModule.installPath, 'package.json'));
|
|
460
485
|
const homebridge = await this.parsePackageJson(pkgJson, homebridgeModule.path);
|
|
461
486
|
if (!homebridge.latestVersion) {
|
|
462
487
|
return homebridge;
|
|
463
488
|
}
|
|
464
|
-
const homebridgeVersion =
|
|
489
|
+
const homebridgeVersion = parse(homebridge.installedVersion);
|
|
465
490
|
const installedTag = homebridgeVersion.prerelease[0]?.toString();
|
|
466
491
|
if (!homebridge.updateAvailable) {
|
|
467
|
-
const shouldCheckBetas = (installedTag && ['alpha', 'beta', 'test'].includes(installedTag) &&
|
|
492
|
+
const shouldCheckBetas = (installedTag && ['alpha', 'beta', 'test'].includes(installedTag) && gt(homebridge.installedVersion, homebridge.latestVersion))
|
|
468
493
|
|| this.configService.ui.plugins?.alwaysShowBetas;
|
|
469
494
|
if (shouldCheckBetas) {
|
|
470
495
|
const versions = await this.getAvailablePluginVersions('homebridge');
|
|
471
496
|
const targetTag = this.configService.ui.plugins?.alwaysShowBetas && !installedTag ? 'beta' : installedTag;
|
|
472
|
-
if (versions.tags[targetTag] &&
|
|
497
|
+
if (versions.tags[targetTag] && gt(versions.tags[targetTag], homebridge.installedVersion)) {
|
|
473
498
|
homebridge.latestVersion = versions.tags[targetTag];
|
|
474
499
|
homebridge.updateAvailable = true;
|
|
475
500
|
homebridge.updateEngines = versions.versions?.[homebridge.latestVersion]?.engines || null;
|
|
@@ -489,11 +514,11 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
489
514
|
let installPath = homebridge.installPath;
|
|
490
515
|
const installOptions = [];
|
|
491
516
|
installOptions.push('--omit=dev');
|
|
492
|
-
if (installPath === this.configService.customPluginPath && await
|
|
517
|
+
if (installPath === this.configService.customPluginPath && await pathExists(resolve(installPath, '../package.json'))) {
|
|
493
518
|
installOptions.push('--save');
|
|
494
519
|
}
|
|
495
|
-
installPath =
|
|
496
|
-
if (homebridge.globalInstall ||
|
|
520
|
+
installPath = resolve(installPath, '../');
|
|
521
|
+
if (homebridge.globalInstall || platform() === 'win32') {
|
|
497
522
|
installOptions.push('-g');
|
|
498
523
|
}
|
|
499
524
|
await this.runNpmCommand([...this.npm, 'install', ...installOptions, `${homebridge.name}@${homebridgeUpdateAction.version}`], installPath, client, homebridgeUpdateAction.termCols, homebridgeUpdateAction.termRows);
|
|
@@ -513,9 +538,9 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
513
538
|
if (!npmPkg) {
|
|
514
539
|
throw new Error('Could not find npm package');
|
|
515
540
|
}
|
|
516
|
-
const pkgJson = await
|
|
541
|
+
const pkgJson = await readJson(join(npmPkg.installPath, 'package.json'));
|
|
517
542
|
const npm = await this.parsePackageJson(pkgJson, npmPkg.path);
|
|
518
|
-
npm.showUpdateWarning =
|
|
543
|
+
npm.showUpdateWarning = lt(npm.installedVersion, '9.5.0');
|
|
519
544
|
this.npmPackage = npm;
|
|
520
545
|
return npm;
|
|
521
546
|
}
|
|
@@ -528,7 +553,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
528
553
|
&& pluginAction.version !== 'latest') {
|
|
529
554
|
try {
|
|
530
555
|
const repoVersion = pluginAction.name.startsWith('@') ? 'v1.0.0-1' : 'v1.0.0';
|
|
531
|
-
await
|
|
556
|
+
await firstValueFrom(this.httpService.head(`https://github.com/homebridge/plugins/releases/download/${repoVersion}/${pluginAction.name.replace('/', '@')}-${pluginAction.version}.sha256`));
|
|
532
557
|
return true;
|
|
533
558
|
}
|
|
534
559
|
catch (e) {
|
|
@@ -540,7 +565,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
540
565
|
}
|
|
541
566
|
}
|
|
542
567
|
async doPluginBundleUpdate(pluginAction, client) {
|
|
543
|
-
const pluginUpgradeInstallScriptPath =
|
|
568
|
+
const pluginUpgradeInstallScriptPath = join(process.env.UIX_BASE_PATH, 'scripts/upgrade-install-plugin.sh');
|
|
544
569
|
await this.runNpmCommand([pluginUpgradeInstallScriptPath, pluginAction.name, pluginAction.version, this.configService.customPluginPath], this.configService.storagePath, client, pluginAction.termCols, pluginAction.termRows);
|
|
545
570
|
return true;
|
|
546
571
|
}
|
|
@@ -550,18 +575,18 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
550
575
|
'/usr/lib/node_modules',
|
|
551
576
|
'/opt/homebridge/lib/node_modules',
|
|
552
577
|
'/var/packages/homebridge/target/app/lib/node_modules',
|
|
553
|
-
].includes(
|
|
578
|
+
].includes(dirname(process.env.UIX_BASE_PATH))
|
|
554
579
|
&& pluginAction.name === this.configService.name
|
|
555
580
|
&& !['latest', 'alpha', 'beta'].includes(pluginAction.version)) {
|
|
556
581
|
try {
|
|
557
582
|
try {
|
|
558
583
|
const withV = `v${pluginAction.version}`;
|
|
559
|
-
await
|
|
584
|
+
await firstValueFrom(this.httpService.head(`https://github.com/homebridge/homebridge-config-ui-x/releases/download/${withV}/homebridge-config-ui-x-${pluginAction.version}.tar.gz`));
|
|
560
585
|
return withV;
|
|
561
586
|
}
|
|
562
587
|
catch (e2) {
|
|
563
588
|
const withoutV = pluginAction.version;
|
|
564
|
-
await
|
|
589
|
+
await firstValueFrom(this.httpService.head(`https://github.com/homebridge/homebridge-config-ui-x/releases/download/${withoutV}/homebridge-config-ui-x-${pluginAction.version}.tar.gz`));
|
|
565
590
|
return withoutV;
|
|
566
591
|
}
|
|
567
592
|
}
|
|
@@ -575,21 +600,21 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
575
600
|
}
|
|
576
601
|
}
|
|
577
602
|
async doUiBundleUpdate(pluginAction, client, githubReleaseName) {
|
|
578
|
-
const prefix =
|
|
579
|
-
const upgradeInstallScriptPath =
|
|
580
|
-
await this.runNpmCommand(this.configService.ui.sudo ? ['npm', 'run', 'upgrade-install', '--', pluginAction.version, prefix, githubReleaseName] : [upgradeInstallScriptPath, pluginAction.version, prefix, githubReleaseName],
|
|
603
|
+
const prefix = dirname(dirname(dirname(process.env.UIX_BASE_PATH)));
|
|
604
|
+
const upgradeInstallScriptPath = join(process.env.UIX_BASE_PATH, 'scripts/upgrade-install.sh');
|
|
605
|
+
await this.runNpmCommand(this.configService.ui.sudo ? ['npm', 'run', 'upgrade-install', '--', pluginAction.version, prefix, githubReleaseName] : [upgradeInstallScriptPath, pluginAction.version, prefix, githubReleaseName], process.env.UIX_BASE_PATH, client, pluginAction.termCols, pluginAction.termRows);
|
|
581
606
|
}
|
|
582
607
|
async updateSelfOffline(client) {
|
|
583
|
-
client.emit('stdout',
|
|
608
|
+
client.emit('stdout', yellow(`${this.configService.name} has been scheduled to update on the next container restart.\n\r\n\r`));
|
|
584
609
|
await new Promise(res => setTimeout(res, 800));
|
|
585
|
-
client.emit('stdout',
|
|
610
|
+
client.emit('stdout', yellow('The Docker container will now try and restart.\n\r\n\r'));
|
|
586
611
|
await new Promise(res => setTimeout(res, 800));
|
|
587
|
-
client.emit('stdout',
|
|
588
|
-
+
|
|
612
|
+
client.emit('stdout', yellow('If you have not started the Docker container with ')
|
|
613
|
+
+ red('--restart=always') + yellow(' you may\n\rneed to manually start the container again.\n\r\n\r'));
|
|
589
614
|
await new Promise(res => setTimeout(res, 800));
|
|
590
|
-
client.emit('stdout',
|
|
615
|
+
client.emit('stdout', yellow('This process may take several minutes. Please be patient.\n\r'));
|
|
591
616
|
await new Promise(res => setTimeout(res, 10000));
|
|
592
|
-
await
|
|
617
|
+
await createFile('/homebridge/.uix-upgrade-on-restart');
|
|
593
618
|
}
|
|
594
619
|
async getPluginConfigSchema(pluginName) {
|
|
595
620
|
if (!this.installedPlugins) {
|
|
@@ -597,19 +622,19 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
597
622
|
}
|
|
598
623
|
const plugin = this.installedPlugins.find(x => x.name === pluginName);
|
|
599
624
|
if (!plugin) {
|
|
600
|
-
throw new
|
|
625
|
+
throw new NotFoundException();
|
|
601
626
|
}
|
|
602
627
|
if (!plugin.settingsSchema) {
|
|
603
|
-
throw new
|
|
628
|
+
throw new NotFoundException();
|
|
604
629
|
}
|
|
605
|
-
const schemaPath =
|
|
606
|
-
let configSchema = await
|
|
630
|
+
const schemaPath = resolve(plugin.installPath, pluginName, 'config.schema.json');
|
|
631
|
+
let configSchema = await readJson(schemaPath);
|
|
607
632
|
if (configSchema.dynamicSchemaVersion) {
|
|
608
|
-
const dynamicSchemaPath =
|
|
633
|
+
const dynamicSchemaPath = resolve(this.configService.storagePath, `.${pluginName}-v${configSchema.dynamicSchemaVersion}.schema.json`);
|
|
609
634
|
this.logger.log(`[${pluginName}] dynamic schema path: ${dynamicSchemaPath}.`);
|
|
610
|
-
if (
|
|
635
|
+
if (existsSync(dynamicSchemaPath)) {
|
|
611
636
|
try {
|
|
612
|
-
configSchema = await
|
|
637
|
+
configSchema = await readJson(dynamicSchemaPath);
|
|
613
638
|
this.logger.log(`[${pluginName}] dynamic schema loaded from ${dynamicSchemaPath}.`);
|
|
614
639
|
}
|
|
615
640
|
catch (e) {
|
|
@@ -695,34 +720,34 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
695
720
|
await this.getInstalledPlugins();
|
|
696
721
|
const plugin = this.installedPlugins.find(x => x.name === pluginName);
|
|
697
722
|
if (!plugin) {
|
|
698
|
-
throw new
|
|
723
|
+
throw new NotFoundException();
|
|
699
724
|
}
|
|
700
|
-
const changeLog =
|
|
701
|
-
if (await
|
|
725
|
+
const changeLog = resolve(plugin.installPath, plugin.name, 'CHANGELOG.md');
|
|
726
|
+
if (await pathExists(changeLog)) {
|
|
702
727
|
return {
|
|
703
|
-
changelog: await
|
|
728
|
+
changelog: await readFile(changeLog, 'utf8'),
|
|
704
729
|
};
|
|
705
730
|
}
|
|
706
731
|
else {
|
|
707
|
-
throw new
|
|
732
|
+
throw new NotFoundException();
|
|
708
733
|
}
|
|
709
734
|
}
|
|
710
735
|
async getPluginRelease(pluginName) {
|
|
711
736
|
let latestVersion = null;
|
|
712
737
|
try {
|
|
713
|
-
const pkg = (await
|
|
738
|
+
const pkg = (await firstValueFrom((this.httpService.get(`https://registry.npmjs.org/${encodeURIComponent(pluginName).replace(/%40/g, '@')}`)))).data;
|
|
714
739
|
latestVersion = pkg['dist-tags'] ? pkg['dist-tags'].latest : null;
|
|
715
740
|
}
|
|
716
741
|
catch (e) {
|
|
717
|
-
throw new
|
|
742
|
+
throw new NotFoundException();
|
|
718
743
|
}
|
|
719
744
|
switch (pluginName) {
|
|
720
745
|
case 'homebridge':
|
|
721
746
|
case 'homebridge-config-ui-x': {
|
|
722
747
|
try {
|
|
723
|
-
const release = await
|
|
724
|
-
const tags = await
|
|
725
|
-
const changelog = await
|
|
748
|
+
const release = await firstValueFrom(this.httpService.get(`https://api.github.com/repos/homebridge/${pluginName}/releases/latest`));
|
|
749
|
+
const tags = await firstValueFrom(this.httpService.get(`https://api.github.com/repos/homebridge/${pluginName}/tags`));
|
|
750
|
+
const changelog = await firstValueFrom(this.httpService.get(`https://raw.githubusercontent.com/homebridge/${pluginName}/refs/tags/${tags.data[0].name}/CHANGELOG.md`));
|
|
726
751
|
return {
|
|
727
752
|
name: release.data.name,
|
|
728
753
|
notes: release.data.body,
|
|
@@ -743,33 +768,33 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
743
768
|
await this.getInstalledPlugins();
|
|
744
769
|
const plugin = this.installedPlugins.find(x => x.name === pluginName);
|
|
745
770
|
if (!plugin) {
|
|
746
|
-
throw new
|
|
771
|
+
throw new NotFoundException();
|
|
747
772
|
}
|
|
748
773
|
if (!plugin.links.homepage && !plugin.links.bugs) {
|
|
749
|
-
throw new
|
|
774
|
+
throw new NotFoundException();
|
|
750
775
|
}
|
|
751
776
|
const repoMatch = plugin.links.homepage?.match(/https:\/\/github.com\/([^/]+)\/([^/#]+)/);
|
|
752
777
|
const bugsMatch = plugin.links.bugs?.match(/https:\/\/github.com\/([^/]+)\/([^/#]+)/);
|
|
753
778
|
let match = repoMatch;
|
|
754
779
|
if (!repoMatch) {
|
|
755
780
|
if (!bugsMatch) {
|
|
756
|
-
throw new
|
|
781
|
+
throw new NotFoundException();
|
|
757
782
|
}
|
|
758
783
|
match = bugsMatch;
|
|
759
784
|
}
|
|
760
785
|
try {
|
|
761
|
-
const release = await
|
|
786
|
+
const release = await firstValueFrom(this.httpService.get(`https://api.github.com/repos/${match[1]}/${match[2]}/releases/latest`));
|
|
762
787
|
const latestTag = release.data.tag_name;
|
|
763
788
|
const isReleaseMatch = latestVersion?.replace(/[^0-9.]/g, '').includes(release.data.tag_name?.replace(/[^0-9.]/g, ''));
|
|
764
789
|
const changelogPath = this.pluginChangelogs[pluginName] || '';
|
|
765
790
|
let changelogData = null;
|
|
766
791
|
try {
|
|
767
|
-
const changelog = await
|
|
792
|
+
const changelog = await firstValueFrom(this.httpService.get(`https://raw.githubusercontent.com/${match[1]}/${match[2]}/refs/tags/${latestTag}/${changelogPath}CHANGELOG.md`));
|
|
768
793
|
changelogData = changelog.data;
|
|
769
794
|
}
|
|
770
795
|
catch {
|
|
771
796
|
try {
|
|
772
|
-
const changelog = (await
|
|
797
|
+
const changelog = (await firstValueFrom(this.httpService.get(`https://raw.githubusercontent.com/${match[1]}/${match[2]}/refs/tags/${latestTag}/${changelogPath}changelog.md`))).data;
|
|
773
798
|
changelogData = changelog.data;
|
|
774
799
|
}
|
|
775
800
|
catch { }
|
|
@@ -782,7 +807,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
782
807
|
};
|
|
783
808
|
}
|
|
784
809
|
catch (e) {
|
|
785
|
-
throw new
|
|
810
|
+
throw new NotFoundException();
|
|
786
811
|
}
|
|
787
812
|
}
|
|
788
813
|
}
|
|
@@ -793,7 +818,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
793
818
|
}
|
|
794
819
|
const plugin = this.installedPlugins.find(x => x.name === pluginName);
|
|
795
820
|
if (!plugin) {
|
|
796
|
-
throw new
|
|
821
|
+
throw new NotFoundException();
|
|
797
822
|
}
|
|
798
823
|
const fromCache = this.pluginAliasCache.get(pluginName);
|
|
799
824
|
if (fromCache) {
|
|
@@ -811,9 +836,9 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
811
836
|
else {
|
|
812
837
|
try {
|
|
813
838
|
await new Promise((res, rej) => {
|
|
814
|
-
const child =
|
|
839
|
+
const child = fork(resolve(process.env.UIX_BASE_PATH, 'scripts/extract-plugin-alias.js'), {
|
|
815
840
|
env: {
|
|
816
|
-
UIX_EXTRACT_PLUGIN_PATH:
|
|
841
|
+
UIX_EXTRACT_PLUGIN_PATH: resolve(plugin.installPath, plugin.name),
|
|
817
842
|
},
|
|
818
843
|
stdio: 'ignore',
|
|
819
844
|
});
|
|
@@ -850,19 +875,19 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
850
875
|
await this.getInstalledPlugins();
|
|
851
876
|
}
|
|
852
877
|
const plugin = this.installedPlugins.find(x => x.name === pluginName);
|
|
853
|
-
const fullPath =
|
|
854
|
-
const schema = await
|
|
855
|
-
const customUiPath =
|
|
856
|
-
const publicPath =
|
|
857
|
-
const serverPath =
|
|
878
|
+
const fullPath = resolve(plugin.installPath, plugin.name);
|
|
879
|
+
const schema = await readJson(resolve(fullPath, 'config.schema.json'));
|
|
880
|
+
const customUiPath = resolve(fullPath, schema.customUiPath || 'homebridge-ui');
|
|
881
|
+
const publicPath = resolve(customUiPath, 'public');
|
|
882
|
+
const serverPath = resolve(customUiPath, 'server.js');
|
|
858
883
|
const devServer = plugin.private ? schema.customUiDevServer : null;
|
|
859
|
-
if (!devServer && !await
|
|
884
|
+
if (!devServer && !await pathExists(customUiPath)) {
|
|
860
885
|
throw new Error(`Plugin does not provide a custom UI at expected location: ${customUiPath}`);
|
|
861
886
|
}
|
|
862
|
-
if (!devServer && !(await
|
|
863
|
-
throw new Error(`Custom UI path is outside the plugin root: ${await
|
|
887
|
+
if (!devServer && !(await realpath(customUiPath)).startsWith(await realpath(fullPath))) {
|
|
888
|
+
throw new Error(`Custom UI path is outside the plugin root: ${await realpath(customUiPath)}`);
|
|
864
889
|
}
|
|
865
|
-
if (await
|
|
890
|
+
if (await pathExists(resolve(publicPath, 'index.html')) || devServer) {
|
|
866
891
|
return {
|
|
867
892
|
devServer,
|
|
868
893
|
serverPath,
|
|
@@ -874,7 +899,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
874
899
|
}
|
|
875
900
|
async getDisabledPlugins() {
|
|
876
901
|
try {
|
|
877
|
-
const config = await
|
|
902
|
+
const config = await readJson(this.configService.configPath);
|
|
878
903
|
if (Array.isArray(config.disabledPlugins)) {
|
|
879
904
|
return config.disabledPlugins;
|
|
880
905
|
}
|
|
@@ -888,14 +913,14 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
888
913
|
}
|
|
889
914
|
async getInstalledScopedModules(requiredPath, scope) {
|
|
890
915
|
try {
|
|
891
|
-
if ((await
|
|
892
|
-
const scopedModules = await
|
|
916
|
+
if ((await stat(join(requiredPath, scope))).isDirectory()) {
|
|
917
|
+
const scopedModules = await readdir(join(requiredPath, scope));
|
|
893
918
|
return scopedModules
|
|
894
919
|
.filter(x => x.startsWith('homebridge-'))
|
|
895
920
|
.map((x) => {
|
|
896
921
|
return {
|
|
897
|
-
name:
|
|
898
|
-
installPath:
|
|
922
|
+
name: join(scope, x).split(sep).join('/'),
|
|
923
|
+
installPath: join(requiredPath, scope, x),
|
|
899
924
|
path: requiredPath,
|
|
900
925
|
};
|
|
901
926
|
});
|
|
@@ -912,7 +937,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
912
937
|
async getInstalledModules() {
|
|
913
938
|
const allModules = [];
|
|
914
939
|
for (const requiredPath of this.paths) {
|
|
915
|
-
const modules = await
|
|
940
|
+
const modules = await readdir(requiredPath);
|
|
916
941
|
for (const module of modules) {
|
|
917
942
|
try {
|
|
918
943
|
if (module.charAt(0) === '@') {
|
|
@@ -921,7 +946,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
921
946
|
else {
|
|
922
947
|
allModules.push({
|
|
923
948
|
name: module,
|
|
924
|
-
installPath:
|
|
949
|
+
installPath: join(requiredPath, module),
|
|
925
950
|
path: requiredPath,
|
|
926
951
|
});
|
|
927
952
|
}
|
|
@@ -934,16 +959,16 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
934
959
|
if (allModules.findIndex(x => x.name === 'homebridge-config-ui-x') === -1) {
|
|
935
960
|
allModules.push({
|
|
936
961
|
name: 'homebridge-config-ui-x',
|
|
937
|
-
installPath:
|
|
938
|
-
path:
|
|
962
|
+
installPath: process.env.UIX_BASE_PATH,
|
|
963
|
+
path: dirname(process.env.UIX_BASE_PATH),
|
|
939
964
|
});
|
|
940
965
|
}
|
|
941
966
|
if (allModules.findIndex(x => x.name === 'homebridge') === -1) {
|
|
942
|
-
if (
|
|
967
|
+
if (existsSync(join(process.env.UIX_BASE_PATH, '..', 'homebridge'))) {
|
|
943
968
|
allModules.push({
|
|
944
969
|
name: 'homebridge',
|
|
945
|
-
installPath:
|
|
946
|
-
path:
|
|
970
|
+
installPath: join(process.env.UIX_BASE_PATH, '..', 'homebridge'),
|
|
971
|
+
path: dirname(join(process.env.UIX_BASE_PATH, '..', 'homebridge')),
|
|
947
972
|
});
|
|
948
973
|
}
|
|
949
974
|
}
|
|
@@ -953,12 +978,12 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
953
978
|
return (name.charAt(0) === '@' && name.split('/').length > 0 && name.split('/')[1].indexOf('homebridge-') === 0);
|
|
954
979
|
}
|
|
955
980
|
getNpmPath() {
|
|
956
|
-
if (
|
|
981
|
+
if (platform() === 'win32') {
|
|
957
982
|
const windowsNpmPath = [
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
].filter(
|
|
983
|
+
join(process.env.APPDATA, 'npm/npm.cmd'),
|
|
984
|
+
join(process.env.ProgramFiles, 'nodejs/npm.cmd'),
|
|
985
|
+
join(process.env.NVM_SYMLINK || `${process.env.ProgramFiles}/nodejs`, 'npm.cmd'),
|
|
986
|
+
].filter(existsSync);
|
|
962
987
|
if (windowsNpmPath.length) {
|
|
963
988
|
return [windowsNpmPath[0]];
|
|
964
989
|
}
|
|
@@ -981,33 +1006,33 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
981
1006
|
}
|
|
982
1007
|
else {
|
|
983
1008
|
paths = paths.concat(require.main?.paths || []);
|
|
984
|
-
if (
|
|
985
|
-
paths =
|
|
1009
|
+
if (process.env.NODE_PATH) {
|
|
1010
|
+
paths = process.env.NODE_PATH.split(delimiter).filter(p => !!p).concat(paths);
|
|
986
1011
|
}
|
|
987
1012
|
else {
|
|
988
|
-
if ((
|
|
1013
|
+
if ((platform() !== 'win32')) {
|
|
989
1014
|
paths.push('/usr/local/lib/node_modules');
|
|
990
1015
|
paths.push('/usr/lib/node_modules');
|
|
991
1016
|
}
|
|
992
1017
|
paths.push(...this.getNpmPrefixToSearchPaths());
|
|
993
1018
|
}
|
|
994
|
-
paths = paths.filter(x => x !==
|
|
1019
|
+
paths = paths.filter(x => x !== join(process.env.UIX_BASE_PATH, 'node_modules'));
|
|
995
1020
|
}
|
|
996
|
-
return
|
|
997
|
-
return
|
|
1021
|
+
return uniq(paths).filter((requiredPath) => {
|
|
1022
|
+
return existsSync(requiredPath);
|
|
998
1023
|
});
|
|
999
1024
|
}
|
|
1000
1025
|
getNpmPrefixToSearchPaths() {
|
|
1001
1026
|
const paths = [];
|
|
1002
|
-
if ((
|
|
1003
|
-
paths.push(
|
|
1027
|
+
if ((platform() === 'win32')) {
|
|
1028
|
+
paths.push(join(process.env.APPDATA, 'npm/node_modules'));
|
|
1004
1029
|
}
|
|
1005
1030
|
else {
|
|
1006
|
-
paths.push(
|
|
1031
|
+
paths.push(execSync('/bin/echo -n "$(npm -g prefix)/lib/node_modules"', {
|
|
1007
1032
|
env: Object.assign({
|
|
1008
1033
|
npm_config_loglevel: 'silent',
|
|
1009
1034
|
npm_update_notifier: 'false',
|
|
1010
|
-
},
|
|
1035
|
+
}, process.env),
|
|
1011
1036
|
}).toString('utf8'));
|
|
1012
1037
|
}
|
|
1013
1038
|
return paths;
|
|
@@ -1030,7 +1055,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1030
1055
|
isHbMaintained: this.maintainedPlugins.includes(pkgJson.name),
|
|
1031
1056
|
installedVersion: installPath ? (pkgJson.version || '0.0.1') : null,
|
|
1032
1057
|
globalInstall: (installPath !== this.configService.customPluginPath),
|
|
1033
|
-
settingsSchema: await
|
|
1058
|
+
settingsSchema: await pathExists(resolve(installPath, pkgJson.name, 'config.schema.json')),
|
|
1034
1059
|
engines: pkgJson.engines,
|
|
1035
1060
|
installPath,
|
|
1036
1061
|
};
|
|
@@ -1049,20 +1074,20 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1049
1074
|
const fromCache = this.npmPluginCache.get(plugin.name);
|
|
1050
1075
|
plugin.updateAvailable = false;
|
|
1051
1076
|
plugin.updateTag = null;
|
|
1052
|
-
const pkg = fromCache || (await
|
|
1077
|
+
const pkg = fromCache || (await firstValueFrom(this.httpService.get(`https://registry.npmjs.org/${encodeURIComponent(plugin.name).replace(/%40/g, '@')}/latest`))).data;
|
|
1053
1078
|
plugin.latestVersion = pkg.version;
|
|
1054
|
-
plugin.updateAvailable =
|
|
1079
|
+
plugin.updateAvailable = gt(pkg.version, plugin.installedVersion);
|
|
1055
1080
|
plugin.updateEngines = plugin.updateAvailable ? pkg.engines : null;
|
|
1056
1081
|
if (!plugin.updateAvailable) {
|
|
1057
|
-
const pluginVersion =
|
|
1082
|
+
const pluginVersion = parse(plugin.installedVersion);
|
|
1058
1083
|
const installedTag = pluginVersion.prerelease[0]?.toString();
|
|
1059
1084
|
const shouldCheckBetas = (installedTag
|
|
1060
1085
|
&& ['alpha', 'beta', 'test'].includes(installedTag)
|
|
1061
|
-
&&
|
|
1086
|
+
&& gt(plugin.installedVersion, plugin.latestVersion)) || this.configService.ui.plugins?.alwaysShowBetas;
|
|
1062
1087
|
if (shouldCheckBetas) {
|
|
1063
1088
|
const versions = await this.getAvailablePluginVersions(plugin.name);
|
|
1064
1089
|
const targetTag = this.configService.ui.plugins?.alwaysShowBetas && !installedTag ? 'beta' : installedTag;
|
|
1065
|
-
if (versions.tags[targetTag] &&
|
|
1090
|
+
if (versions.tags[targetTag] && gt(versions.tags[targetTag], plugin.installedVersion)) {
|
|
1066
1091
|
plugin.latestVersion = versions.tags[targetTag];
|
|
1067
1092
|
plugin.updateAvailable = true;
|
|
1068
1093
|
plugin.updateEngines = versions.versions?.[plugin.latestVersion]?.engines || null;
|
|
@@ -1096,7 +1121,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1096
1121
|
}
|
|
1097
1122
|
async getNpmModuleLatestVersion(npmModuleName) {
|
|
1098
1123
|
try {
|
|
1099
|
-
const response = await
|
|
1124
|
+
const response = await firstValueFrom(this.httpService.get(`https://registry.npmjs.org/${npmModuleName}/latest`));
|
|
1100
1125
|
return response.data.version;
|
|
1101
1126
|
}
|
|
1102
1127
|
catch (e) {
|
|
@@ -1113,29 +1138,29 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1113
1138
|
else {
|
|
1114
1139
|
let npmInstallPath;
|
|
1115
1140
|
try {
|
|
1116
|
-
npmInstallPath =
|
|
1141
|
+
npmInstallPath = execSync('npm root -g').toString().trim();
|
|
1117
1142
|
}
|
|
1118
1143
|
catch (e) {
|
|
1119
|
-
npmInstallPath =
|
|
1144
|
+
npmInstallPath = resolve(cwd, 'node_modules');
|
|
1120
1145
|
}
|
|
1121
1146
|
try {
|
|
1122
|
-
await
|
|
1147
|
+
await access(npmInstallPath, constants.W_OK);
|
|
1123
1148
|
}
|
|
1124
1149
|
catch (e) {
|
|
1125
|
-
client.emit('stdout',
|
|
1150
|
+
client.emit('stdout', yellow(`The user "${userInfo().username}" does not have write access to the target directory:\n\r\n\r`));
|
|
1126
1151
|
client.emit('stdout', `${npmInstallPath}\n\r\n\r`);
|
|
1127
|
-
client.emit('stdout',
|
|
1128
|
-
client.emit('stdout',
|
|
1129
|
-
client.emit('stdout',
|
|
1152
|
+
client.emit('stdout', yellow('This may cause the operation to fail.\n\r'));
|
|
1153
|
+
client.emit('stdout', yellow('See the docs for details on how to enable sudo mode:\n\r'));
|
|
1154
|
+
client.emit('stdout', yellow('https://github.com/homebridge/homebridge-config-ui-x/wiki/Manual-Configuration#sudo-mode\n\r\n\r'));
|
|
1130
1155
|
}
|
|
1131
1156
|
}
|
|
1132
1157
|
this.logger.log(`Running command ${command.join(' ')}.`);
|
|
1133
|
-
if (!
|
|
1134
|
-
client.emit('stdout',
|
|
1135
|
-
client.emit('stdout',
|
|
1158
|
+
if (!satisfies(process.version, `>=${this.configService.minimumNodeVersion}`)) {
|
|
1159
|
+
client.emit('stdout', yellow(`Node.js v${this.configService.minimumNodeVersion} higher is required for ${this.configService.name}.\n\r`));
|
|
1160
|
+
client.emit('stdout', yellow(`You may experience issues while running on Node.js ${process.version}.\n\r\n\r`));
|
|
1136
1161
|
}
|
|
1137
1162
|
const env = {};
|
|
1138
|
-
Object.assign(env,
|
|
1163
|
+
Object.assign(env, process.env);
|
|
1139
1164
|
Object.assign(env, {
|
|
1140
1165
|
npm_config_global_style: 'true',
|
|
1141
1166
|
npm_config_unsafe_perm: 'true',
|
|
@@ -1144,20 +1169,20 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1144
1169
|
npm_config_foreground_scripts: 'true',
|
|
1145
1170
|
npm_config_loglevel: 'error',
|
|
1146
1171
|
});
|
|
1147
|
-
if (command.includes('-g') &&
|
|
1148
|
-
cwd =
|
|
1172
|
+
if (command.includes('-g') && basename(cwd) === 'lib') {
|
|
1173
|
+
cwd = dirname(cwd);
|
|
1149
1174
|
Object.assign(env, {
|
|
1150
1175
|
npm_config_prefix: cwd,
|
|
1151
1176
|
});
|
|
1152
1177
|
}
|
|
1153
|
-
if (
|
|
1178
|
+
if (platform() === 'win32') {
|
|
1154
1179
|
Object.assign(env, {
|
|
1155
1180
|
npm_config_prefix: cwd,
|
|
1156
1181
|
});
|
|
1157
1182
|
}
|
|
1158
|
-
client.emit('stdout',
|
|
1159
|
-
client.emit('stdout',
|
|
1160
|
-
client.emit('stdout',
|
|
1183
|
+
client.emit('stdout', cyan(`USER: ${userInfo().username}\n\r`));
|
|
1184
|
+
client.emit('stdout', cyan(`DIR: ${cwd}\n\r`));
|
|
1185
|
+
client.emit('stdout', cyan(`CMD: ${command.join(' ')}\n\r\n\r`));
|
|
1161
1186
|
this.installedPluginsCache.del('installed-plugins');
|
|
1162
1187
|
await new Promise((res, rej) => {
|
|
1163
1188
|
const term = this.nodePtyService.spawn(command.shift(), command, {
|
|
@@ -1173,7 +1198,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1173
1198
|
term.onExit(({ exitCode }) => {
|
|
1174
1199
|
if (exitCode === 0) {
|
|
1175
1200
|
clearTimeout(timeoutTimer);
|
|
1176
|
-
client.emit('stdout',
|
|
1201
|
+
client.emit('stdout', green('\n\rOperation succeeded!.\n\r'));
|
|
1177
1202
|
res(null);
|
|
1178
1203
|
}
|
|
1179
1204
|
else {
|
|
@@ -1190,10 +1215,10 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1190
1215
|
if (!this.configService.customPluginPath) {
|
|
1191
1216
|
return;
|
|
1192
1217
|
}
|
|
1193
|
-
if (!await
|
|
1218
|
+
if (!await pathExists(this.configService.customPluginPath)) {
|
|
1194
1219
|
this.logger.warn(`Custom plugin directory was removed, re-creating ${this.configService.customPluginPath}.`);
|
|
1195
1220
|
try {
|
|
1196
|
-
await
|
|
1221
|
+
await ensureDir(this.configService.customPluginPath);
|
|
1197
1222
|
}
|
|
1198
1223
|
catch (e) {
|
|
1199
1224
|
this.logger.error(`Failed to re-create custom plugin directory as ${e.message}.`);
|
|
@@ -1204,10 +1229,10 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1204
1229
|
if (!this.configService.customPluginPath) {
|
|
1205
1230
|
return;
|
|
1206
1231
|
}
|
|
1207
|
-
const offendingPath =
|
|
1232
|
+
const offendingPath = resolve(this.configService.customPluginPath, '@eaDir');
|
|
1208
1233
|
try {
|
|
1209
|
-
if (!await
|
|
1210
|
-
await
|
|
1234
|
+
if (!await pathExists(offendingPath)) {
|
|
1235
|
+
await remove(offendingPath);
|
|
1211
1236
|
}
|
|
1212
1237
|
}
|
|
1213
1238
|
catch (e) {
|
|
@@ -1221,7 +1246,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1221
1246
|
}
|
|
1222
1247
|
return new Promise((res) => {
|
|
1223
1248
|
const fullCommand = command.join(' ');
|
|
1224
|
-
const child =
|
|
1249
|
+
const child = spawn(fullCommand, { shell: true });
|
|
1225
1250
|
child.on('exit', (code) => {
|
|
1226
1251
|
this.logger.log(`Executed npm cache clear command with exit code ${code}.`);
|
|
1227
1252
|
res(null);
|
|
@@ -1233,7 +1258,7 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1233
1258
|
async loadPluginList() {
|
|
1234
1259
|
clearTimeout(this.pluginListRetryTimeout);
|
|
1235
1260
|
try {
|
|
1236
|
-
const pluginList = (await
|
|
1261
|
+
const pluginList = (await firstValueFrom(this.httpService.get(this.pluginListFile, {
|
|
1237
1262
|
httpsAgent: null,
|
|
1238
1263
|
})));
|
|
1239
1264
|
const pluginListData = pluginList.data;
|
|
@@ -1283,13 +1308,16 @@ let PluginsService = PluginsService_1 = class PluginsService {
|
|
|
1283
1308
|
}
|
|
1284
1309
|
}
|
|
1285
1310
|
};
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
(
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1311
|
+
PluginsService = PluginsService_1 = __decorate([
|
|
1312
|
+
Injectable(),
|
|
1313
|
+
__param(0, Inject(HttpService)),
|
|
1314
|
+
__param(1, Inject(NodePtyService)),
|
|
1315
|
+
__param(2, Inject(Logger)),
|
|
1316
|
+
__param(3, Inject(ConfigService)),
|
|
1317
|
+
__metadata("design:paramtypes", [HttpService,
|
|
1318
|
+
NodePtyService,
|
|
1319
|
+
Logger,
|
|
1320
|
+
ConfigService])
|
|
1294
1321
|
], PluginsService);
|
|
1322
|
+
export { PluginsService };
|
|
1295
1323
|
//# sourceMappingURL=plugins.service.js.map
|