homebridge-config-ui-x 5.9.1-beta.0 → 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.
Files changed (359) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/dist/app.controller.d.ts +1 -1
  3. package/dist/app.controller.js +14 -12
  4. package/dist/app.controller.js.map +1 -1
  5. package/dist/app.gateway.js +7 -10
  6. package/dist/app.gateway.js.map +1 -1
  7. package/dist/app.module.js +40 -43
  8. package/dist/app.module.js.map +1 -1
  9. package/dist/app.service.js +4 -7
  10. package/dist/app.service.js.map +1 -1
  11. package/dist/bin/base-platform.d.ts +1 -1
  12. package/dist/bin/base-platform.js +11 -17
  13. package/dist/bin/base-platform.js.map +1 -1
  14. package/dist/bin/fork.js +7 -45
  15. package/dist/bin/fork.js.map +1 -1
  16. package/dist/bin/hb-service.js +224 -243
  17. package/dist/bin/hb-service.js.map +1 -1
  18. package/dist/bin/platforms/darwin.d.ts +1 -1
  19. package/dist/bin/platforms/darwin.js +61 -65
  20. package/dist/bin/platforms/darwin.js.map +1 -1
  21. package/dist/bin/platforms/freebsd.d.ts +1 -1
  22. package/dist/bin/platforms/freebsd.js +42 -47
  23. package/dist/bin/platforms/freebsd.js.map +1 -1
  24. package/dist/bin/platforms/linux.d.ts +1 -1
  25. package/dist/bin/platforms/linux.js +127 -132
  26. package/dist/bin/platforms/linux.js.map +1 -1
  27. package/dist/bin/platforms/win32.d.ts +1 -1
  28. package/dist/bin/platforms/win32.js +30 -36
  29. package/dist/bin/platforms/win32.js.map +1 -1
  30. package/dist/bin/standalone.js +15 -53
  31. package/dist/bin/standalone.js.map +1 -1
  32. package/dist/core/auth/auth.controller.d.ts +3 -3
  33. package/dist/core/auth/auth.controller.js +40 -39
  34. package/dist/core/auth/auth.controller.js.map +1 -1
  35. package/dist/core/auth/auth.dto.js +17 -18
  36. package/dist/core/auth/auth.dto.js.map +1 -1
  37. package/dist/core/auth/auth.module.js +28 -31
  38. package/dist/core/auth/auth.module.js.map +1 -1
  39. package/dist/core/auth/auth.service.d.ts +3 -3
  40. package/dist/core/auth/auth.service.js +65 -62
  41. package/dist/core/auth/auth.service.js.map +1 -1
  42. package/dist/core/auth/guards/admin.guard.js +4 -7
  43. package/dist/core/auth/guards/admin.guard.js.map +1 -1
  44. package/dist/core/auth/guards/custom.guard.js +6 -9
  45. package/dist/core/auth/guards/custom.guard.js.map +1 -1
  46. package/dist/core/auth/guards/ws-admin-guard.d.ts +1 -1
  47. package/dist/core/auth/guards/ws-admin-guard.js +13 -11
  48. package/dist/core/auth/guards/ws-admin-guard.js.map +1 -1
  49. package/dist/core/auth/guards/ws.guard.d.ts +1 -1
  50. package/dist/core/auth/guards/ws.guard.js +13 -11
  51. package/dist/core/auth/guards/ws.guard.js.map +1 -1
  52. package/dist/core/auth/jwt.strategy.d.ts +3 -2
  53. package/dist/core/auth/jwt.strategy.js +21 -16
  54. package/dist/core/auth/jwt.strategy.js.map +1 -1
  55. package/dist/core/config/config.interfaces.js +1 -2
  56. package/dist/core/config/config.module.js +8 -10
  57. package/dist/core/config/config.module.js.map +1 -1
  58. package/dist/core/config/config.service.d.ts +2 -2
  59. package/dist/core/config/config.service.js +88 -82
  60. package/dist/core/config/config.service.js.map +1 -1
  61. package/dist/core/config/config.startup.d.ts +1 -1
  62. package/dist/core/config/config.startup.js +23 -28
  63. package/dist/core/config/config.startup.js.map +1 -1
  64. package/dist/core/feature-flags/feature-flags.registry.js +1 -4
  65. package/dist/core/feature-flags/feature-flags.registry.js.map +1 -1
  66. package/dist/core/homebridge-ipc/homebridge-ipc.module.js +11 -14
  67. package/dist/core/homebridge-ipc/homebridge-ipc.module.js.map +1 -1
  68. package/dist/core/homebridge-ipc/homebridge-ipc.service.d.ts +2 -2
  69. package/dist/core/homebridge-ipc/homebridge-ipc.service.js +24 -19
  70. package/dist/core/homebridge-ipc/homebridge-ipc.service.js.map +1 -1
  71. package/dist/core/logger/logger.module.js +8 -10
  72. package/dist/core/logger/logger.module.js.map +1 -1
  73. package/dist/core/logger/logger.service.js +13 -23
  74. package/dist/core/logger/logger.service.js.map +1 -1
  75. package/dist/core/node-pty/node-pty.module.js +7 -10
  76. package/dist/core/node-pty/node-pty.module.js.map +1 -1
  77. package/dist/core/node-pty/node-pty.service.js +6 -11
  78. package/dist/core/node-pty/node-pty.service.js.map +1 -1
  79. package/dist/core/node-version.constants.js +4 -11
  80. package/dist/core/node-version.constants.js.map +1 -1
  81. package/dist/core/scheduler/scheduler.module.js +7 -10
  82. package/dist/core/scheduler/scheduler.module.js.map +1 -1
  83. package/dist/core/scheduler/scheduler.service.js +9 -14
  84. package/dist/core/scheduler/scheduler.service.js.map +1 -1
  85. package/dist/core/spa/spa-html.service.js +9 -15
  86. package/dist/core/spa/spa-html.service.js.map +1 -1
  87. package/dist/core/spa/spa.filter.d.ts +1 -1
  88. package/dist/core/spa/spa.filter.js +11 -16
  89. package/dist/core/spa/spa.filter.js.map +1 -1
  90. package/dist/core/ssl/ssl-cert-generator.service.d.ts +1 -1
  91. package/dist/core/ssl/ssl-cert-generator.service.js +34 -36
  92. package/dist/core/ssl/ssl-cert-generator.service.js.map +1 -1
  93. package/dist/env-setup.d.ts +1 -0
  94. package/dist/env-setup.js +7 -0
  95. package/dist/env-setup.js.map +1 -0
  96. package/dist/globalDefaults.d.ts +1 -0
  97. package/dist/globalDefaults.js +1 -0
  98. package/dist/index.d.ts +1 -1
  99. package/dist/index.js +16 -19
  100. package/dist/index.js.map +1 -1
  101. package/dist/main.d.ts +5 -3
  102. package/dist/main.js +44 -51
  103. package/dist/main.js.map +1 -1
  104. package/dist/modules/accessories/accessories.controller.d.ts +2 -2
  105. package/dist/modules/accessories/accessories.controller.js +27 -29
  106. package/dist/modules/accessories/accessories.controller.js.map +1 -1
  107. package/dist/modules/accessories/accessories.dto.js +11 -13
  108. package/dist/modules/accessories/accessories.dto.js.map +1 -1
  109. package/dist/modules/accessories/accessories.gateway.d.ts +1 -1
  110. package/dist/modules/accessories/accessories.gateway.js +18 -16
  111. package/dist/modules/accessories/accessories.gateway.js.map +1 -1
  112. package/dist/modules/accessories/accessories.module.js +17 -20
  113. package/dist/modules/accessories/accessories.module.js.map +1 -1
  114. package/dist/modules/accessories/accessories.service.d.ts +2 -2
  115. package/dist/modules/accessories/accessories.service.js +37 -35
  116. package/dist/modules/accessories/accessories.service.js.map +1 -1
  117. package/dist/modules/backup/backup.controller.d.ts +2 -2
  118. package/dist/modules/backup/backup.controller.js +68 -67
  119. package/dist/modules/backup/backup.controller.js.map +1 -1
  120. package/dist/modules/backup/backup.gateway.d.ts +2 -2
  121. package/dist/modules/backup/backup.gateway.js +25 -21
  122. package/dist/modules/backup/backup.gateway.js.map +1 -1
  123. package/dist/modules/backup/backup.module.js +22 -25
  124. package/dist/modules/backup/backup.module.js.map +1 -1
  125. package/dist/modules/backup/backup.service.d.ts +5 -5
  126. package/dist/modules/backup/backup.service.js +143 -133
  127. package/dist/modules/backup/backup.service.js.map +1 -1
  128. package/dist/modules/child-bridges/child-bridges.gateway.d.ts +2 -2
  129. package/dist/modules/child-bridges/child-bridges.gateway.js +23 -21
  130. package/dist/modules/child-bridges/child-bridges.gateway.js.map +1 -1
  131. package/dist/modules/child-bridges/child-bridges.interfaces.js +1 -2
  132. package/dist/modules/child-bridges/child-bridges.module.js +19 -22
  133. package/dist/modules/child-bridges/child-bridges.module.js.map +1 -1
  134. package/dist/modules/child-bridges/child-bridges.service.d.ts +3 -3
  135. package/dist/modules/child-bridges/child-bridges.service.js +15 -11
  136. package/dist/modules/child-bridges/child-bridges.service.js.map +1 -1
  137. package/dist/modules/config-editor/config-editor.controller.d.ts +6 -6
  138. package/dist/modules/config-editor/config-editor.controller.js +94 -95
  139. package/dist/modules/config-editor/config-editor.controller.js.map +1 -1
  140. package/dist/modules/config-editor/config-editor.module.js +21 -24
  141. package/dist/modules/config-editor/config-editor.module.js.map +1 -1
  142. package/dist/modules/config-editor/config-editor.service.d.ts +6 -6
  143. package/dist/modules/config-editor/config-editor.service.js +65 -57
  144. package/dist/modules/config-editor/config-editor.service.js.map +1 -1
  145. package/dist/modules/custom-plugins/custom-plugins.module.js +10 -13
  146. package/dist/modules/custom-plugins/custom-plugins.module.js.map +1 -1
  147. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.d.ts +1 -1
  148. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.js +21 -19
  149. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.js.map +1 -1
  150. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.js +14 -17
  151. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.js.map +1 -1
  152. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.d.ts +1 -1
  153. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.js +18 -15
  154. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.js.map +1 -1
  155. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.d.ts +1 -1
  156. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.js +21 -19
  157. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.js.map +1 -1
  158. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.module.js +14 -17
  159. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.module.js.map +1 -1
  160. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.d.ts +1 -1
  161. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.js +18 -15
  162. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.js.map +1 -1
  163. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.d.ts +1 -1
  164. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js +18 -19
  165. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js.map +1 -1
  166. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.d.ts +1 -1
  167. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.js +15 -13
  168. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.js.map +1 -1
  169. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.module.js +18 -21
  170. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.module.js.map +1 -1
  171. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.d.ts +4 -4
  172. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js +47 -41
  173. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js.map +1 -1
  174. package/dist/modules/log/log.gateway.d.ts +2 -2
  175. package/dist/modules/log/log.gateway.js +15 -13
  176. package/dist/modules/log/log.gateway.js.map +1 -1
  177. package/dist/modules/log/log.interfaces.js +1 -2
  178. package/dist/modules/log/log.module.js +14 -17
  179. package/dist/modules/log/log.module.js.map +1 -1
  180. package/dist/modules/log/log.service.d.ts +3 -3
  181. package/dist/modules/log/log.service.js +47 -43
  182. package/dist/modules/log/log.service.js.map +1 -1
  183. package/dist/modules/platform-tools/docker/docker.controller.d.ts +1 -1
  184. package/dist/modules/platform-tools/docker/docker.controller.js +24 -25
  185. package/dist/modules/platform-tools/docker/docker.controller.js.map +1 -1
  186. package/dist/modules/platform-tools/docker/docker.module.js +14 -17
  187. package/dist/modules/platform-tools/docker/docker.module.js.map +1 -1
  188. package/dist/modules/platform-tools/docker/docker.service.d.ts +2 -2
  189. package/dist/modules/platform-tools/docker/docker.service.js +20 -16
  190. package/dist/modules/platform-tools/docker/docker.service.js.map +1 -1
  191. package/dist/modules/platform-tools/hb-service/hb-service.controller.d.ts +2 -2
  192. package/dist/modules/platform-tools/hb-service/hb-service.controller.js +35 -36
  193. package/dist/modules/platform-tools/hb-service/hb-service.controller.js.map +1 -1
  194. package/dist/modules/platform-tools/hb-service/hb-service.dto.js +20 -19
  195. package/dist/modules/platform-tools/hb-service/hb-service.dto.js.map +1 -1
  196. package/dist/modules/platform-tools/hb-service/hb-service.module.js +14 -17
  197. package/dist/modules/platform-tools/hb-service/hb-service.module.js.map +1 -1
  198. package/dist/modules/platform-tools/hb-service/hb-service.service.d.ts +3 -3
  199. package/dist/modules/platform-tools/hb-service/hb-service.service.js +37 -30
  200. package/dist/modules/platform-tools/hb-service/hb-service.service.js.map +1 -1
  201. package/dist/modules/platform-tools/linux/linux.controller.d.ts +1 -1
  202. package/dist/modules/platform-tools/linux/linux.controller.js +23 -21
  203. package/dist/modules/platform-tools/linux/linux.controller.js.map +1 -1
  204. package/dist/modules/platform-tools/linux/linux.module.js +14 -17
  205. package/dist/modules/platform-tools/linux/linux.module.js.map +1 -1
  206. package/dist/modules/platform-tools/linux/linux.service.d.ts +2 -2
  207. package/dist/modules/platform-tools/linux/linux.service.js +18 -14
  208. package/dist/modules/platform-tools/linux/linux.service.js.map +1 -1
  209. package/dist/modules/platform-tools/platform-tools.module.js +12 -15
  210. package/dist/modules/platform-tools/platform-tools.module.js.map +1 -1
  211. package/dist/modules/platform-tools/terminal/terminal.controller.d.ts +1 -1
  212. package/dist/modules/platform-tools/terminal/terminal.controller.js +15 -13
  213. package/dist/modules/platform-tools/terminal/terminal.controller.js.map +1 -1
  214. package/dist/modules/platform-tools/terminal/terminal.gateway.d.ts +2 -2
  215. package/dist/modules/platform-tools/terminal/terminal.gateway.js +17 -15
  216. package/dist/modules/platform-tools/terminal/terminal.gateway.js.map +1 -1
  217. package/dist/modules/platform-tools/terminal/terminal.interfaces.js +1 -2
  218. package/dist/modules/platform-tools/terminal/terminal.module.js +18 -21
  219. package/dist/modules/platform-tools/terminal/terminal.module.js.map +1 -1
  220. package/dist/modules/platform-tools/terminal/terminal.service.d.ts +4 -4
  221. package/dist/modules/platform-tools/terminal/terminal.service.js +33 -28
  222. package/dist/modules/platform-tools/terminal/terminal.service.js.map +1 -1
  223. package/dist/modules/plugins/plugins.controller.d.ts +6 -6
  224. package/dist/modules/plugins/plugins.controller.js +51 -52
  225. package/dist/modules/plugins/plugins.controller.js.map +1 -1
  226. package/dist/modules/plugins/plugins.dto.js +26 -24
  227. package/dist/modules/plugins/plugins.dto.js.map +1 -1
  228. package/dist/modules/plugins/plugins.gateway.d.ts +3 -3
  229. package/dist/modules/plugins/plugins.gateway.js +38 -34
  230. package/dist/modules/plugins/plugins.gateway.js.map +1 -1
  231. package/dist/modules/plugins/plugins.interfaces.js +1 -2
  232. package/dist/modules/plugins/plugins.module.js +23 -26
  233. package/dist/modules/plugins/plugins.module.js.map +1 -1
  234. package/dist/modules/plugins/plugins.service.d.ts +9 -7
  235. package/dist/modules/plugins/plugins.service.js +231 -202
  236. package/dist/modules/plugins/plugins.service.js.map +1 -1
  237. package/dist/modules/server/server.controller.d.ts +34 -4
  238. package/dist/modules/server/server.controller.js +294 -177
  239. package/dist/modules/server/server.controller.js.map +1 -1
  240. package/dist/modules/server/server.dto.js +13 -16
  241. package/dist/modules/server/server.dto.js.map +1 -1
  242. package/dist/modules/server/server.module.js +23 -26
  243. package/dist/modules/server/server.module.js.map +1 -1
  244. package/dist/modules/server/server.service.d.ts +36 -6
  245. package/dist/modules/server/server.service.js +406 -150
  246. package/dist/modules/server/server.service.js.map +1 -1
  247. package/dist/modules/setup-wizard/setup-wizard.controller.d.ts +2 -2
  248. package/dist/modules/setup-wizard/setup-wizard.controller.js +19 -20
  249. package/dist/modules/setup-wizard/setup-wizard.controller.js.map +1 -1
  250. package/dist/modules/setup-wizard/setup-wizard.gateway.d.ts +2 -2
  251. package/dist/modules/setup-wizard/setup-wizard.gateway.js +25 -21
  252. package/dist/modules/setup-wizard/setup-wizard.gateway.js.map +1 -1
  253. package/dist/modules/setup-wizard/setup-wizard.guard.d.ts +1 -1
  254. package/dist/modules/setup-wizard/setup-wizard.guard.js +11 -9
  255. package/dist/modules/setup-wizard/setup-wizard.guard.js.map +1 -1
  256. package/dist/modules/setup-wizard/setup-wizard.module.js +12 -15
  257. package/dist/modules/setup-wizard/setup-wizard.module.js.map +1 -1
  258. package/dist/modules/status/status.controller.d.ts +5 -5
  259. package/dist/modules/status/status.controller.js +40 -36
  260. package/dist/modules/status/status.controller.js.map +1 -1
  261. package/dist/modules/status/status.gateway.d.ts +9 -9
  262. package/dist/modules/status/status.gateway.js +51 -47
  263. package/dist/modules/status/status.gateway.js.map +1 -1
  264. package/dist/modules/status/status.interfaces.js +2 -5
  265. package/dist/modules/status/status.interfaces.js.map +1 -1
  266. package/dist/modules/status/status.module.js +26 -29
  267. package/dist/modules/status/status.module.js.map +1 -1
  268. package/dist/modules/status/status.service.d.ts +7 -7
  269. package/dist/modules/status/status.service.js +100 -88
  270. package/dist/modules/status/status.service.js.map +1 -1
  271. package/dist/modules/users/users.controller.d.ts +2 -2
  272. package/dist/modules/users/users.controller.js +59 -60
  273. package/dist/modules/users/users.controller.js.map +1 -1
  274. package/dist/modules/users/users.dto.js +51 -45
  275. package/dist/modules/users/users.dto.js.map +1 -1
  276. package/dist/modules/users/users.module.js +14 -17
  277. package/dist/modules/users/users.module.js.map +1 -1
  278. package/dist/self-check.js +25 -25
  279. package/dist/self-check.js.map +1 -1
  280. package/docs/ssl-upload-pr.md +103 -0
  281. package/package.json +6 -7
  282. package/public/{chunk-PPA66JI2.js → chunk-2FNQEOXF.js} +1 -1
  283. package/public/{chunk-HERKNFLL.js → chunk-2SCTALGY.js} +1 -1
  284. package/public/{chunk-BQTGMLQB.js → chunk-3IJXQMYZ.js} +1 -1
  285. package/public/chunk-425ZEUU6.js +1 -0
  286. package/public/{chunk-EHHNHG6Q.js → chunk-4T6CM7M3.js} +1 -1
  287. package/public/{chunk-IKY3F7MM.js → chunk-7SKTJO5M.js} +1 -1
  288. package/public/{chunk-E4ZKIFZH.js → chunk-7UDDRMZZ.js} +1 -1
  289. package/public/{chunk-Y2N6WV2O.js → chunk-ATMY4YI2.js} +1 -1
  290. package/public/{chunk-UKEKNQEJ.js → chunk-AZIRJR4B.js} +1 -1
  291. package/public/{chunk-2UQL2OTF.js → chunk-B2XE365J.js} +1 -1
  292. package/public/{chunk-JWHZQ7YI.js → chunk-BMKJTHFC.js} +1 -1
  293. package/public/{chunk-R2PMDKTD.js → chunk-CGYD722J.js} +1 -1
  294. package/public/{chunk-BI2TS6NN.js → chunk-CQREAKPC.js} +4 -4
  295. package/public/{chunk-WMGV3KS6.js → chunk-CYBDQV2B.js} +1 -1
  296. package/public/{chunk-TJEQFEML.js → chunk-D5RKKI2A.js} +1 -1
  297. package/public/{chunk-NUCXRR5D.js → chunk-EAGKQ5OJ.js} +1 -1
  298. package/public/{chunk-EYO3XCE2.js → chunk-FGNMMSZH.js} +1 -1
  299. package/public/{chunk-FGS4HIPD.js → chunk-FTKWC2Q2.js} +1 -1
  300. package/public/{chunk-QU4I4QSX.js → chunk-HFW5E2OW.js} +1 -1
  301. package/public/chunk-IIDLQ7XY.js +1 -0
  302. package/public/{chunk-4E4YMHG4.js → chunk-INX52LH2.js} +1 -1
  303. package/public/{chunk-VFIOPF3O.js → chunk-JD5JQTN5.js} +1 -1
  304. package/public/{chunk-RLWY3GD4.js → chunk-JFRCT5V7.js} +1 -1
  305. package/public/{chunk-JWCVCB6V.js → chunk-JJ7TVAIH.js} +4 -4
  306. package/public/{chunk-JWY7RFE6.js → chunk-JPCV77W6.js} +1 -1
  307. package/public/{chunk-ISV4M72Q.js → chunk-K7D2P3SM.js} +1 -1
  308. package/public/chunk-L66ATRVT.js +1 -0
  309. package/public/{chunk-IXIZVUXX.js → chunk-LARQLRNL.js} +1 -1
  310. package/public/{chunk-BVTPAZF3.js → chunk-LHCMU3MO.js} +1 -1
  311. package/public/{chunk-5T6O4JCR.js → chunk-LZQVKA4S.js} +1 -1
  312. package/public/{chunk-7F6JT34E.js → chunk-M7QUT5ZZ.js} +1 -1
  313. package/public/{chunk-2MFBHUTD.js → chunk-MDBZMB6Y.js} +1 -1
  314. package/public/{chunk-HVGUNGBB.js → chunk-MNVUSYOZ.js} +1 -1
  315. package/public/{chunk-ZC3JEQZ5.js → chunk-N2TWGDNX.js} +1 -1
  316. package/public/{chunk-XS5JK2LY.js → chunk-NKNWXFAK.js} +1 -1
  317. package/public/{chunk-SOA3BB36.js → chunk-OS2SEJZU.js} +1 -1
  318. package/public/{chunk-IEO2AG2N.js → chunk-PXSEH255.js} +1 -1
  319. package/public/{chunk-QJLKBB62.js → chunk-PZ2ZCCFR.js} +1 -1
  320. package/public/{chunk-CWTDHTPI.js → chunk-QCZ4VVDL.js} +1 -1
  321. package/public/{chunk-5W7EKO7F.js → chunk-QSVZNI3M.js} +1 -1
  322. package/public/{chunk-4H7ODI34.js → chunk-QUA46GZJ.js} +1 -1
  323. package/public/{chunk-D4LRW76J.js → chunk-QVLCTKQH.js} +1 -1
  324. package/public/{chunk-DL2QDFLD.js → chunk-RQ4B2IIV.js} +1 -1
  325. package/public/{chunk-OTOQR5Z2.js → chunk-RQAFAZAK.js} +1 -1
  326. package/public/{chunk-4AWJ2PWG.js → chunk-S4OE2ITZ.js} +1 -1
  327. package/public/{chunk-ZF6W5Z5R.js → chunk-SA5C7QVC.js} +1 -1
  328. package/public/{chunk-USXMCNIE.js → chunk-SSZBNSOM.js} +1 -1
  329. package/public/{chunk-E7S36RMO.js → chunk-TA6DOQC5.js} +1 -1
  330. package/public/{chunk-VB4UAZWJ.js → chunk-TC77PFBQ.js} +1 -1
  331. package/public/{chunk-5WTTTYNS.js → chunk-TKGKVKOW.js} +1 -1
  332. package/public/{chunk-FOSFENMV.js → chunk-TSFGO3MA.js} +1 -1
  333. package/public/{chunk-IBO6BDNZ.js → chunk-UEDMHOPK.js} +1 -1
  334. package/public/{chunk-LI4BZAUI.js → chunk-UOPWP4RR.js} +1 -1
  335. package/public/chunk-UTFHCUKB.js +1 -0
  336. package/public/{chunk-SXOLKD36.js → chunk-UTN2R7WG.js} +1 -1
  337. package/public/chunk-UV24H47X.js +1 -0
  338. package/public/{chunk-B5Z4M7ZJ.js → chunk-VSBBKD6B.js} +1 -1
  339. package/public/{chunk-AO7VT6PL.js → chunk-VYC5JLE6.js} +1 -1
  340. package/public/{chunk-AOALMLGY.js → chunk-W7UNXMCL.js} +1 -1
  341. package/public/{chunk-NIERW5KT.js → chunk-WVCOONJF.js} +1 -1
  342. package/public/{chunk-RON3LUMX.js → chunk-WWSLIQVD.js} +1 -1
  343. package/public/{chunk-4DVF333O.js → chunk-X3IVSHIL.js} +1 -1
  344. package/public/{chunk-5G7T74GR.js → chunk-XE5VJDQL.js} +1 -1
  345. package/public/chunk-XMNXI4QP.js +50 -0
  346. package/public/{chunk-W26VKO62.js → chunk-XX5GWADI.js} +1 -1
  347. package/public/{chunk-TGX55EFG.js → chunk-Y5XBENWZ.js} +1 -1
  348. package/public/{chunk-Z6VQEXUS.js → chunk-YNONXMOG.js} +1 -1
  349. package/public/{chunk-DIWD6B4C.js → chunk-ZEI3HZ6P.js} +1 -1
  350. package/public/index.html +2 -2
  351. package/public/{main-QP5R7HI3.js → main-UGYHSCMY.js} +1 -1
  352. package/public/{styles-CSF457UW.css → styles-WNHDEKE4.css} +1 -1
  353. package/scripts/extract-plugin-alias.js +8 -4
  354. package/public/chunk-2ADAW5AD.js +0 -1
  355. package/public/chunk-2Y63WBU6.js +0 -1
  356. package/public/chunk-I3QQTGGZ.js +0 -1
  357. package/public/chunk-LGE6SGDN.js +0 -1
  358. package/public/chunk-PZD3OMMY.js +0 -1
  359. package/public/chunk-QOSAHW73.js +0 -50
@@ -1,100 +1,82 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.HomebridgeServiceHelper = void 0;
41
- const node_buffer_1 = require("node:buffer");
42
- const node_child_process_1 = require("node:child_process");
43
- const node_os_1 = require("node:os");
44
- const node_path_1 = require("node:path");
45
- const node_process_1 = __importDefault(require("node:process"));
46
- const axios_1 = __importDefault(require("axios"));
47
- const commander_1 = require("commander");
48
- const fs_extra_1 = require("fs-extra");
49
- const ora_1 = __importDefault(require("ora"));
50
- const semver_1 = require("semver");
51
- const systeminformation_1 = require("systeminformation");
52
- const tail_1 = require("tail");
53
- const tar_1 = require("tar");
54
- const tcp_port_used_1 = require("tcp-port-used");
55
- const darwin_1 = require("./platforms/darwin");
56
- const freebsd_1 = require("./platforms/freebsd");
57
- const linux_1 = require("./platforms/linux");
58
- const win32_1 = require("./platforms/win32");
59
- node_process_1.default.title = 'hb-service';
60
- class HomebridgeServiceHelper {
2
+ import { Buffer } from 'node:buffer';
3
+ import { execSync, fork } from 'node:child_process';
4
+ import { chownSync, createReadStream, createWriteStream, existsSync } from 'node:fs';
5
+ import { mkdtemp, open, readFile, rename, stat } from 'node:fs/promises';
6
+ import { arch, cpus, homedir, platform, release, tmpdir, type } from 'node:os';
7
+ import { dirname, join, resolve } from 'node:path';
8
+ import process from 'node:process';
9
+ import { fileURLToPath } from 'node:url';
10
+ import axios from 'axios';
11
+ import { program } from 'commander';
12
+ import { mkdirp, pathExists, pathExistsSync, readJson, readJsonSync, remove, writeJson } from 'fs-extra/esm';
13
+ import ora from 'ora';
14
+ import { gt, gte, parse } from 'semver';
15
+ import { networkInterfaceDefault, networkInterfaces } from 'systeminformation';
16
+ import { Tail } from 'tail';
17
+ import { extract } from 'tar';
18
+ import { check as tcpCheck } from 'tcp-port-used';
19
+ import { DarwinInstaller } from './platforms/darwin.js';
20
+ import { FreeBSDInstaller } from './platforms/freebsd.js';
21
+ import { LinuxInstaller } from './platforms/linux.js';
22
+ import { Win32Installer } from './platforms/win32.js';
23
+ process.title = 'hb-service';
24
+ const __filename = fileURLToPath(import.meta.url);
25
+ const __dirname = dirname(__filename);
26
+ export class HomebridgeServiceHelper {
27
+ action;
28
+ selfPath = __filename;
29
+ serviceName = 'Homebridge';
30
+ storagePath;
31
+ usingCustomStoragePath = false;
32
+ allowRunRoot = false;
33
+ enableHbServicePluginManagement = false;
34
+ asUser;
35
+ addGroup;
36
+ log;
37
+ homebridgeModulePath;
38
+ homebridgePackage;
39
+ homebridgeBinary;
40
+ homebridge;
41
+ homebridgeOpts = ['-I'];
42
+ homebridgeCustomEnv = {};
43
+ uiBinary;
44
+ stdout;
45
+ docker;
46
+ uid;
47
+ gid;
48
+ uiPort = 8581;
49
+ installer;
50
+ ipcService;
61
51
  get logPath() {
62
- return (0, node_path_1.resolve)(this.storagePath, 'homebridge.log');
52
+ return resolve(this.storagePath, 'homebridge.log');
63
53
  }
64
54
  constructor() {
65
- this.selfPath = __filename;
66
- this.serviceName = 'Homebridge';
67
- this.usingCustomStoragePath = false;
68
- this.allowRunRoot = false;
69
- this.enableHbServicePluginManagement = false;
70
- this.homebridgeOpts = ['-I'];
71
- this.homebridgeCustomEnv = {};
72
- this.uiPort = 8581;
73
55
  this.nodeVersionCheck();
74
- switch ((0, node_os_1.platform)()) {
56
+ switch (platform()) {
75
57
  case 'linux':
76
- this.installer = new linux_1.LinuxInstaller(this);
58
+ this.installer = new LinuxInstaller(this);
77
59
  break;
78
60
  case 'win32':
79
- this.installer = new win32_1.Win32Installer(this);
61
+ this.installer = new Win32Installer(this);
80
62
  break;
81
63
  case 'darwin':
82
- this.installer = new darwin_1.DarwinInstaller(this);
64
+ this.installer = new DarwinInstaller(this);
83
65
  break;
84
66
  case 'freebsd':
85
- this.installer = new freebsd_1.FreeBSDInstaller(this);
67
+ this.installer = new FreeBSDInstaller(this);
86
68
  break;
87
69
  default:
88
- this.logger(`ERROR: This command is not supported on ${(0, node_os_1.platform)()}.`, 'fail');
89
- node_process_1.default.exit(1);
70
+ this.logger(`ERROR: This command is not supported on ${platform()}.`, 'fail');
71
+ process.exit(1);
90
72
  }
91
- commander_1.program
73
+ program
92
74
  .allowUnknownOption()
93
75
  .allowExcessArguments()
94
76
  .storeOptionsAsProperties(true)
95
77
  .arguments('[install|uninstall|start|stop|restart|rebuild|run|logs|view|add|remove]')
96
78
  .option('-P, --plugin-path <path>', '', (p) => {
97
- node_process_1.default.env.UIX_CUSTOM_PLUGIN_PATH = p;
79
+ process.env.UIX_CUSTOM_PLUGIN_PATH = p;
98
80
  this.homebridgeOpts.push('-P', p);
99
81
  })
100
82
  .option('-U, --user-storage-path <path>', '', (p) => {
@@ -104,7 +86,7 @@ class HomebridgeServiceHelper {
104
86
  .option('-S, --service-name <service name>', 'The name of the homebridge service to install or control', p => this.serviceName = p)
105
87
  .option('-T, --no-timestamp', '', () => this.homebridgeOpts.push('-T'))
106
88
  .option('--strict-plugin-resolution', '', () => {
107
- node_process_1.default.env.UIX_STRICT_PLUGIN_RESOLUTION = '1';
89
+ process.env.UIX_STRICT_PLUGIN_RESOLUTION = '1';
108
90
  })
109
91
  .option('--port <port>', 'The port to set to the Homebridge UI when installing as a service', p => this.uiPort = Number.parseInt(p, 10))
110
92
  .option('--user <user>', 'The user account the Homebridge service will be installed as (Linux, FreeBSD, macOS only)', p => this.asUser = p)
@@ -118,7 +100,7 @@ class HomebridgeServiceHelper {
118
100
  .action((cmd) => {
119
101
  this.action = cmd;
120
102
  })
121
- .parse(node_process_1.default.argv);
103
+ .parse(process.argv);
122
104
  this.setEnv();
123
105
  switch (this.action) {
124
106
  case 'install': {
@@ -146,8 +128,8 @@ class HomebridgeServiceHelper {
146
128
  break;
147
129
  }
148
130
  case 'rebuild': {
149
- this.logger(`Rebuilding for Node.js ${node_process_1.default.version}...`);
150
- this.installer.rebuild(commander_1.program.args.includes('--all'));
131
+ this.logger(`Rebuilding for Node.js ${process.version}...`);
132
+ this.installer.rebuild(program.args.includes('--all'));
151
133
  break;
152
134
  }
153
135
  case 'run': {
@@ -163,15 +145,15 @@ class HomebridgeServiceHelper {
163
145
  break;
164
146
  }
165
147
  case 'add': {
166
- this.npmPluginManagement(commander_1.program.args);
148
+ this.npmPluginManagement(program.args);
167
149
  break;
168
150
  }
169
151
  case 'remove': {
170
- this.npmPluginManagement(commander_1.program.args);
152
+ this.npmPluginManagement(program.args);
171
153
  break;
172
154
  }
173
155
  case 'update-node': {
174
- this.checkForNodejsUpdates(commander_1.program.args.length === 2 ? commander_1.program.args[1] : null);
156
+ this.checkForNodejsUpdates(program.args.length === 2 ? program.args[1] : null);
175
157
  break;
176
158
  }
177
159
  case 'before-start': {
@@ -183,7 +165,7 @@ class HomebridgeServiceHelper {
183
165
  break;
184
166
  }
185
167
  default: {
186
- commander_1.program.outputHelp();
168
+ program.outputHelp();
187
169
  console.log('\nThe hb-service command is provided by homebridge-config-ui-x\n');
188
170
  console.log('Please provide a command:');
189
171
  console.log(' install install homebridge as a service');
@@ -202,7 +184,7 @@ class HomebridgeServiceHelper {
202
184
  console.log(' view views the homebridge service logs for 30 seconds');
203
185
  console.log(' update-node [version] update Node.js');
204
186
  console.log('\nSee the wiki for help with hb-service: https://homebridge.io/w/JTtHK \n');
205
- node_process_1.default.exit(1);
187
+ process.exit(1);
206
188
  }
207
189
  }
208
190
  }
@@ -218,55 +200,55 @@ class HomebridgeServiceHelper {
218
200
  }
219
201
  }
220
202
  else {
221
- (0, ora_1.default)()[level](msg);
203
+ ora()[level](msg);
222
204
  }
223
205
  }
224
206
  setEnv() {
225
207
  if (!this.serviceName.match(/^[a-z0-9-]+$/i)) {
226
208
  this.logger('Service name must not contain spaces or special characters.', 'fail');
227
- node_process_1.default.exit(1);
209
+ process.exit(1);
228
210
  }
229
211
  if (!this.storagePath) {
230
- if ((0, node_os_1.platform)() === 'linux' || (0, node_os_1.platform)() === 'freebsd') {
231
- this.storagePath = (0, node_path_1.resolve)('/var/lib', this.serviceName.toLowerCase());
212
+ if (platform() === 'linux' || platform() === 'freebsd') {
213
+ this.storagePath = resolve('/var/lib', this.serviceName.toLowerCase());
232
214
  }
233
215
  else {
234
- this.storagePath = (0, node_path_1.resolve)((0, node_os_1.homedir)(), `.${this.serviceName.toLowerCase()}`);
216
+ this.storagePath = resolve(homedir(), `.${this.serviceName.toLowerCase()}`);
235
217
  }
236
218
  }
237
- if (node_process_1.default.env.CONFIG_UI_VERSION && node_process_1.default.env.HOMEBRIDGE_VERSION && node_process_1.default.env.QEMU_ARCH) {
238
- if ((0, node_os_1.platform)() === 'linux' && ['install', 'uninstall', 'start', 'stop', 'restart', 'logs'].includes(this.action)) {
219
+ if (process.env.CONFIG_UI_VERSION && process.env.HOMEBRIDGE_VERSION && process.env.QEMU_ARCH) {
220
+ if (platform() === 'linux' && ['install', 'uninstall', 'start', 'stop', 'restart', 'logs'].includes(this.action)) {
239
221
  this.logger(`Sorry, the ${this.action} command is not supported in Docker.`, 'fail');
240
- node_process_1.default.exit(1);
222
+ process.exit(1);
241
223
  }
242
224
  }
243
- this.enableHbServicePluginManagement = (node_process_1.default.env.UIX_CUSTOM_PLUGIN_PATH
244
- && (Boolean(node_process_1.default.env.HOMEBRIDGE_SYNOLOGY_PACKAGE === '1') || Boolean(node_process_1.default.env.HOMEBRIDGE_APT_PACKAGE === '1')));
245
- node_process_1.default.env.UIX_STORAGE_PATH = this.storagePath;
246
- node_process_1.default.env.UIX_CONFIG_PATH = (0, node_path_1.resolve)(this.storagePath, 'config.json');
247
- node_process_1.default.env.UIX_BASE_PATH = node_process_1.default.env.UIX_BASE_PATH_OVERRIDE || (0, node_path_1.resolve)(__dirname, '../../');
248
- node_process_1.default.env.UIX_SERVICE_MODE = '1';
249
- node_process_1.default.env.UIX_INSECURE_MODE = '1';
225
+ this.enableHbServicePluginManagement = (process.env.UIX_CUSTOM_PLUGIN_PATH
226
+ && (Boolean(process.env.HOMEBRIDGE_SYNOLOGY_PACKAGE === '1') || Boolean(process.env.HOMEBRIDGE_APT_PACKAGE === '1')));
227
+ process.env.UIX_STORAGE_PATH = this.storagePath;
228
+ process.env.UIX_CONFIG_PATH = resolve(this.storagePath, 'config.json');
229
+ process.env.UIX_BASE_PATH = process.env.UIX_BASE_PATH_OVERRIDE || resolve(__dirname, '../../');
230
+ process.env.UIX_SERVICE_MODE = '1';
231
+ process.env.UIX_INSECURE_MODE = '1';
250
232
  }
251
233
  showVersion() {
252
- const pjson = (0, fs_extra_1.readJsonSync)((0, node_path_1.resolve)(__dirname, '../../', 'package.json'));
234
+ const pjson = readJsonSync(resolve(__dirname, '../../', 'package.json'));
253
235
  console.log(`v${pjson.version}`);
254
- node_process_1.default.exit(0);
236
+ process.exit(0);
255
237
  }
256
238
  async startLog() {
257
239
  if (this.stdout === true) {
258
- this.log = node_process_1.default.stdout;
240
+ this.log = process.stdout;
259
241
  return;
260
242
  }
261
243
  this.logger(`Logging to ${this.logPath}.`);
262
- this.log = (0, fs_extra_1.createWriteStream)(this.logPath, { flags: 'a' });
263
- node_process_1.default.stdout.write = node_process_1.default.stderr.write = this.log.write.bind(this.log);
244
+ this.log = createWriteStream(this.logPath, { flags: 'a' });
245
+ process.stdout.write = process.stderr.write = this.log.write.bind(this.log);
264
246
  }
265
247
  async readConfig() {
266
- return (0, fs_extra_1.readJson)(node_process_1.default.env.UIX_CONFIG_PATH);
248
+ return readJson(process.env.UIX_CONFIG_PATH);
267
249
  }
268
250
  async truncateLog() {
269
- if (!(await (0, fs_extra_1.pathExists)(this.logPath))) {
251
+ if (!(await pathExists(this.logPath))) {
270
252
  return;
271
253
  }
272
254
  try {
@@ -277,30 +259,30 @@ class HomebridgeServiceHelper {
277
259
  if (maxSize < 0) {
278
260
  return;
279
261
  }
280
- const logStats = await (0, fs_extra_1.stat)(this.logPath);
262
+ const logStats = await stat(this.logPath);
281
263
  if (logStats.size < maxSize) {
282
264
  return;
283
265
  }
284
266
  const logStartPosition = logStats.size - truncateSize;
285
- const logBuffer = node_buffer_1.Buffer.alloc(truncateSize);
286
- const logFileHandle = await (0, fs_extra_1.open)(this.logPath, 'a+');
287
- await (0, fs_extra_1.read)(logFileHandle, logBuffer, 0, truncateSize, logStartPosition);
288
- await (0, fs_extra_1.ftruncate)(logFileHandle);
289
- await (0, fs_extra_1.write)(logFileHandle, logBuffer);
290
- await (0, fs_extra_1.close)(logFileHandle);
267
+ const logBuffer = Buffer.alloc(truncateSize);
268
+ const logFileHandle = await open(this.logPath, 'a+');
269
+ await logFileHandle.read(logBuffer, 0, truncateSize, logStartPosition);
270
+ await logFileHandle.truncate();
271
+ await logFileHandle.write(logBuffer);
272
+ await logFileHandle.close();
291
273
  }
292
274
  catch (e) {
293
275
  this.logger(`Failed to truncate log file: ${e.message}.`, 'fail');
294
276
  }
295
277
  }
296
278
  async launch() {
297
- if ((0, node_os_1.platform)() !== 'win32' && node_process_1.default.getuid() === 0 && !this.allowRunRoot) {
279
+ if (platform() !== 'win32' && process.getuid() === 0 && !this.allowRunRoot) {
298
280
  this.logger('The hb-service run command should not be executed as root.');
299
281
  this.logger('Use the --allow-root flag to force the service to run as the root user.');
300
- node_process_1.default.exit(0);
282
+ process.exit(0);
301
283
  }
302
284
  this.logger(`Homebridge storage path: ${this.storagePath}.`);
303
- this.logger(`Homebridge config path: ${node_process_1.default.env.UIX_CONFIG_PATH}.`);
285
+ this.logger(`Homebridge config path: ${process.env.UIX_CONFIG_PATH}.`);
304
286
  setInterval(() => {
305
287
  this.truncateLog();
306
288
  }, (1000 * 60 * 60) * 2);
@@ -308,24 +290,24 @@ class HomebridgeServiceHelper {
308
290
  await this.storagePathCheck();
309
291
  await this.startLog();
310
292
  await this.configCheck();
311
- this.logger(`OS: ${(0, node_os_1.type)()} ${(0, node_os_1.release)()} ${(0, node_os_1.arch)()}.`);
312
- this.logger(`Node.js ${node_process_1.default.version} ${node_process_1.default.execPath}.`);
293
+ this.logger(`OS: ${type()} ${release()} ${arch()}.`);
294
+ this.logger(`Node.js ${process.version} ${process.execPath}.`);
313
295
  this.homebridgeBinary = await this.findHomebridgePath();
314
296
  this.logger(`Homebridge path: ${this.homebridgeBinary}.`);
315
297
  await this.loadHomebridgeStartupOptions();
316
- this.uiBinary = (0, node_path_1.resolve)(node_process_1.default.env.UIX_BASE_PATH, 'dist', 'bin', 'standalone.js');
298
+ this.uiBinary = resolve(process.env.UIX_BASE_PATH, 'dist', 'bin', 'standalone.js');
317
299
  this.logger(`UI path: ${this.uiBinary}.`);
318
300
  }
319
301
  catch (e) {
320
302
  this.logger(e.message);
321
- node_process_1.default.exit(1);
303
+ process.exit(1);
322
304
  }
323
305
  this.startExitHandler();
324
306
  await this.runUi();
325
307
  if (this.ipcService && this.homebridgePackage) {
326
308
  this.ipcService.setHomebridgeVersion(this.homebridgePackage.version);
327
309
  }
328
- if ((0, node_os_1.cpus)().length === 1 && (0, node_os_1.arch)() === 'arm') {
310
+ if (cpus().length === 1 && arch() === 'arm') {
329
311
  this.logger('Delaying Homebridge startup by 20 seconds on low powered server.');
330
312
  setTimeout(() => {
331
313
  this.runHomebridge();
@@ -347,19 +329,19 @@ class HomebridgeServiceHelper {
347
329
  this.homebridge.kill('SIGKILL');
348
330
  }
349
331
  catch (e) { }
350
- node_process_1.default.exit(1282);
332
+ process.exit(1282);
351
333
  }, 7000);
352
334
  };
353
- node_process_1.default.on('SIGTERM', exitHandler);
354
- node_process_1.default.on('SIGINT', exitHandler);
335
+ process.on('SIGTERM', exitHandler);
336
+ process.on('SIGINT', exitHandler);
355
337
  }
356
338
  runHomebridge() {
357
- if (!this.homebridgeBinary || !(0, fs_extra_1.pathExistsSync)(this.homebridgeBinary)) {
339
+ if (!this.homebridgeBinary || !pathExistsSync(this.homebridgeBinary)) {
358
340
  this.logger('Could not find Homebridge. Make sure you have installed Homebridge using the -g flag then restart.', 'fail');
359
341
  this.logger('npm install -g --unsafe-perm homebridge', 'fail');
360
342
  return;
361
343
  }
362
- if (node_process_1.default.env.UIX_STRICT_PLUGIN_RESOLUTION === '1') {
344
+ if (process.env.UIX_STRICT_PLUGIN_RESOLUTION === '1') {
363
345
  if (!this.homebridgeOpts.includes('--strict-plugin-resolution')) {
364
346
  this.homebridgeOpts.push('--strict-plugin-resolution');
365
347
  }
@@ -371,7 +353,7 @@ class HomebridgeServiceHelper {
371
353
  this.logger(`Starting Homebridge with custom env: ${JSON.stringify(this.homebridgeCustomEnv)}.`);
372
354
  }
373
355
  const env = {};
374
- Object.assign(env, node_process_1.default.env);
356
+ Object.assign(env, process.env);
375
357
  Object.assign(env, this.homebridgeCustomEnv);
376
358
  const childProcessOpts = {
377
359
  env,
@@ -384,7 +366,7 @@ class HomebridgeServiceHelper {
384
366
  if (this.docker) {
385
367
  this.fixDockerPermissions();
386
368
  }
387
- this.homebridge = (0, node_child_process_1.fork)(this.homebridgeBinary, [
369
+ this.homebridge = fork(this.homebridgeBinary, [
388
370
  '-C',
389
371
  '-Q',
390
372
  '-U',
@@ -417,7 +399,7 @@ class HomebridgeServiceHelper {
417
399
  }
418
400
  async runUi() {
419
401
  try {
420
- const main = await Promise.resolve().then(() => __importStar(require('../main')));
402
+ const main = await import('../main.js');
421
403
  const ui = await main.app;
422
404
  this.ipcService = ui.get(main.HomebridgeIpcService);
423
405
  }
@@ -425,7 +407,7 @@ class HomebridgeServiceHelper {
425
407
  this.logger('The user interface threw an unhandled error.');
426
408
  console.error(e);
427
409
  setTimeout(() => {
428
- node_process_1.default.exit(1);
410
+ process.exit(1);
429
411
  }, 4500);
430
412
  if (this.homebridge) {
431
413
  this.homebridge.kill();
@@ -434,38 +416,38 @@ class HomebridgeServiceHelper {
434
416
  }
435
417
  async getNpmGlobalModulesDirectory() {
436
418
  try {
437
- const npmPrefix = (0, node_child_process_1.execSync)('npm -g prefix', {
419
+ const npmPrefix = execSync('npm -g prefix', {
438
420
  env: Object.assign({
439
421
  npm_config_loglevel: 'silent',
440
422
  npm_update_notifier: 'false',
441
- }, node_process_1.default.env),
423
+ }, process.env),
442
424
  }).toString('utf8').trim();
443
- return (0, node_os_1.platform)() === 'win32' ? (0, node_path_1.join)(npmPrefix, 'node_modules') : (0, node_path_1.join)(npmPrefix, 'lib', 'node_modules');
425
+ return platform() === 'win32' ? join(npmPrefix, 'node_modules') : join(npmPrefix, 'lib', 'node_modules');
444
426
  }
445
427
  catch (e) {
446
428
  return null;
447
429
  }
448
430
  }
449
431
  async findHomebridgePath() {
450
- const nodeModules = (0, node_path_1.resolve)(node_process_1.default.env.UIX_BASE_PATH, '..');
451
- if (await (0, fs_extra_1.pathExists)((0, node_path_1.resolve)(nodeModules, 'homebridge', 'package.json'))) {
452
- this.homebridgeModulePath = (0, node_path_1.resolve)(nodeModules, 'homebridge');
432
+ const nodeModules = resolve(process.env.UIX_BASE_PATH, '..');
433
+ if (await pathExists(resolve(nodeModules, 'homebridge', 'package.json'))) {
434
+ this.homebridgeModulePath = resolve(nodeModules, 'homebridge');
453
435
  }
454
- if (!this.homebridgeModulePath && !(node_process_1.default.env.UIX_STRICT_PLUGIN_RESOLUTION === '1' && node_process_1.default.env.UIX_CUSTOM_PLUGIN_PATH)) {
436
+ if (!this.homebridgeModulePath && !(process.env.UIX_STRICT_PLUGIN_RESOLUTION === '1' && process.env.UIX_CUSTOM_PLUGIN_PATH)) {
455
437
  const globalModules = await this.getNpmGlobalModulesDirectory();
456
- if (globalModules && await (0, fs_extra_1.pathExists)((0, node_path_1.resolve)(globalModules, 'homebridge'))) {
457
- this.homebridgeModulePath = (0, node_path_1.resolve)(globalModules, 'homebridge');
438
+ if (globalModules && await pathExists(resolve(globalModules, 'homebridge'))) {
439
+ this.homebridgeModulePath = resolve(globalModules, 'homebridge');
458
440
  }
459
441
  }
460
- if (!this.homebridgeModulePath && node_process_1.default.env.UIX_CUSTOM_PLUGIN_PATH) {
461
- if (await (0, fs_extra_1.pathExists)((0, node_path_1.resolve)(node_process_1.default.env.UIX_CUSTOM_PLUGIN_PATH, 'homebridge', 'package.json'))) {
462
- this.homebridgeModulePath = (0, node_path_1.resolve)(node_process_1.default.env.UIX_CUSTOM_PLUGIN_PATH, 'homebridge');
442
+ if (!this.homebridgeModulePath && process.env.UIX_CUSTOM_PLUGIN_PATH) {
443
+ if (await pathExists(resolve(process.env.UIX_CUSTOM_PLUGIN_PATH, 'homebridge', 'package.json'))) {
444
+ this.homebridgeModulePath = resolve(process.env.UIX_CUSTOM_PLUGIN_PATH, 'homebridge');
463
445
  }
464
446
  }
465
447
  if (this.homebridgeModulePath) {
466
448
  try {
467
449
  await this.refreshHomebridgePackage();
468
- return (0, node_path_1.resolve)(this.homebridgeModulePath, this.homebridgePackage.bin.homebridge);
450
+ return resolve(this.homebridgeModulePath, this.homebridgePackage.bin.homebridge);
469
451
  }
470
452
  catch (e) {
471
453
  console.log(e);
@@ -475,8 +457,8 @@ class HomebridgeServiceHelper {
475
457
  }
476
458
  async refreshHomebridgePackage() {
477
459
  try {
478
- if (await (0, fs_extra_1.pathExists)(this.homebridgeModulePath)) {
479
- this.homebridgePackage = await (0, fs_extra_1.readJson)((0, node_path_1.join)(this.homebridgeModulePath, 'package.json'));
460
+ if (await pathExists(this.homebridgeModulePath)) {
461
+ this.homebridgePackage = await readJson(join(this.homebridgeModulePath, 'package.json'));
480
462
  }
481
463
  else {
482
464
  this.logger(`Homebridge not longer found at ${this.homebridgeModulePath}.`, 'fail');
@@ -490,13 +472,13 @@ class HomebridgeServiceHelper {
490
472
  }
491
473
  }
492
474
  nodeVersionCheck() {
493
- if (Number.parseInt(node_process_1.default.versions.modules, 10) < 64) {
494
- this.logger(`Node.js v10.13.0 or greater is required, current: ${node_process_1.default.version}.`, 'fail');
495
- node_process_1.default.exit(1);
475
+ if (Number.parseInt(process.versions.modules, 10) < 64) {
476
+ this.logger(`Node.js v10.13.0 or greater is required, current: ${process.version}.`, 'fail');
477
+ process.exit(1);
496
478
  }
497
479
  }
498
480
  nvmCheck() {
499
- if (node_process_1.default.execPath.includes('nvm') && (0, node_os_1.platform)() === 'linux') {
481
+ if (process.execPath.includes('nvm') && platform() === 'linux') {
500
482
  this.logger('WARNING: It looks like you are running Node.js via NVM (Node Version Manager).\n'
501
483
  + ' Using hb-service with NVM may not work unless you have configured NVM for the\n'
502
484
  + ' user this service will run as. See https://homebridge.io/w/JUZ2g for instructions on how\n'
@@ -504,8 +486,8 @@ class HomebridgeServiceHelper {
504
486
  }
505
487
  }
506
488
  async printPostInstallInstructions() {
507
- const defaultAdapter = await (0, systeminformation_1.networkInterfaceDefault)();
508
- const defaultInterface = (await (0, systeminformation_1.networkInterfaces)()).find((x) => x.iface === defaultAdapter);
489
+ const defaultAdapter = await networkInterfaceDefault();
490
+ const defaultInterface = (await networkInterfaces()).find((x) => x.iface === defaultAdapter);
509
491
  console.log('\nManage Homebridge by going to one of the following in your browser:\n');
510
492
  console.log(`* http://localhost:${this.uiPort}`);
511
493
  if (defaultInterface && defaultInterface.ip4) {
@@ -518,30 +500,30 @@ class HomebridgeServiceHelper {
518
500
  this.logger('Homebridge setup complete.', 'succeed');
519
501
  }
520
502
  async portCheck() {
521
- const inUse = await (0, tcp_port_used_1.check)(this.uiPort);
503
+ const inUse = await tcpCheck(this.uiPort);
522
504
  if (inUse) {
523
505
  this.logger(`Port ${this.uiPort} is already in use by another process on this host.`, 'fail');
524
506
  this.logger('You can specify another port using the --port flag, e.g.:', 'fail');
525
507
  this.logger(`hb-service ${this.action} --port 8581`, 'fail');
526
- node_process_1.default.exit(1);
508
+ process.exit(1);
527
509
  }
528
510
  }
529
511
  async storagePathCheck() {
530
- if ((0, node_os_1.platform)() === 'darwin' && !await (0, fs_extra_1.pathExists)((0, node_path_1.dirname)(this.storagePath))) {
531
- this.logger(`Cannot create Homebridge storage directory, base path does not exist: ${(0, node_path_1.dirname)(this.storagePath)}.`, 'fail');
532
- node_process_1.default.exit(1);
512
+ if (platform() === 'darwin' && !await pathExists(dirname(this.storagePath))) {
513
+ this.logger(`Cannot create Homebridge storage directory, base path does not exist: ${dirname(this.storagePath)}.`, 'fail');
514
+ process.exit(1);
533
515
  }
534
- if (!await (0, fs_extra_1.pathExists)(this.storagePath)) {
516
+ if (!await pathExists(this.storagePath)) {
535
517
  this.logger(`Creating Homebridge directory: ${this.storagePath}.`);
536
- await (0, fs_extra_1.mkdirp)(this.storagePath);
518
+ await mkdirp(this.storagePath);
537
519
  await this.chownPath(this.storagePath);
538
520
  }
539
521
  }
540
522
  async configCheck() {
541
523
  let saveRequired = false;
542
524
  let restartRequired = false;
543
- if (!await (0, fs_extra_1.pathExists)(node_process_1.default.env.UIX_CONFIG_PATH)) {
544
- this.logger(`Creating default config.json: ${node_process_1.default.env.UIX_CONFIG_PATH}.`);
525
+ if (!await pathExists(process.env.UIX_CONFIG_PATH)) {
526
+ this.logger(`Creating default config.json: ${process.env.UIX_CONFIG_PATH}.`);
545
527
  await this.createDefaultConfig();
546
528
  restartRequired = true;
547
529
  }
@@ -552,7 +534,7 @@ class HomebridgeServiceHelper {
552
534
  }
553
535
  let uiConfigBlock = currentConfig.platforms.find((x) => x.platform === 'config');
554
536
  if (!uiConfigBlock) {
555
- this.logger(`Adding missing UI platform block to ${node_process_1.default.env.UIX_CONFIG_PATH}.`, 'info');
537
+ this.logger(`Adding missing UI platform block to ${process.env.UIX_CONFIG_PATH}.`, 'info');
556
538
  uiConfigBlock = await this.createDefaultUiConfig();
557
539
  currentConfig.platforms.push(uiConfigBlock);
558
540
  saveRequired = true;
@@ -567,7 +549,7 @@ class HomebridgeServiceHelper {
567
549
  if (this.action === 'install') {
568
550
  if (uiConfigBlock.port !== this.uiPort) {
569
551
  uiConfigBlock.port = this.uiPort;
570
- this.logger(`Homebridge UI port in ${node_process_1.default.env.UIX_CONFIG_PATH} changed to: ${this.uiPort}.`, 'warn');
552
+ this.logger(`Homebridge UI port in ${process.env.UIX_CONFIG_PATH} changed to: ${this.uiPort}.`, 'warn');
571
553
  }
572
554
  delete uiConfigBlock.restart;
573
555
  delete uiConfigBlock.sudo;
@@ -603,31 +585,31 @@ class HomebridgeServiceHelper {
603
585
  }
604
586
  }
605
587
  if (saveRequired) {
606
- await (0, fs_extra_1.writeJson)(node_process_1.default.env.UIX_CONFIG_PATH, currentConfig, { spaces: 4 });
588
+ await writeJson(process.env.UIX_CONFIG_PATH, currentConfig, { spaces: 4 });
607
589
  }
608
590
  }
609
591
  catch (e) {
610
- const backupFile = (0, node_path_1.resolve)(this.storagePath, `config.json.invalid.${new Date().getTime().toString()}`);
611
- this.logger(`${node_process_1.default.env.UIX_CONFIG_PATH} does not contain valid JSON.`, 'warn');
592
+ const backupFile = resolve(this.storagePath, `config.json.invalid.${new Date().getTime().toString()}`);
593
+ this.logger(`${process.env.UIX_CONFIG_PATH} does not contain valid JSON.`, 'warn');
612
594
  this.logger(`Invalid config.json file has been backed up to ${backupFile}.`, 'warn');
613
- await (0, fs_extra_1.rename)(node_process_1.default.env.UIX_CONFIG_PATH, backupFile);
595
+ await rename(process.env.UIX_CONFIG_PATH, backupFile);
614
596
  await this.createDefaultConfig();
615
597
  restartRequired = true;
616
598
  }
617
599
  if (restartRequired && this.action === 'run' && await this.isRaspbianImage()) {
618
600
  this.logger('Restarting process after port number update.', 'info');
619
- node_process_1.default.exit(1);
601
+ process.exit(1);
620
602
  }
621
603
  }
622
604
  async createDefaultConfig() {
623
- await (0, fs_extra_1.writeJson)(node_process_1.default.env.UIX_CONFIG_PATH, {
605
+ await writeJson(process.env.UIX_CONFIG_PATH, {
624
606
  bridge: await this.generateBridgeConfig(),
625
607
  accessories: [],
626
608
  platforms: [
627
609
  await this.createDefaultUiConfig(),
628
610
  ],
629
611
  }, { spaces: 4 });
630
- await this.chownPath(node_process_1.default.env.UIX_CONFIG_PATH);
612
+ await this.chownPath(process.env.UIX_CONFIG_PATH);
631
613
  }
632
614
  async generateBridgeConfig() {
633
615
  const username = this.generateUsername();
@@ -651,16 +633,16 @@ class HomebridgeServiceHelper {
651
633
  };
652
634
  }
653
635
  async isRaspbianImage() {
654
- return (0, node_os_1.platform)() === 'linux' && await (0, fs_extra_1.pathExists)('/etc/hb-ui-port');
636
+ return platform() === 'linux' && await pathExists('/etc/hb-ui-port');
655
637
  }
656
638
  async getLastKnownUiPort() {
657
639
  if (await this.isRaspbianImage()) {
658
- const lastPort = Number.parseInt((await (0, fs_extra_1.readFile)('/etc/hb-ui-port', 'utf8')), 10);
640
+ const lastPort = Number.parseInt((await readFile('/etc/hb-ui-port', 'utf8')), 10);
659
641
  if (!Number.isNaN(lastPort) && lastPort <= 65535) {
660
642
  return lastPort;
661
643
  }
662
644
  }
663
- const envPort = Number.parseInt(node_process_1.default.env.HOMEBRIDGE_CONFIG_UI_PORT, 10);
645
+ const envPort = Number.parseInt(process.env.HOMEBRIDGE_CONFIG_UI_PORT, 10);
664
646
  if (!Number.isNaN(envPort) && envPort <= 65535) {
665
647
  return envPort;
666
648
  }
@@ -689,25 +671,25 @@ class HomebridgeServiceHelper {
689
671
  async generatePort() {
690
672
  const randomPort = () => Math.floor(Math.random() * (52000 - 51000 + 1) + 51000);
691
673
  let port = randomPort();
692
- while (await (0, tcp_port_used_1.check)(port)) {
674
+ while (await tcpCheck(port)) {
693
675
  port = randomPort();
694
676
  }
695
677
  return port;
696
678
  }
697
679
  async isAvahiDaemonRunning() {
698
- if ((0, node_os_1.platform)() !== 'linux') {
680
+ if (platform() !== 'linux') {
699
681
  return false;
700
682
  }
701
- if (!await (0, fs_extra_1.pathExists)('/etc/avahi/avahi-daemon.conf') || !await (0, fs_extra_1.pathExists)('/usr/bin/systemctl')) {
683
+ if (!await pathExists('/etc/avahi/avahi-daemon.conf') || !await pathExists('/usr/bin/systemctl')) {
702
684
  return false;
703
685
  }
704
686
  try {
705
- if (await (0, fs_extra_1.pathExists)('/usr/lib/systemd/system/avahi.service')) {
706
- (0, node_child_process_1.execSync)('systemctl is-active --quiet avahi 2> /dev/null');
687
+ if (await pathExists('/usr/lib/systemd/system/avahi.service')) {
688
+ execSync('systemctl is-active --quiet avahi 2> /dev/null');
707
689
  return true;
708
690
  }
709
- else if (await (0, fs_extra_1.pathExists)('/lib/systemd/system/avahi-daemon.service')) {
710
- (0, node_child_process_1.execSync)('systemctl is-active --quiet avahi-daemon 2> /dev/null');
691
+ else if (await pathExists('/lib/systemd/system/avahi-daemon.service')) {
692
+ execSync('systemctl is-active --quiet avahi-daemon 2> /dev/null');
711
693
  return true;
712
694
  }
713
695
  else {
@@ -719,13 +701,13 @@ class HomebridgeServiceHelper {
719
701
  }
720
702
  }
721
703
  async chownPath(pathToChown) {
722
- if ((0, node_os_1.platform)() !== 'win32' && node_process_1.default.getuid() === 0) {
704
+ if (platform() !== 'win32' && process.getuid() === 0) {
723
705
  const { uid, gid } = await this.installer.getId();
724
- (0, fs_extra_1.chownSync)(pathToChown, uid, gid);
706
+ chownSync(pathToChown, uid, gid);
725
707
  }
726
708
  }
727
709
  async checkForStaleHomebridgeProcess() {
728
- if ((0, node_os_1.platform)() === 'win32') {
710
+ if (platform() === 'win32') {
729
711
  return;
730
712
  }
731
713
  try {
@@ -733,7 +715,7 @@ class HomebridgeServiceHelper {
733
715
  if (!currentConfig.bridge || !currentConfig.bridge.port) {
734
716
  return;
735
717
  }
736
- if (!await (0, tcp_port_used_1.check)(Number.parseInt(currentConfig.bridge.port.toString(), 10))) {
718
+ if (!await tcpCheck(Number.parseInt(currentConfig.bridge.port.toString(), 10))) {
737
719
  return;
738
720
  }
739
721
  const pid = Number.parseInt(this.installer.getPidOfPort(Number.parseInt(currentConfig.bridge.port.toString(), 10)), 10);
@@ -741,26 +723,26 @@ class HomebridgeServiceHelper {
741
723
  return;
742
724
  }
743
725
  this.logger(`Found stale Homebridge process running on port: ${currentConfig.bridge.port}, with PID: ${pid}, killing...`);
744
- node_process_1.default.kill(pid, 'SIGKILL');
726
+ process.kill(pid, 'SIGKILL');
745
727
  }
746
728
  catch (e) {
747
729
  }
748
730
  }
749
731
  async tailLogs() {
750
- if (!(0, fs_extra_1.existsSync)(this.logPath)) {
732
+ if (!existsSync(this.logPath)) {
751
733
  this.logger(`Log file does not exist at expected location: ${this.logPath}.`, 'fail');
752
- node_process_1.default.exit(1);
734
+ process.exit(1);
753
735
  }
754
- const logStats = await (0, fs_extra_1.stat)(this.logPath);
736
+ const logStats = await stat(this.logPath);
755
737
  const logStartPosition = logStats.size <= 200000 ? 0 : logStats.size - 200000;
756
- const logStream = (0, fs_extra_1.createReadStream)(this.logPath, { start: logStartPosition });
738
+ const logStream = createReadStream(this.logPath, { start: logStartPosition });
757
739
  logStream.on('data', (buffer) => {
758
- node_process_1.default.stdout.write(buffer);
740
+ process.stdout.write(buffer);
759
741
  });
760
742
  logStream.on('end', () => {
761
743
  logStream.close();
762
744
  });
763
- const tail = new tail_1.Tail(this.logPath, {
745
+ const tail = new Tail(this.logPath, {
764
746
  fromBeginning: false,
765
747
  useWatchFile: true,
766
748
  fsWatchOptions: {
@@ -771,20 +753,20 @@ class HomebridgeServiceHelper {
771
753
  }
772
754
  async viewLogs() {
773
755
  this.installer.viewLogs();
774
- if (!(0, fs_extra_1.existsSync)(this.logPath)) {
756
+ if (!existsSync(this.logPath)) {
775
757
  this.logger(`Log file does not exist at expected location: ${this.logPath}.`, 'fail');
776
- node_process_1.default.exit(1);
758
+ process.exit(1);
777
759
  }
778
- const logStats = await (0, fs_extra_1.stat)(this.logPath);
760
+ const logStats = await stat(this.logPath);
779
761
  const logStartPosition = logStats.size <= 200000 ? 0 : logStats.size - 200000;
780
- const logStream = (0, fs_extra_1.createReadStream)(this.logPath, { start: logStartPosition });
762
+ const logStream = createReadStream(this.logPath, { start: logStartPosition });
781
763
  logStream.on('data', (buffer) => {
782
- node_process_1.default.stdout.write(buffer);
764
+ process.stdout.write(buffer);
783
765
  });
784
766
  logStream.on('end', () => {
785
767
  logStream.close();
786
768
  });
787
- const tail = new tail_1.Tail(this.logPath, {
769
+ const tail = new Tail(this.logPath, {
788
770
  fromBeginning: false,
789
771
  useWatchFile: true,
790
772
  fsWatchOptions: {
@@ -797,12 +779,12 @@ class HomebridgeServiceHelper {
797
779
  }, 30000);
798
780
  }
799
781
  get homebridgeStartupOptionsPath() {
800
- return (0, node_path_1.resolve)(this.storagePath, '.uix-hb-service-homebridge-startup.json');
782
+ return resolve(this.storagePath, '.uix-hb-service-homebridge-startup.json');
801
783
  }
802
784
  async loadHomebridgeStartupOptions() {
803
785
  try {
804
- if (await (0, fs_extra_1.pathExists)(this.homebridgeStartupOptionsPath)) {
805
- const homebridgeStartupOptions = await (0, fs_extra_1.readJson)(this.homebridgeStartupOptionsPath);
786
+ if (await pathExists(this.homebridgeStartupOptionsPath)) {
787
+ const homebridgeStartupOptions = await readJson(this.homebridgeStartupOptionsPath);
806
788
  if (homebridgeStartupOptions.debugMode && !this.homebridgeOpts.includes('-D')) {
807
789
  this.homebridgeOpts.push('-D');
808
790
  }
@@ -811,17 +793,17 @@ class HomebridgeServiceHelper {
811
793
  }
812
794
  if (homebridgeStartupOptions.insecureMode === false && this.homebridgeOpts.includes('-I')) {
813
795
  this.homebridgeOpts.splice(this.homebridgeOpts.findIndex(x => x === '-I'), 1);
814
- node_process_1.default.env.UIX_INSECURE_MODE = '0';
796
+ process.env.UIX_INSECURE_MODE = '0';
815
797
  }
816
798
  Object.assign(this.homebridgeCustomEnv, homebridgeStartupOptions.env);
817
799
  }
818
800
  else if (this.docker) {
819
- if (node_process_1.default.env.HOMEBRIDGE_DEBUG === '1' && !this.homebridgeOpts.includes('-D')) {
801
+ if (process.env.HOMEBRIDGE_DEBUG === '1' && !this.homebridgeOpts.includes('-D')) {
820
802
  this.homebridgeOpts.push('-D');
821
803
  }
822
- if (node_process_1.default.env.HOMEBRIDGE_INSECURE !== '1' && this.homebridgeOpts.includes('-I')) {
804
+ if (process.env.HOMEBRIDGE_INSECURE !== '1' && this.homebridgeOpts.includes('-I')) {
823
805
  this.homebridgeOpts.splice(this.homebridgeOpts.findIndex(x => x === '-I'), 1);
824
- node_process_1.default.env.UIX_INSECURE_MODE = '0';
806
+ process.env.UIX_INSECURE_MODE = '0';
825
807
  }
826
808
  }
827
809
  }
@@ -831,13 +813,13 @@ class HomebridgeServiceHelper {
831
813
  }
832
814
  fixDockerPermissions() {
833
815
  try {
834
- (0, node_child_process_1.execSync)(`chown -R ${this.uid}:${this.gid} "${this.storagePath}"`);
816
+ execSync(`chown -R ${this.uid}:${this.gid} "${this.storagePath}"`);
835
817
  }
836
818
  catch (e) {
837
819
  }
838
820
  }
839
821
  async checkForNodejsUpdates(requestedVersion) {
840
- const versionList = (await axios_1.default.get('https://nodejs.org/dist/index.json')).data;
822
+ const versionList = (await axios.get('https://nodejs.org/dist/index.json')).data;
841
823
  if (!Array.isArray(versionList)) {
842
824
  this.logger('Failed to check for Node.js updates.', 'fail');
843
825
  return { update: false };
@@ -846,14 +828,14 @@ class HomebridgeServiceHelper {
846
828
  if (requestedVersion) {
847
829
  const wantedVersion = versionList.find(x => x.version.startsWith(`v${requestedVersion}`));
848
830
  if (wantedVersion) {
849
- if (!(0, semver_1.gte)(wantedVersion.version, '20.19.0')) {
831
+ if (!gte(wantedVersion.version, '20.19.0')) {
850
832
  this.logger('Refusing to install Node.js version lower than v20.19.0.', 'fail');
851
833
  return { update: false };
852
834
  }
853
- this.logger(`Installing Node.js ${wantedVersion.version} over ${node_process_1.default.version}...`, 'info');
835
+ this.logger(`Installing Node.js ${wantedVersion.version} over ${process.version}...`, 'info');
854
836
  return this.installer.updateNodejs({
855
837
  target: wantedVersion.version,
856
- rebuild: wantedVersion.modules !== node_process_1.default.versions.modules,
838
+ rebuild: wantedVersion.modules !== process.versions.modules,
857
839
  });
858
840
  }
859
841
  else {
@@ -861,32 +843,32 @@ class HomebridgeServiceHelper {
861
843
  return { update: false };
862
844
  }
863
845
  }
864
- if ((0, semver_1.gt)(currentLts.version, node_process_1.default.version)) {
865
- this.logger(`Updating Node.js from ${node_process_1.default.version} to ${currentLts.version}...`, 'info');
846
+ if (gt(currentLts.version, process.version)) {
847
+ this.logger(`Updating Node.js from ${process.version} to ${currentLts.version}...`, 'info');
866
848
  return this.installer.updateNodejs({
867
849
  target: currentLts.version,
868
- rebuild: currentLts.modules !== node_process_1.default.versions.modules,
850
+ rebuild: currentLts.modules !== process.versions.modules,
869
851
  });
870
852
  }
871
- const currentMajor = (0, semver_1.parse)(node_process_1.default.version).major;
872
- const latestVersion = versionList.filter(x => (0, semver_1.parse)(x.version).major === currentMajor)[0];
873
- if ((0, semver_1.gt)(latestVersion.version, node_process_1.default.version)) {
874
- this.logger(`Updating Node.js from ${node_process_1.default.version} to ${latestVersion.version}...`, 'info');
853
+ const currentMajor = parse(process.version).major;
854
+ const latestVersion = versionList.filter(x => parse(x.version).major === currentMajor)[0];
855
+ if (gt(latestVersion.version, process.version)) {
856
+ this.logger(`Updating Node.js from ${process.version} to ${latestVersion.version}...`, 'info');
875
857
  return this.installer.updateNodejs({
876
858
  target: latestVersion.version,
877
- rebuild: latestVersion.modules !== node_process_1.default.versions.modules,
859
+ rebuild: latestVersion.modules !== process.versions.modules,
878
860
  });
879
861
  }
880
- this.logger(`Node.js ${node_process_1.default.version} already up-to-date.`);
862
+ this.logger(`Node.js ${process.version} already up-to-date.`);
881
863
  return { update: false };
882
864
  }
883
865
  async downloadNodejs(downloadUrl) {
884
- const spinner = (0, ora_1.default)(`Downloading ${downloadUrl}`).start();
866
+ const spinner = ora(`Downloading ${downloadUrl}`).start();
885
867
  try {
886
- const tempDir = await (0, fs_extra_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'node'));
887
- const tempFilePath = (0, node_path_1.join)(tempDir, 'node.tar.gz');
888
- const tempFile = (0, fs_extra_1.createWriteStream)(tempFilePath);
889
- await axios_1.default.get(downloadUrl, { responseType: 'stream' })
868
+ const tempDir = await mkdtemp(join(tmpdir(), 'node'));
869
+ const tempFilePath = join(tempDir, 'node.tar.gz');
870
+ const tempFile = createWriteStream(tempFilePath);
871
+ await axios.get(downloadUrl, { responseType: 'stream' })
890
872
  .then((response) => {
891
873
  return new Promise((res, rej) => {
892
874
  response.data.pipe(tempFile).on('finish', () => {
@@ -901,27 +883,27 @@ class HomebridgeServiceHelper {
901
883
  }
902
884
  catch (e) {
903
885
  spinner.fail(e.message);
904
- node_process_1.default.exit(1);
886
+ process.exit(1);
905
887
  }
906
888
  }
907
889
  async extractNodejs(targetVersion, extractConfig) {
908
- const spinner = (0, ora_1.default)(`Installing Node.js ${targetVersion}`).start();
890
+ const spinner = ora(`Installing Node.js ${targetVersion}`).start();
909
891
  try {
910
- await (0, tar_1.extract)(extractConfig);
892
+ await extract(extractConfig);
911
893
  spinner.succeed(`Installed Node.js ${targetVersion}`);
912
894
  }
913
895
  catch (e) {
914
896
  spinner.fail(e.message);
915
- node_process_1.default.exit(1);
897
+ process.exit(1);
916
898
  }
917
899
  }
918
900
  async removeNpmPackage(npmInstallPath) {
919
- if (!await (0, fs_extra_1.pathExists)(npmInstallPath)) {
901
+ if (!await pathExists(npmInstallPath)) {
920
902
  return;
921
903
  }
922
- const spinner = (0, ora_1.default)(`Cleaning up npm at ${npmInstallPath}...`).start();
904
+ const spinner = ora(`Cleaning up npm at ${npmInstallPath}...`).start();
923
905
  try {
924
- await (0, fs_extra_1.remove)(npmInstallPath);
906
+ await remove(npmInstallPath);
925
907
  spinner.succeed(`Cleaned up npm at ${npmInstallPath}`);
926
908
  }
927
909
  catch (e) {
@@ -931,18 +913,18 @@ class HomebridgeServiceHelper {
931
913
  async checkStatus() {
932
914
  this.logger(`Testing hb-service is running on port ${this.uiPort}...`);
933
915
  try {
934
- const res = await axios_1.default.get(`http://localhost:${this.uiPort}/api`);
916
+ const res = await axios.get(`http://localhost:${this.uiPort}/api`);
935
917
  if (res.data === 'Hello World!') {
936
918
  this.logger('Homebridge UI running.', 'succeed');
937
919
  }
938
920
  else {
939
921
  this.logger('Unexpected response.', 'fail');
940
- node_process_1.default.exit(1);
922
+ process.exit(1);
941
923
  }
942
924
  }
943
925
  catch (e) {
944
926
  this.logger('Homebridge UI not running.', 'fail');
945
- node_process_1.default.exit(1);
927
+ process.exit(1);
946
928
  }
947
929
  }
948
930
  parseNpmPackageString(input) {
@@ -951,7 +933,7 @@ class HomebridgeServiceHelper {
951
933
  const m = RE_SCOPED.exec(input) || RE_NON_SCOPED.exec(input);
952
934
  if (!m) {
953
935
  this.logger('Invalid plugin name.', 'fail');
954
- node_process_1.default.exit(1);
936
+ process.exit(1);
955
937
  }
956
938
  return {
957
939
  name: m[1] || '',
@@ -962,24 +944,24 @@ class HomebridgeServiceHelper {
962
944
  async npmPluginManagement(args) {
963
945
  if (!this.enableHbServicePluginManagement) {
964
946
  this.logger('Plugin management is not supported on your platform using hb-service.', 'fail');
965
- node_process_1.default.exit(1);
947
+ process.exit(1);
966
948
  }
967
949
  if (args.length === 1) {
968
950
  this.logger('Plugin name required.', 'fail');
969
- node_process_1.default.exit(1);
951
+ process.exit(1);
970
952
  }
971
953
  const action = args[0];
972
954
  const target = this.parseNpmPackageString(args[args.length - 1]);
973
955
  if (!target.name) {
974
956
  this.logger('Invalid plugin name.', 'fail');
975
- node_process_1.default.exit(1);
957
+ process.exit(1);
976
958
  }
977
959
  if (!target.name.match(/^(@[\w-]+(\.[\w-]+)*\/)?homebridge-[\w-]+$/)) {
978
960
  this.logger('Invalid plugin name.', 'fail');
979
- node_process_1.default.exit(1);
961
+ process.exit(1);
980
962
  }
981
- const cwd = (0, node_path_1.dirname)(node_process_1.default.env.UIX_CUSTOM_PLUGIN_PATH);
982
- if (!await (0, fs_extra_1.pathExists)(cwd)) {
963
+ const cwd = dirname(process.env.UIX_CUSTOM_PLUGIN_PATH);
964
+ if (!await pathExists(cwd)) {
983
965
  this.logger(`Path does not exist: ${cwd}.`, 'fail');
984
966
  }
985
967
  let cmd = `npm --prefix "${cwd}" ${action} ${target.name}`;
@@ -988,7 +970,7 @@ class HomebridgeServiceHelper {
988
970
  }
989
971
  this.logger(`CMD: ${cmd}`, 'info');
990
972
  try {
991
- (0, node_child_process_1.execSync)(cmd, {
973
+ execSync(cmd, {
992
974
  cwd,
993
975
  stdio: 'inherit',
994
976
  });
@@ -999,7 +981,6 @@ class HomebridgeServiceHelper {
999
981
  }
1000
982
  }
1001
983
  }
1002
- exports.HomebridgeServiceHelper = HomebridgeServiceHelper;
1003
984
  function bootstrap() {
1004
985
  return new HomebridgeServiceHelper();
1005
986
  }