homebridge-config-ui-x 5.9.1-beta.1 → 5.9.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/CHANGELOG.md +23 -3
  2. package/TODO-MATTER.md +15 -0
  3. package/dist/app.controller.d.ts +1 -1
  4. package/dist/app.controller.js +14 -12
  5. package/dist/app.controller.js.map +1 -1
  6. package/dist/app.gateway.js +7 -10
  7. package/dist/app.gateway.js.map +1 -1
  8. package/dist/app.module.js +42 -43
  9. package/dist/app.module.js.map +1 -1
  10. package/dist/app.service.js +4 -7
  11. package/dist/app.service.js.map +1 -1
  12. package/dist/bin/base-platform.d.ts +1 -1
  13. package/dist/bin/base-platform.js +11 -17
  14. package/dist/bin/base-platform.js.map +1 -1
  15. package/dist/bin/fork.js +7 -45
  16. package/dist/bin/fork.js.map +1 -1
  17. package/dist/bin/hb-service.js +224 -243
  18. package/dist/bin/hb-service.js.map +1 -1
  19. package/dist/bin/platforms/darwin.d.ts +1 -1
  20. package/dist/bin/platforms/darwin.js +61 -65
  21. package/dist/bin/platforms/darwin.js.map +1 -1
  22. package/dist/bin/platforms/freebsd.d.ts +1 -1
  23. package/dist/bin/platforms/freebsd.js +42 -47
  24. package/dist/bin/platforms/freebsd.js.map +1 -1
  25. package/dist/bin/platforms/linux.d.ts +1 -1
  26. package/dist/bin/platforms/linux.js +127 -132
  27. package/dist/bin/platforms/linux.js.map +1 -1
  28. package/dist/bin/platforms/win32.d.ts +1 -1
  29. package/dist/bin/platforms/win32.js +30 -36
  30. package/dist/bin/platforms/win32.js.map +1 -1
  31. package/dist/bin/standalone.js +15 -53
  32. package/dist/bin/standalone.js.map +1 -1
  33. package/dist/core/auth/auth.controller.d.ts +5 -4
  34. package/dist/core/auth/auth.controller.js +40 -39
  35. package/dist/core/auth/auth.controller.js.map +1 -1
  36. package/dist/core/auth/auth.dto.js +17 -18
  37. package/dist/core/auth/auth.dto.js.map +1 -1
  38. package/dist/core/auth/auth.module.js +28 -31
  39. package/dist/core/auth/auth.module.js.map +1 -1
  40. package/dist/core/auth/auth.service.d.ts +3 -3
  41. package/dist/core/auth/auth.service.js +65 -62
  42. package/dist/core/auth/auth.service.js.map +1 -1
  43. package/dist/core/auth/guards/admin.guard.js +4 -7
  44. package/dist/core/auth/guards/admin.guard.js.map +1 -1
  45. package/dist/core/auth/guards/custom.guard.js +6 -9
  46. package/dist/core/auth/guards/custom.guard.js.map +1 -1
  47. package/dist/core/auth/guards/ws-admin-guard.d.ts +2 -2
  48. package/dist/core/auth/guards/ws-admin-guard.js +13 -11
  49. package/dist/core/auth/guards/ws-admin-guard.js.map +1 -1
  50. package/dist/core/auth/guards/ws.guard.d.ts +2 -2
  51. package/dist/core/auth/guards/ws.guard.js +13 -11
  52. package/dist/core/auth/guards/ws.guard.js.map +1 -1
  53. package/dist/core/auth/jwt.strategy.d.ts +3 -2
  54. package/dist/core/auth/jwt.strategy.js +21 -16
  55. package/dist/core/auth/jwt.strategy.js.map +1 -1
  56. package/dist/core/config/config.interfaces.d.ts +8 -1
  57. package/dist/core/config/config.interfaces.js +1 -2
  58. package/dist/core/config/config.module.js +8 -10
  59. package/dist/core/config/config.module.js.map +1 -1
  60. package/dist/core/config/config.service.d.ts +4 -3
  61. package/dist/core/config/config.service.js +90 -83
  62. package/dist/core/config/config.service.js.map +1 -1
  63. package/dist/core/config/config.startup.d.ts +1 -1
  64. package/dist/core/config/config.startup.js +23 -28
  65. package/dist/core/config/config.startup.js.map +1 -1
  66. package/dist/core/feature-flags/feature-flags.registry.js +2 -5
  67. package/dist/core/feature-flags/feature-flags.registry.js.map +1 -1
  68. package/dist/core/homebridge-ipc/homebridge-ipc.module.js +11 -14
  69. package/dist/core/homebridge-ipc/homebridge-ipc.module.js.map +1 -1
  70. package/dist/core/homebridge-ipc/homebridge-ipc.service.d.ts +4 -4
  71. package/dist/core/homebridge-ipc/homebridge-ipc.service.js +25 -19
  72. package/dist/core/homebridge-ipc/homebridge-ipc.service.js.map +1 -1
  73. package/dist/core/logger/logger.module.js +8 -10
  74. package/dist/core/logger/logger.module.js.map +1 -1
  75. package/dist/core/logger/logger.service.js +13 -23
  76. package/dist/core/logger/logger.service.js.map +1 -1
  77. package/dist/core/node-pty/node-pty.module.js +7 -10
  78. package/dist/core/node-pty/node-pty.module.js.map +1 -1
  79. package/dist/core/node-pty/node-pty.service.js +6 -11
  80. package/dist/core/node-pty/node-pty.service.js.map +1 -1
  81. package/dist/core/node-version.constants.js +4 -11
  82. package/dist/core/node-version.constants.js.map +1 -1
  83. package/dist/core/scheduler/scheduler.module.js +15 -10
  84. package/dist/core/scheduler/scheduler.module.js.map +1 -1
  85. package/dist/core/scheduler/scheduler.service.d.ts +12 -1
  86. package/dist/core/scheduler/scheduler.service.js +101 -13
  87. package/dist/core/scheduler/scheduler.service.js.map +1 -1
  88. package/dist/core/spa/spa-html.service.js +9 -15
  89. package/dist/core/spa/spa-html.service.js.map +1 -1
  90. package/dist/core/spa/spa.filter.d.ts +1 -1
  91. package/dist/core/spa/spa.filter.js +11 -16
  92. package/dist/core/spa/spa.filter.js.map +1 -1
  93. package/dist/core/ssl/ssl-cert-generator.service.js +34 -36
  94. package/dist/core/ssl/ssl-cert-generator.service.js.map +1 -1
  95. package/dist/env-setup.d.ts +1 -0
  96. package/dist/env-setup.js +7 -0
  97. package/dist/env-setup.js.map +1 -0
  98. package/dist/globalDefaults.d.ts +1 -0
  99. package/dist/globalDefaults.js +1 -0
  100. package/dist/index.d.ts +1 -1
  101. package/dist/index.js +16 -19
  102. package/dist/index.js.map +1 -1
  103. package/dist/main.d.ts +5 -3
  104. package/dist/main.js +44 -51
  105. package/dist/main.js.map +1 -1
  106. package/dist/modules/accessories/accessories.controller.d.ts +3 -3
  107. package/dist/modules/accessories/accessories.controller.js +28 -29
  108. package/dist/modules/accessories/accessories.controller.js.map +1 -1
  109. package/dist/modules/accessories/accessories.dto.js +11 -13
  110. package/dist/modules/accessories/accessories.dto.js.map +1 -1
  111. package/dist/modules/accessories/accessories.gateway.d.ts +2 -2
  112. package/dist/modules/accessories/accessories.gateway.js +18 -16
  113. package/dist/modules/accessories/accessories.gateway.js.map +1 -1
  114. package/dist/modules/accessories/accessories.interfaces.d.ts +94 -0
  115. package/dist/modules/accessories/accessories.interfaces.js +2 -0
  116. package/dist/modules/accessories/accessories.interfaces.js.map +1 -0
  117. package/dist/modules/accessories/accessories.module.js +19 -20
  118. package/dist/modules/accessories/accessories.module.js.map +1 -1
  119. package/dist/modules/accessories/accessories.service.d.ts +23 -5
  120. package/dist/modules/accessories/accessories.service.js +316 -51
  121. package/dist/modules/accessories/accessories.service.js.map +1 -1
  122. package/dist/modules/backup/backup.controller.d.ts +4 -4
  123. package/dist/modules/backup/backup.controller.js +68 -67
  124. package/dist/modules/backup/backup.controller.js.map +1 -1
  125. package/dist/modules/backup/backup.gateway.d.ts +4 -4
  126. package/dist/modules/backup/backup.gateway.js +25 -21
  127. package/dist/modules/backup/backup.gateway.js.map +1 -1
  128. package/dist/modules/backup/backup.module.js +22 -25
  129. package/dist/modules/backup/backup.module.js.map +1 -1
  130. package/dist/modules/backup/backup.service.d.ts +5 -5
  131. package/dist/modules/backup/backup.service.js +143 -133
  132. package/dist/modules/backup/backup.service.js.map +1 -1
  133. package/dist/modules/child-bridges/child-bridges.gateway.d.ts +3 -3
  134. package/dist/modules/child-bridges/child-bridges.gateway.js +23 -21
  135. package/dist/modules/child-bridges/child-bridges.gateway.js.map +1 -1
  136. package/dist/modules/child-bridges/child-bridges.interfaces.js +1 -2
  137. package/dist/modules/child-bridges/child-bridges.module.js +19 -22
  138. package/dist/modules/child-bridges/child-bridges.module.js.map +1 -1
  139. package/dist/modules/child-bridges/child-bridges.service.d.ts +3 -3
  140. package/dist/modules/child-bridges/child-bridges.service.js +15 -11
  141. package/dist/modules/child-bridges/child-bridges.service.js.map +1 -1
  142. package/dist/modules/config-editor/config-editor.controller.d.ts +13 -11
  143. package/dist/modules/config-editor/config-editor.controller.js +168 -103
  144. package/dist/modules/config-editor/config-editor.controller.js.map +1 -1
  145. package/dist/modules/config-editor/config-editor.dto.d.ts +6 -0
  146. package/dist/modules/config-editor/config-editor.dto.js +40 -0
  147. package/dist/modules/config-editor/config-editor.dto.js.map +1 -0
  148. package/dist/modules/config-editor/config-editor.module.js +21 -24
  149. package/dist/modules/config-editor/config-editor.module.js.map +1 -1
  150. package/dist/modules/config-editor/config-editor.service.d.ts +11 -8
  151. package/dist/modules/config-editor/config-editor.service.js +123 -66
  152. package/dist/modules/config-editor/config-editor.service.js.map +1 -1
  153. package/dist/modules/custom-plugins/custom-plugins.module.js +10 -13
  154. package/dist/modules/custom-plugins/custom-plugins.module.js.map +1 -1
  155. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.d.ts +2 -2
  156. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.js +21 -19
  157. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.js.map +1 -1
  158. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.js +14 -17
  159. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.js.map +1 -1
  160. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.d.ts +2 -2
  161. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.js +18 -15
  162. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.js.map +1 -1
  163. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.d.ts +2 -2
  164. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.js +21 -19
  165. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.js.map +1 -1
  166. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.module.js +14 -17
  167. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.module.js.map +1 -1
  168. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.d.ts +2 -2
  169. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.js +18 -15
  170. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.js.map +1 -1
  171. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.d.ts +2 -2
  172. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js +18 -19
  173. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js.map +1 -1
  174. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.d.ts +2 -2
  175. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.js +15 -13
  176. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.js.map +1 -1
  177. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.module.js +18 -21
  178. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.module.js.map +1 -1
  179. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.d.ts +8 -8
  180. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js +47 -41
  181. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js.map +1 -1
  182. package/dist/modules/log/log.gateway.d.ts +3 -3
  183. package/dist/modules/log/log.gateway.js +15 -13
  184. package/dist/modules/log/log.gateway.js.map +1 -1
  185. package/dist/modules/log/log.interfaces.js +1 -2
  186. package/dist/modules/log/log.module.js +14 -17
  187. package/dist/modules/log/log.module.js.map +1 -1
  188. package/dist/modules/log/log.service.d.ts +5 -5
  189. package/dist/modules/log/log.service.js +47 -43
  190. package/dist/modules/log/log.service.js.map +1 -1
  191. package/dist/modules/platform-tools/docker/docker.controller.d.ts +1 -1
  192. package/dist/modules/platform-tools/docker/docker.controller.js +24 -25
  193. package/dist/modules/platform-tools/docker/docker.controller.js.map +1 -1
  194. package/dist/modules/platform-tools/docker/docker.module.js +14 -17
  195. package/dist/modules/platform-tools/docker/docker.module.js.map +1 -1
  196. package/dist/modules/platform-tools/docker/docker.service.d.ts +2 -2
  197. package/dist/modules/platform-tools/docker/docker.service.js +20 -16
  198. package/dist/modules/platform-tools/docker/docker.service.js.map +1 -1
  199. package/dist/modules/platform-tools/hb-service/hb-service.controller.d.ts +2 -2
  200. package/dist/modules/platform-tools/hb-service/hb-service.controller.js +35 -36
  201. package/dist/modules/platform-tools/hb-service/hb-service.controller.js.map +1 -1
  202. package/dist/modules/platform-tools/hb-service/hb-service.dto.js +20 -19
  203. package/dist/modules/platform-tools/hb-service/hb-service.dto.js.map +1 -1
  204. package/dist/modules/platform-tools/hb-service/hb-service.module.js +14 -17
  205. package/dist/modules/platform-tools/hb-service/hb-service.module.js.map +1 -1
  206. package/dist/modules/platform-tools/hb-service/hb-service.service.d.ts +3 -3
  207. package/dist/modules/platform-tools/hb-service/hb-service.service.js +37 -30
  208. package/dist/modules/platform-tools/hb-service/hb-service.service.js.map +1 -1
  209. package/dist/modules/platform-tools/linux/linux.controller.d.ts +1 -1
  210. package/dist/modules/platform-tools/linux/linux.controller.js +23 -21
  211. package/dist/modules/platform-tools/linux/linux.controller.js.map +1 -1
  212. package/dist/modules/platform-tools/linux/linux.module.js +14 -17
  213. package/dist/modules/platform-tools/linux/linux.module.js.map +1 -1
  214. package/dist/modules/platform-tools/linux/linux.service.d.ts +2 -2
  215. package/dist/modules/platform-tools/linux/linux.service.js +18 -14
  216. package/dist/modules/platform-tools/linux/linux.service.js.map +1 -1
  217. package/dist/modules/platform-tools/platform-tools.module.js +12 -15
  218. package/dist/modules/platform-tools/platform-tools.module.js.map +1 -1
  219. package/dist/modules/platform-tools/terminal/terminal.controller.d.ts +1 -1
  220. package/dist/modules/platform-tools/terminal/terminal.controller.js +15 -13
  221. package/dist/modules/platform-tools/terminal/terminal.controller.js.map +1 -1
  222. package/dist/modules/platform-tools/terminal/terminal.gateway.d.ts +2 -2
  223. package/dist/modules/platform-tools/terminal/terminal.gateway.js +17 -15
  224. package/dist/modules/platform-tools/terminal/terminal.gateway.js.map +1 -1
  225. package/dist/modules/platform-tools/terminal/terminal.interfaces.js +1 -2
  226. package/dist/modules/platform-tools/terminal/terminal.module.js +18 -21
  227. package/dist/modules/platform-tools/terminal/terminal.module.js.map +1 -1
  228. package/dist/modules/platform-tools/terminal/terminal.service.d.ts +7 -7
  229. package/dist/modules/platform-tools/terminal/terminal.service.js +33 -28
  230. package/dist/modules/platform-tools/terminal/terminal.service.js.map +1 -1
  231. package/dist/modules/plugins/plugins.controller.d.ts +12 -7
  232. package/dist/modules/plugins/plugins.controller.js +100 -52
  233. package/dist/modules/plugins/plugins.controller.js.map +1 -1
  234. package/dist/modules/plugins/plugins.dto.js +26 -24
  235. package/dist/modules/plugins/plugins.dto.js.map +1 -1
  236. package/dist/modules/plugins/plugins.gateway.d.ts +5 -5
  237. package/dist/modules/plugins/plugins.gateway.js +38 -34
  238. package/dist/modules/plugins/plugins.gateway.js.map +1 -1
  239. package/dist/modules/plugins/plugins.interfaces.js +1 -2
  240. package/dist/modules/plugins/plugins.module.js +27 -26
  241. package/dist/modules/plugins/plugins.module.js.map +1 -1
  242. package/dist/modules/plugins/plugins.service.d.ts +26 -13
  243. package/dist/modules/plugins/plugins.service.js +365 -203
  244. package/dist/modules/plugins/plugins.service.js.map +1 -1
  245. package/dist/modules/server/server.controller.d.ts +7 -7
  246. package/dist/modules/server/server.controller.js +208 -205
  247. package/dist/modules/server/server.controller.js.map +1 -1
  248. package/dist/modules/server/server.dto.js +13 -16
  249. package/dist/modules/server/server.dto.js.map +1 -1
  250. package/dist/modules/server/server.module.js +23 -26
  251. package/dist/modules/server/server.module.js.map +1 -1
  252. package/dist/modules/server/server.service.d.ts +6 -6
  253. package/dist/modules/server/server.service.js +202 -224
  254. package/dist/modules/server/server.service.js.map +1 -1
  255. package/dist/modules/setup-wizard/setup-wizard.controller.d.ts +3 -3
  256. package/dist/modules/setup-wizard/setup-wizard.controller.js +19 -20
  257. package/dist/modules/setup-wizard/setup-wizard.controller.js.map +1 -1
  258. package/dist/modules/setup-wizard/setup-wizard.gateway.d.ts +4 -4
  259. package/dist/modules/setup-wizard/setup-wizard.gateway.js +25 -21
  260. package/dist/modules/setup-wizard/setup-wizard.gateway.js.map +1 -1
  261. package/dist/modules/setup-wizard/setup-wizard.guard.d.ts +2 -2
  262. package/dist/modules/setup-wizard/setup-wizard.guard.js +11 -9
  263. package/dist/modules/setup-wizard/setup-wizard.guard.js.map +1 -1
  264. package/dist/modules/setup-wizard/setup-wizard.module.js +12 -15
  265. package/dist/modules/setup-wizard/setup-wizard.module.js.map +1 -1
  266. package/dist/modules/status/status.controller.d.ts +5 -5
  267. package/dist/modules/status/status.controller.js +40 -36
  268. package/dist/modules/status/status.controller.js.map +1 -1
  269. package/dist/modules/status/status.gateway.d.ts +11 -11
  270. package/dist/modules/status/status.gateway.js +51 -47
  271. package/dist/modules/status/status.gateway.js.map +1 -1
  272. package/dist/modules/status/status.interfaces.js +2 -5
  273. package/dist/modules/status/status.interfaces.js.map +1 -1
  274. package/dist/modules/status/status.module.js +26 -29
  275. package/dist/modules/status/status.module.js.map +1 -1
  276. package/dist/modules/status/status.service.d.ts +13 -13
  277. package/dist/modules/status/status.service.js +100 -88
  278. package/dist/modules/status/status.service.js.map +1 -1
  279. package/dist/modules/users/users.controller.d.ts +3 -3
  280. package/dist/modules/users/users.controller.js +59 -60
  281. package/dist/modules/users/users.controller.js.map +1 -1
  282. package/dist/modules/users/users.dto.js +51 -45
  283. package/dist/modules/users/users.dto.js.map +1 -1
  284. package/dist/modules/users/users.module.js +14 -17
  285. package/dist/modules/users/users.module.js.map +1 -1
  286. package/dist/self-check.js +25 -25
  287. package/dist/self-check.js.map +1 -1
  288. package/package.json +14 -12
  289. package/public/3rdpartylicenses.txt +26 -26
  290. package/public/{chunk-6KT3BYU6.js → chunk-2UCXG3TD.js} +1 -1
  291. package/public/{chunk-5T4JHJYL.js → chunk-2VYE34OE.js} +1 -1
  292. package/public/{chunk-TOYVIOBH.js → chunk-4AG5CIDJ.js} +1 -1
  293. package/public/{chunk-RMZRXORR.js → chunk-4H57TZAE.js} +1 -1
  294. package/public/{chunk-73TX7DHV.js → chunk-5CCE4FIL.js} +1 -1
  295. package/public/{chunk-2CNQY2E7.js → chunk-5RBSMCFS.js} +1 -1
  296. package/public/{chunk-LZOHFRHN.js → chunk-6O32KEYY.js} +1 -1
  297. package/public/{chunk-EAGKQ5OJ.js → chunk-7K67C3PU.js} +1 -1
  298. package/public/{chunk-732XLY23.js → chunk-7PEOCUE2.js} +3 -3
  299. package/public/{chunk-W3SNJ7TC.js → chunk-7RXQUWCY.js} +1 -1
  300. package/public/{chunk-EVND2DL5.js → chunk-7SZF43OV.js} +1 -1
  301. package/public/chunk-AEYQANK4.js +68 -0
  302. package/public/{chunk-2KEG7SYT.js → chunk-AU2Q4PYM.js} +1 -1
  303. package/public/chunk-AZIULTML.js +1 -0
  304. package/public/chunk-B63E4PTS.js +19 -0
  305. package/public/{chunk-X5AKILHJ.js → chunk-CT6TS63V.js} +1 -1
  306. package/public/{chunk-LWAL5JUG.js → chunk-DGS32J2V.js} +1 -1
  307. package/public/{chunk-D5RKKI2A.js → chunk-DWAKEAKY.js} +1 -1
  308. package/public/chunk-DZVJNQPQ.js +1 -0
  309. package/public/chunk-E26RJWMZ.js +4 -0
  310. package/public/{chunk-7UDDRMZZ.js → chunk-H22EEHWT.js} +1 -1
  311. package/public/{chunk-2FNQEOXF.js → chunk-HZFYCQBZ.js} +1 -1
  312. package/public/{chunk-OS2SEJZU.js → chunk-I24Z7SXB.js} +1 -1
  313. package/public/{chunk-7IYTG6GP.js → chunk-IA43FDJ7.js} +1 -1
  314. package/public/{chunk-WLGXJQPD.js → chunk-IHMVNP7Y.js} +1 -1
  315. package/public/{chunk-TSFGO3MA.js → chunk-IJNJ3FHH.js} +1 -1
  316. package/public/{chunk-ZJJ3EOBP.js → chunk-IM4LXJ36.js} +1 -1
  317. package/public/chunk-J4AYRIB4.js +1 -0
  318. package/public/{chunk-NKNWXFAK.js → chunk-JXJXX7ID.js} +1 -1
  319. package/public/chunk-K73OEMZP.js +1 -0
  320. package/public/chunk-KAZYWBPX.js +1 -0
  321. package/public/chunk-KGXF4YD5.js +1 -0
  322. package/public/chunk-KN2SQNGB.js +1 -0
  323. package/public/chunk-LN3BMCV4.js +1 -0
  324. package/public/{chunk-5ETJWAIW.js → chunk-LOQEG2RD.js} +1 -1
  325. package/public/chunk-M3HVG4RQ.js +1 -0
  326. package/public/{chunk-CYBDQV2B.js → chunk-MNT5ZGV3.js} +1 -1
  327. package/public/{chunk-UF2IM5BE.js → chunk-NTFDKV64.js} +1 -1
  328. package/public/chunk-PF7M52WR.js +1 -0
  329. package/public/chunk-PFWD43QS.js +2 -0
  330. package/public/{chunk-4QXLJX7D.js → chunk-PHND6FV5.js} +1 -1
  331. package/public/chunk-PSYU6RB3.js +1 -0
  332. package/public/{chunk-3E2NZ5JW.js → chunk-Q7T3F2Y7.js} +1 -1
  333. package/public/chunk-QKKTMQUU.js +1 -0
  334. package/public/chunk-QT6XPFQS.js +1 -0
  335. package/public/{chunk-3IZSIVEA.js → chunk-R2WI5YTX.js} +1 -1
  336. package/public/chunk-R44T3ZI7.js +50 -0
  337. package/public/{chunk-YNONXMOG.js → chunk-R6KWC4OQ.js} +1 -1
  338. package/public/{chunk-SY4VNLXW.js → chunk-RDOYYGV5.js} +1 -1
  339. package/public/chunk-RERUZJD4.js +5 -0
  340. package/public/chunk-S5IG2PNV.js +1 -0
  341. package/public/{chunk-AI6E5JVH.js → chunk-SVVZYE76.js} +1 -1
  342. package/public/{chunk-325LPX6W.js → chunk-T3SFHTRG.js} +1 -1
  343. package/public/{chunk-ADW6BF5G.js → chunk-TJ6P7UCH.js} +1 -1
  344. package/public/{chunk-ASKB5DLO.js → chunk-U3NNN7U4.js} +1 -1
  345. package/public/{chunk-BLT2YCDN.js → chunk-UBLR5WZR.js} +1 -1
  346. package/public/{chunk-YH6MRXGX.js → chunk-UZHUIPNT.js} +1 -1
  347. package/public/{chunk-BTBGWLKK.js → chunk-VNXIDOPC.js} +1 -1
  348. package/public/{chunk-WWSLIQVD.js → chunk-W6VJMRO6.js} +1 -1
  349. package/public/{chunk-3IJXQMYZ.js → chunk-WFVVY4KI.js} +1 -1
  350. package/public/{chunk-QK4V5DVW.js → chunk-WHSTHY5K.js} +1 -1
  351. package/public/chunk-XMBCOKOA.js +1 -0
  352. package/public/{chunk-OAHDGV32.js → chunk-XQACD65E.js} +1 -1
  353. package/public/{chunk-ZEI3HZ6P.js → chunk-XQCLQKCG.js} +2 -2
  354. package/public/{chunk-2UOYBCTN.js → chunk-XS55KH6X.js} +1 -1
  355. package/public/{chunk-VYC5JLE6.js → chunk-YFMEPI62.js} +1 -1
  356. package/public/chunk-Z4E6BJST.js +1 -0
  357. package/public/{chunk-OK5EJ7US.js → chunk-ZSWIXPXA.js} +1 -1
  358. package/public/index.html +2 -2
  359. package/public/{main-27RPBS22.js → main-WFXBCXTF.js} +1 -1
  360. package/public/{styles-CSF457UW.css → styles-WNHDEKE4.css} +1 -1
  361. package/scripts/extract-plugin-alias.js +8 -4
  362. package/public/chunk-2LXNPXT5.js +0 -1
  363. package/public/chunk-3XDYZNNE.js +0 -1
  364. package/public/chunk-57DUDNZJ.js +0 -1
  365. package/public/chunk-FM6ZYPKR.js +0 -4
  366. package/public/chunk-JJ7TVAIH.js +0 -5
  367. package/public/chunk-L43N56JA.js +0 -1
  368. package/public/chunk-L5I3DZ23.js +0 -1
  369. package/public/chunk-LH2LMHIZ.js +0 -1
  370. package/public/chunk-N2TWGDNX.js +0 -1
  371. package/public/chunk-O4SS7KVP.js +0 -40
  372. package/public/chunk-ONTEIYY3.js +0 -19
  373. package/public/chunk-P7TZIGJS.js +0 -50
  374. package/public/chunk-Q2IS3QQY.js +0 -1
  375. package/public/chunk-QQ5VZZQG.js +0 -1
  376. package/public/chunk-RYTGW6B7.js +0 -1
  377. package/public/chunk-SOT54YHI.js +0 -1
  378. package/public/chunk-TGZNYEGN.js +0 -1
  379. package/public/chunk-U5JF2ZOK.js +0 -1
  380. package/public/chunk-UNGEHXRN.js +0 -1
  381. package/public/chunk-VEGMNMLG.js +0 -1
  382. package/public/chunk-Y5FP6C55.js +0 -2
  383. package/public/chunk-YYJG2ENF.js +0 -1
@@ -1,113 +1,86 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
23
6
  };
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
7
  var __metadata = (this && this.__metadata) || function (k, v) {
42
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
9
  };
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
46
12
  };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.ServerService = void 0;
49
- const node_buffer_1 = require("node:buffer");
50
- const node_child_process_1 = require("node:child_process");
51
- const node_crypto_1 = require("node:crypto");
52
- const node_path_1 = require("node:path");
53
- const node_process_1 = __importDefault(require("node:process"));
54
- const node_stream_1 = require("node:stream");
55
- const node_tls_1 = require("node:tls");
56
- const node_util_1 = require("node:util");
57
- const hap_types_1 = require("@homebridge/hap-client/dist/hap-types");
58
- const common_1 = require("@nestjs/common");
59
- const fs_extra_1 = require("fs-extra");
60
- const node_cache_1 = __importDefault(require("node-cache"));
61
- const systeminformation_1 = require("systeminformation");
62
- const tcp_port_used_1 = require("tcp-port-used");
63
- const config_service_1 = require("../../core/config/config.service");
64
- const homebridge_ipc_service_1 = require("../../core/homebridge-ipc/homebridge-ipc.service");
65
- const logger_service_1 = require("../../core/logger/logger.service");
66
- const ssl_cert_generator_service_1 = require("../../core/ssl/ssl-cert-generator.service");
67
- const accessories_service_1 = require("../accessories/accessories.service");
68
- const config_editor_service_1 = require("../config-editor/config-editor.service");
69
- const pump = (0, node_util_1.promisify)(node_stream_1.pipeline);
13
+ import { Buffer } from 'node:buffer';
14
+ import { exec, spawn } from 'node:child_process';
15
+ import { createPrivateKey, createPublicKey, X509Certificate } from 'node:crypto';
16
+ import { createWriteStream } from 'node:fs';
17
+ import { readdir, unlink } from 'node:fs/promises';
18
+ import { extname, join, resolve } from 'node:path';
19
+ import process from 'node:process';
20
+ import { pipeline } from 'node:stream';
21
+ import { createSecureContext } from 'node:tls';
22
+ import { promisify } from 'node:util';
23
+ import { Categories } from '@homebridge/hap-client/dist/hap-types.js';
24
+ import { BadRequestException, Inject, Injectable, InternalServerErrorException, NotFoundException, ServiceUnavailableException, } from '@nestjs/common';
25
+ import { pathExists, readJson, remove, writeJson } from 'fs-extra/esm';
26
+ import NodeCache from 'node-cache';
27
+ import { networkInterfaces } from 'systeminformation';
28
+ import { check as tcpCheck } from 'tcp-port-used';
29
+ import { ConfigService } from '../../core/config/config.service.js';
30
+ import { HomebridgeIpcService } from '../../core/homebridge-ipc/homebridge-ipc.service.js';
31
+ import { Logger } from '../../core/logger/logger.service.js';
32
+ import { SslCertGeneratorService } from '../../core/ssl/ssl-cert-generator.service.js';
33
+ import { AccessoriesService } from '../accessories/accessories.service.js';
34
+ import { ConfigEditorService } from '../config-editor/config-editor.service.js';
35
+ const pump = promisify(pipeline);
70
36
  let ServerService = class ServerService {
37
+ configService;
38
+ configEditorService;
39
+ accessoriesService;
40
+ homebridgeIpcService;
41
+ logger;
42
+ serverServiceCache = new NodeCache({ stdTTL: 300 });
43
+ accessoryId;
44
+ accessoryInfoPath;
45
+ setupCode = null;
46
+ paired = false;
71
47
  constructor(configService, configEditorService, accessoriesService, homebridgeIpcService, logger) {
72
48
  this.configService = configService;
73
49
  this.configEditorService = configEditorService;
74
50
  this.accessoriesService = accessoriesService;
75
51
  this.homebridgeIpcService = homebridgeIpcService;
76
52
  this.logger = logger;
77
- this.serverServiceCache = new node_cache_1.default({ stdTTL: 300 });
78
- this.setupCode = null;
79
- this.paired = false;
80
53
  this.accessoryId = this.configService.homebridgeConfig.bridge.username.split(':').join('');
81
- this.accessoryInfoPath = (0, node_path_1.join)(this.configService.storagePath, 'persist', `AccessoryInfo.${this.accessoryId}.json`);
54
+ this.accessoryInfoPath = join(this.configService.storagePath, 'persist', `AccessoryInfo.${this.accessoryId}.json`);
82
55
  }
83
56
  async deleteSingleDeviceAccessories(id, cachedAccessoriesDir, protocol = 'both') {
84
57
  if (protocol === 'hap' || protocol === 'both') {
85
- const cachedAccessories = (0, node_path_1.join)(cachedAccessoriesDir, `cachedAccessories.${id}`);
86
- const cachedAccessoriesBackup = (0, node_path_1.join)(cachedAccessoriesDir, `.cachedAccessories.${id}.bak`);
87
- if (await (0, fs_extra_1.pathExists)(cachedAccessories)) {
88
- await (0, fs_extra_1.unlink)(cachedAccessories);
58
+ const cachedAccessories = join(cachedAccessoriesDir, `cachedAccessories.${id}`);
59
+ const cachedAccessoriesBackup = join(cachedAccessoriesDir, `.cachedAccessories.${id}.bak`);
60
+ if (await pathExists(cachedAccessories)) {
61
+ await unlink(cachedAccessories);
89
62
  this.logger.warn(`Bridge ${id} HAP accessory removal: removed ${cachedAccessories}.`);
90
63
  }
91
- if (await (0, fs_extra_1.pathExists)(cachedAccessoriesBackup)) {
92
- await (0, fs_extra_1.unlink)(cachedAccessoriesBackup);
64
+ if (await pathExists(cachedAccessoriesBackup)) {
65
+ await unlink(cachedAccessoriesBackup);
93
66
  this.logger.warn(`Bridge ${id} HAP accessory removal: removed ${cachedAccessoriesBackup}.`);
94
67
  }
95
68
  }
96
69
  if (protocol === 'matter' || protocol === 'both') {
97
70
  const deviceId = id.split(':').join('').toUpperCase();
98
- const matterPath = (0, node_path_1.join)(this.configService.storagePath, 'matter', deviceId);
99
- if (await (0, fs_extra_1.pathExists)(matterPath)) {
100
- await (0, fs_extra_1.remove)(matterPath);
71
+ const matterPath = join(this.configService.storagePath, 'matter', deviceId);
72
+ if (await pathExists(matterPath)) {
73
+ await remove(matterPath);
101
74
  this.logger.warn(`Bridge ${id} Matter accessory removal: removed Matter bridge storage at ${matterPath}.`);
102
75
  }
103
76
  }
104
77
  }
105
78
  async deleteSingleDevicePairing(id, resetPairingInfo) {
106
- const persistPath = (0, node_path_1.join)(this.configService.storagePath, 'persist');
107
- const accessoryInfo = (0, node_path_1.join)(persistPath, `AccessoryInfo.${id}.json`);
108
- const identifierCache = (0, node_path_1.join)(persistPath, `IdentifierCache.${id}.json`);
79
+ const persistPath = join(this.configService.storagePath, 'persist');
80
+ const accessoryInfo = join(persistPath, `AccessoryInfo.${id}.json`);
81
+ const identifierCache = join(persistPath, `IdentifierCache.${id}.json`);
109
82
  const deviceId = id.includes(':') ? id.split(':').join('').toUpperCase() : id.toUpperCase();
110
- const matterPath = (0, node_path_1.join)(this.configService.storagePath, 'matter', deviceId);
83
+ const matterPath = join(this.configService.storagePath, 'matter', deviceId);
111
84
  try {
112
85
  const configFile = await this.configEditorService.getConfigFile();
113
86
  const username = id.includes(':') ? id.toUpperCase() : id.match(/.{1,2}/g)?.join(':').toUpperCase() || id.toUpperCase();
@@ -152,16 +125,16 @@ let ServerService = class ServerService {
152
125
  catch (e) {
153
126
  this.logger.error(`Failed to reset username and pin for child bridge ${id} as ${e.message}.`);
154
127
  }
155
- if (await (0, fs_extra_1.pathExists)(accessoryInfo)) {
156
- await (0, fs_extra_1.unlink)(accessoryInfo);
128
+ if (await pathExists(accessoryInfo)) {
129
+ await unlink(accessoryInfo);
157
130
  this.logger.warn(`Bridge ${id} reset: removed ${accessoryInfo}.`);
158
131
  }
159
- if (await (0, fs_extra_1.pathExists)(identifierCache)) {
160
- await (0, fs_extra_1.unlink)(identifierCache);
132
+ if (await pathExists(identifierCache)) {
133
+ await unlink(identifierCache);
161
134
  this.logger.warn(`Bridge ${id} reset: removed ${identifierCache}.`);
162
135
  }
163
- if (await (0, fs_extra_1.pathExists)(matterPath)) {
164
- await (0, fs_extra_1.remove)(matterPath);
136
+ if (await pathExists(matterPath)) {
137
+ await remove(matterPath);
165
138
  this.logger.warn(`Bridge ${id} reset: removed Matter bridge storage at ${matterPath}.`);
166
139
  }
167
140
  await this.deleteDeviceAccessories(id);
@@ -177,7 +150,7 @@ let ServerService = class ServerService {
177
150
  setTimeout(() => {
178
151
  if (this.configService.ui.restart) {
179
152
  this.logger.log(`Executing restart command ${this.configService.ui.restart}.`);
180
- (0, node_child_process_1.exec)(this.configService.ui.restart, (err) => {
153
+ exec(this.configService.ui.restart, (err) => {
181
154
  if (err) {
182
155
  this.logger.log('Restart command exited with an error, failed to restart Homebridge.');
183
156
  }
@@ -185,7 +158,7 @@ let ServerService = class ServerService {
185
158
  }
186
159
  else {
187
160
  this.logger.log('Sending SIGTERM to process...');
188
- node_process_1.default.kill(node_process_1.default.pid, 'SIGTERM');
161
+ process.kill(process.pid, 'SIGTERM');
189
162
  }
190
163
  }, 500);
191
164
  return { ok: true, command: this.configService.ui.restart, restartingUI: true };
@@ -205,33 +178,33 @@ let ServerService = class ServerService {
205
178
  }
206
179
  this.logger.warn(`Homebridge bridge reset: new username ${configFile.bridge.username} and new pin ${configFile.bridge.pin}.`);
207
180
  await this.configEditorService.updateConfigFile(configFile);
208
- await (0, fs_extra_1.remove)((0, node_path_1.resolve)(this.configService.storagePath, 'accessories'));
209
- await (0, fs_extra_1.remove)((0, node_path_1.resolve)(this.configService.storagePath, 'persist'));
181
+ await remove(resolve(this.configService.storagePath, 'accessories'));
182
+ await remove(resolve(this.configService.storagePath, 'persist'));
210
183
  const deviceId = oldUsername.split(':').join('').toUpperCase();
211
- const matterPath = (0, node_path_1.join)(this.configService.storagePath, 'matter', deviceId);
212
- if (await (0, fs_extra_1.pathExists)(matterPath)) {
213
- await (0, fs_extra_1.remove)(matterPath);
184
+ const matterPath = join(this.configService.storagePath, 'matter', deviceId);
185
+ if (await pathExists(matterPath)) {
186
+ await remove(matterPath);
214
187
  this.logger.warn(`Bridge ${oldUsername} reset: removed Matter bridge storage at ${matterPath}.`);
215
188
  }
216
189
  this.logger.log('Homebridge bridge reset: accessories and persist directories were removed.');
217
190
  }
218
191
  async getDevicePairings() {
219
- const persistPath = (0, node_path_1.join)(this.configService.storagePath, 'persist');
220
- const devices = (await (0, fs_extra_1.readdir)(persistPath))
192
+ const persistPath = join(this.configService.storagePath, 'persist');
193
+ const devices = (await readdir(persistPath))
221
194
  .filter(x => x.match(/AccessoryInfo\.([A-Fa-f0-9]+)\.json$/));
222
195
  const configFile = await this.configEditorService.getConfigFile();
223
196
  const hapDevices = await Promise.all(devices.map(async (x) => {
224
197
  return await this.getDevicePairingById(x.split('.')[1], configFile);
225
198
  }));
226
- const matterExternalDevices = await this.getMatterExternalAccessories(configFile, hapDevices);
199
+ const matterExternalDevices = await this.getMatterExternalAccessories(hapDevices);
227
200
  return [...hapDevices, ...matterExternalDevices].sort((a, b) => a.name.localeCompare(b.name));
228
201
  }
229
- async getMatterExternalAccessories(configFile, hapDevices) {
230
- const matterPath = (0, node_path_1.join)(this.configService.storagePath, 'matter');
231
- if (!await (0, fs_extra_1.pathExists)(matterPath)) {
202
+ async getMatterExternalAccessories(hapDevices) {
203
+ const matterPath = join(this.configService.storagePath, 'matter');
204
+ if (!await pathExists(matterPath)) {
232
205
  return [];
233
206
  }
234
- const matterDirs = (await (0, fs_extra_1.readdir)(matterPath))
207
+ const matterDirs = (await readdir(matterPath))
235
208
  .filter(x => x.match(/^[A-F0-9]{12}$/));
236
209
  const matterExternalDevices = [];
237
210
  for (const deviceId of matterDirs) {
@@ -244,19 +217,19 @@ let ServerService = class ServerService {
244
217
  if (deviceId.toUpperCase() === mainBridgeId) {
245
218
  continue;
246
219
  }
247
- const accessoriesPath = (0, node_path_1.join)(matterPath, deviceId, 'accessories.json');
248
- if (!await (0, fs_extra_1.pathExists)(accessoriesPath)) {
220
+ const accessoriesPath = join(matterPath, deviceId, 'accessories.json');
221
+ if (!await pathExists(accessoriesPath)) {
249
222
  continue;
250
223
  }
251
- const accessories = await (0, fs_extra_1.readJson)(accessoriesPath);
224
+ const accessories = await readJson(accessoriesPath);
252
225
  if (!Array.isArray(accessories) || accessories.length === 0) {
253
226
  continue;
254
227
  }
255
228
  const accessory = accessories[0];
256
- const commissioningPath = (0, node_path_1.join)(matterPath, deviceId, 'commissioning.json');
229
+ const commissioningPath = join(matterPath, deviceId, 'commissioning.json');
257
230
  let commissioned = false;
258
- if (await (0, fs_extra_1.pathExists)(commissioningPath)) {
259
- const commissioningInfo = await (0, fs_extra_1.readJson)(commissioningPath);
231
+ if (await pathExists(commissioningPath)) {
232
+ const commissioningInfo = await readJson(commissioningPath);
260
233
  commissioned = commissioningInfo.commissioned || false;
261
234
  }
262
235
  const device = {
@@ -284,13 +257,13 @@ let ServerService = class ServerService {
284
257
  return matterExternalDevices;
285
258
  }
286
259
  async getDevicePairingById(deviceId, configFile = null) {
287
- const persistPath = (0, node_path_1.join)(this.configService.storagePath, 'persist');
260
+ const persistPath = join(this.configService.storagePath, 'persist');
288
261
  let device;
289
262
  try {
290
- device = await (0, fs_extra_1.readJson)((0, node_path_1.join)(persistPath, `AccessoryInfo.${deviceId}.json`));
263
+ device = await readJson(join(persistPath, `AccessoryInfo.${deviceId}.json`));
291
264
  }
292
265
  catch (e) {
293
- throw new common_1.NotFoundException();
266
+ throw new NotFoundException();
294
267
  }
295
268
  if (!configFile) {
296
269
  configFile = await this.configEditorService.getConfigFile();
@@ -302,7 +275,7 @@ let ServerService = class ServerService {
302
275
  .concat([{ _bridge: configFile.bridge }])
303
276
  .find((block) => block._bridge?.username?.toUpperCase() === username.toUpperCase());
304
277
  try {
305
- device._category = Object.entries(hap_types_1.Categories).find(([, value]) => value === device.category)[0].toLowerCase();
278
+ device._category = Object.entries(Categories).find(([, value]) => value === device.category)[0].toLowerCase();
306
279
  }
307
280
  catch (e) {
308
281
  device._category = 'Other';
@@ -343,7 +316,7 @@ let ServerService = class ServerService {
343
316
  const pluginBlock = pluginBlocks.find((block) => block._bridge?.matter);
344
317
  if (!pluginBlock) {
345
318
  this.logger.error(`Failed to find Matter configuration for child bridge ${id}.`);
346
- throw new common_1.NotFoundException(`Matter configuration not found for bridge ${id}`);
319
+ throw new NotFoundException(`Matter configuration not found for bridge ${id}`);
347
320
  }
348
321
  if ('accessory' in pluginBlock) {
349
322
  this.logger.warn(`Removing Matter configuration from accessory-based plugin block for bridge ${id}. Matter is only supported for platform-based plugins.`);
@@ -353,18 +326,18 @@ let ServerService = class ServerService {
353
326
  await this.configEditorService.updateConfigFile(configFile);
354
327
  }
355
328
  catch (e) {
356
- if (e instanceof common_1.NotFoundException) {
329
+ if (e instanceof NotFoundException) {
357
330
  throw e;
358
331
  }
359
332
  this.logger.error(`Failed to remove Matter configuration for child bridge ${id} as ${e.message}.`);
360
- throw new common_1.InternalServerErrorException(`Failed to remove Matter configuration: ${e.message}`);
333
+ throw new InternalServerErrorException(`Failed to remove Matter configuration: ${e.message}`);
361
334
  }
362
335
  this.logger.warn(`Shutting down Homebridge before removing Matter storage for bridge ${id}...`);
363
336
  await this.homebridgeIpcService.restartAndWaitForClose();
364
337
  const deviceId = id.includes(':') ? id.split(':').join('').toUpperCase() : id.toUpperCase();
365
- const matterPath = (0, node_path_1.join)(this.configService.storagePath, 'matter', deviceId);
366
- if (await (0, fs_extra_1.pathExists)(matterPath)) {
367
- await (0, fs_extra_1.remove)(matterPath);
338
+ const matterPath = join(this.configService.storagePath, 'matter', deviceId);
339
+ if (await pathExists(matterPath)) {
340
+ await remove(matterPath);
368
341
  this.logger.warn(`Bridge ${id} Matter storage removed at ${matterPath}.`);
369
342
  }
370
343
  return { ok: true };
@@ -385,13 +358,13 @@ let ServerService = class ServerService {
385
358
  async deleteDeviceAccessories(id) {
386
359
  this.logger.warn(`Shutting down Homebridge before removing accessories for paired bridge ${id}...`);
387
360
  await this.homebridgeIpcService.restartAndWaitForClose();
388
- const cachedAccessoriesDir = (0, node_path_1.join)(this.configService.storagePath, 'accessories');
361
+ const cachedAccessoriesDir = join(this.configService.storagePath, 'accessories');
389
362
  await this.deleteSingleDeviceAccessories(id, cachedAccessoriesDir);
390
363
  }
391
364
  async deleteDevicesAccessories(bridges) {
392
365
  this.logger.warn(`Shutting down Homebridge before removing accessories for paired bridges ${bridges.map(x => x.id).join(', ')}...`);
393
366
  await this.homebridgeIpcService.restartAndWaitForClose();
394
- const cachedAccessoriesDir = (0, node_path_1.join)(this.configService.storagePath, 'accessories');
367
+ const cachedAccessoriesDir = join(this.configService.storagePath, 'accessories');
395
368
  for (const { id, protocol } of bridges) {
396
369
  try {
397
370
  await this.deleteSingleDeviceAccessories(id, cachedAccessoriesDir, protocol || 'both');
@@ -402,12 +375,12 @@ let ServerService = class ServerService {
402
375
  }
403
376
  }
404
377
  async getCachedAccessories() {
405
- const cachedAccessoriesDir = (0, node_path_1.join)(this.configService.storagePath, 'accessories');
406
- const cachedAccessoryFiles = (await (0, fs_extra_1.readdir)(cachedAccessoriesDir))
378
+ const cachedAccessoriesDir = join(this.configService.storagePath, 'accessories');
379
+ const cachedAccessoryFiles = (await readdir(cachedAccessoriesDir))
407
380
  .filter(x => x.match(/^cachedAccessories\.([A-F,0-9]+)$/) || x === 'cachedAccessories');
408
381
  const cachedAccessories = [];
409
382
  await Promise.all(cachedAccessoryFiles.map(async (x) => {
410
- const accessories = await (0, fs_extra_1.readJson)((0, node_path_1.join)(cachedAccessoriesDir, x));
383
+ const accessories = await readJson(join(cachedAccessoriesDir, x));
411
384
  for (const accessory of accessories) {
412
385
  accessory.$cacheFile = x;
413
386
  cachedAccessories.push(accessory);
@@ -417,19 +390,19 @@ let ServerService = class ServerService {
417
390
  }
418
391
  async deleteCachedAccessory(uuid, cacheFile) {
419
392
  cacheFile = cacheFile || 'cachedAccessories';
420
- const cachedAccessoriesPath = (0, node_path_1.resolve)(this.configService.storagePath, 'accessories', cacheFile);
393
+ const cachedAccessoriesPath = resolve(this.configService.storagePath, 'accessories', cacheFile);
421
394
  this.logger.warn(`Shutting down Homebridge before removing cached accessory ${uuid}...`);
422
395
  await this.homebridgeIpcService.restartAndWaitForClose();
423
- const cachedAccessories = await (0, fs_extra_1.readJson)(cachedAccessoriesPath);
396
+ const cachedAccessories = await readJson(cachedAccessoriesPath);
424
397
  const accessoryIndex = cachedAccessories.findIndex(x => x.UUID === uuid);
425
398
  if (accessoryIndex > -1) {
426
399
  cachedAccessories.splice(accessoryIndex, 1);
427
- await (0, fs_extra_1.writeJson)(cachedAccessoriesPath, cachedAccessories);
400
+ await writeJson(cachedAccessoriesPath, cachedAccessories);
428
401
  this.logger.warn(`Removed cached accessory with UUID ${uuid} from file ${cacheFile}.`);
429
402
  }
430
403
  else {
431
404
  this.logger.error(`Cannot find cached accessory with UUID ${uuid} from file ${cacheFile}.`);
432
- throw new common_1.NotFoundException();
405
+ throw new NotFoundException();
433
406
  }
434
407
  return { ok: true };
435
408
  }
@@ -445,8 +418,8 @@ let ServerService = class ServerService {
445
418
  accessoriesByCacheFile.get(accessoryCacheFile).push({ uuid });
446
419
  }
447
420
  for (const [cacheFile, accessories] of accessoriesByCacheFile.entries()) {
448
- const cachedAccessoriesPath = (0, node_path_1.resolve)(this.configService.storagePath, 'accessories', cacheFile);
449
- const cachedAccessories = await (0, fs_extra_1.readJson)(cachedAccessoriesPath);
421
+ const cachedAccessoriesPath = resolve(this.configService.storagePath, 'accessories', cacheFile);
422
+ const cachedAccessories = await readJson(cachedAccessoriesPath);
450
423
  for (const { uuid } of accessories) {
451
424
  try {
452
425
  const accessoryIndex = cachedAccessories.findIndex(x => x.UUID === uuid);
@@ -462,53 +435,53 @@ let ServerService = class ServerService {
462
435
  this.logger.error(`Failed to remove cached accessory with UUID ${uuid} from file ${cacheFile} as ${e.message}.`);
463
436
  }
464
437
  }
465
- await (0, fs_extra_1.writeJson)(cachedAccessoriesPath, cachedAccessories);
438
+ await writeJson(cachedAccessoriesPath, cachedAccessories);
466
439
  }
467
440
  return { ok: true };
468
441
  }
469
442
  async deleteAllCachedAccessories() {
470
- const cachedAccessoriesDir = (0, node_path_1.join)(this.configService.storagePath, 'accessories');
471
- const cachedAccessoryPaths = (await (0, fs_extra_1.readdir)(cachedAccessoriesDir))
443
+ const cachedAccessoriesDir = join(this.configService.storagePath, 'accessories');
444
+ const cachedAccessoryPaths = (await readdir(cachedAccessoriesDir))
472
445
  .filter(x => x.match(/cachedAccessories\.([A-F,0-9]+)/) || x === 'cachedAccessories' || x === '.cachedAccessories.bak')
473
- .map(x => (0, node_path_1.resolve)(cachedAccessoriesDir, x));
474
- const cachedAccessoriesPath = (0, node_path_1.resolve)(this.configService.storagePath, 'accessories', 'cachedAccessories');
446
+ .map(x => resolve(cachedAccessoriesDir, x));
447
+ const cachedAccessoriesPath = resolve(this.configService.storagePath, 'accessories', 'cachedAccessories');
475
448
  await this.homebridgeIpcService.restartAndWaitForClose();
476
449
  this.logger.warn('Shutting down Homebridge before removing cached accessories');
477
450
  try {
478
451
  this.logger.log('Clearing all HAP cached accessories...');
479
452
  for (const thisCachedAccessoriesPath of cachedAccessoryPaths) {
480
- if (await (0, fs_extra_1.pathExists)(thisCachedAccessoriesPath)) {
481
- await (0, fs_extra_1.unlink)(thisCachedAccessoriesPath);
453
+ if (await pathExists(thisCachedAccessoriesPath)) {
454
+ await unlink(thisCachedAccessoriesPath);
482
455
  this.logger.warn(`Removed ${thisCachedAccessoriesPath}.`);
483
456
  }
484
457
  }
485
- const matterDir = (0, node_path_1.join)(this.configService.storagePath, 'matter');
486
- if (await (0, fs_extra_1.pathExists)(matterDir)) {
458
+ const matterDir = join(this.configService.storagePath, 'matter');
459
+ if (await pathExists(matterDir)) {
487
460
  this.logger.log('Clearing all Matter cached accessories...');
488
- await (0, fs_extra_1.remove)(matterDir);
461
+ await remove(matterDir);
489
462
  this.logger.warn(`Removed Matter storage directory at ${matterDir}.`);
490
463
  }
491
464
  }
492
465
  catch (e) {
493
466
  this.logger.error(`Failed to clear all cached accessories at ${cachedAccessoriesPath} as ${e.message}.`);
494
467
  console.error(e);
495
- throw new common_1.InternalServerErrorException('Failed to clear Homebridge accessory cache - see logs.');
468
+ throw new InternalServerErrorException('Failed to clear Homebridge accessory cache - see logs.');
496
469
  }
497
470
  return { ok: true };
498
471
  }
499
472
  async getMatterAccessories() {
500
- const matterDir = (0, node_path_1.join)(this.configService.storagePath, 'matter');
501
- if (!await (0, fs_extra_1.pathExists)(matterDir)) {
473
+ const matterDir = join(this.configService.storagePath, 'matter');
474
+ if (!await pathExists(matterDir)) {
502
475
  return [];
503
476
  }
504
- const matterBridges = (await (0, fs_extra_1.readdir)(matterDir))
477
+ const matterBridges = (await readdir(matterDir))
505
478
  .filter(x => x.match(/^[A-F0-9]+$/));
506
479
  const matterAccessories = [];
507
480
  await Promise.all(matterBridges.map(async (deviceId) => {
508
481
  try {
509
- const accessoriesPath = (0, node_path_1.join)(matterDir, deviceId, 'accessories.json');
510
- if (await (0, fs_extra_1.pathExists)(accessoriesPath)) {
511
- const accessories = await (0, fs_extra_1.readJson)(accessoriesPath);
482
+ const accessoriesPath = join(matterDir, deviceId, 'accessories.json');
483
+ if (await pathExists(accessoriesPath)) {
484
+ const accessories = await readJson(accessoriesPath);
512
485
  if (Array.isArray(accessories)) {
513
486
  for (const accessory of accessories) {
514
487
  accessory.$deviceId = deviceId;
@@ -525,23 +498,23 @@ let ServerService = class ServerService {
525
498
  return matterAccessories;
526
499
  }
527
500
  async deleteMatterAccessory(deviceId, uuid) {
528
- const matterAccessoriesPath = (0, node_path_1.join)(this.configService.storagePath, 'matter', deviceId, 'accessories.json');
529
- if (!await (0, fs_extra_1.pathExists)(matterAccessoriesPath)) {
501
+ const matterAccessoriesPath = join(this.configService.storagePath, 'matter', deviceId, 'accessories.json');
502
+ if (!await pathExists(matterAccessoriesPath)) {
530
503
  this.logger.error(`Matter accessories file not found for bridge ${deviceId}`);
531
- throw new common_1.NotFoundException();
504
+ throw new NotFoundException();
532
505
  }
533
506
  this.logger.warn(`Shutting down Homebridge before removing Matter accessory ${uuid} from bridge ${deviceId}...`);
534
507
  await this.homebridgeIpcService.restartAndWaitForClose();
535
- const matterAccessories = await (0, fs_extra_1.readJson)(matterAccessoriesPath);
508
+ const matterAccessories = await readJson(matterAccessoriesPath);
536
509
  const accessoryIndex = matterAccessories.findIndex(x => x.uuid === uuid);
537
510
  if (accessoryIndex > -1) {
538
511
  matterAccessories.splice(accessoryIndex, 1);
539
- await (0, fs_extra_1.writeJson)(matterAccessoriesPath, matterAccessories, { spaces: 2 });
512
+ await writeJson(matterAccessoriesPath, matterAccessories, { spaces: 2 });
540
513
  this.logger.warn(`Removed Matter accessory with UUID ${uuid} from bridge ${deviceId}.`);
541
514
  }
542
515
  else {
543
516
  this.logger.error(`Cannot find Matter accessory with UUID ${uuid} in bridge ${deviceId}.`);
544
- throw new common_1.NotFoundException();
517
+ throw new NotFoundException();
545
518
  }
546
519
  return { ok: true };
547
520
  }
@@ -556,13 +529,13 @@ let ServerService = class ServerService {
556
529
  accessoriesByBridge.get(deviceId).push({ uuid });
557
530
  }
558
531
  for (const [deviceId, bridgeAccessories] of accessoriesByBridge.entries()) {
559
- const matterAccessoriesPath = (0, node_path_1.join)(this.configService.storagePath, 'matter', deviceId, 'accessories.json');
532
+ const matterAccessoriesPath = join(this.configService.storagePath, 'matter', deviceId, 'accessories.json');
560
533
  try {
561
- if (!await (0, fs_extra_1.pathExists)(matterAccessoriesPath)) {
534
+ if (!await pathExists(matterAccessoriesPath)) {
562
535
  this.logger.error(`Matter accessories file not found for bridge ${deviceId}`);
563
536
  continue;
564
537
  }
565
- const matterAccessories = await (0, fs_extra_1.readJson)(matterAccessoriesPath);
538
+ const matterAccessories = await readJson(matterAccessoriesPath);
566
539
  for (const { uuid } of bridgeAccessories) {
567
540
  try {
568
541
  const accessoryIndex = matterAccessories.findIndex(x => x.uuid === uuid);
@@ -578,7 +551,7 @@ let ServerService = class ServerService {
578
551
  this.logger.error(`Failed to remove Matter accessory with UUID ${uuid} from bridge ${deviceId} as ${e.message}.`);
579
552
  }
580
553
  }
581
- await (0, fs_extra_1.writeJson)(matterAccessoriesPath, matterAccessories, { spaces: 2 });
554
+ await writeJson(matterAccessoriesPath, matterAccessories, { spaces: 2 });
582
555
  }
583
556
  catch (e) {
584
557
  this.logger.error(`Failed to process Matter accessories for bridge ${deviceId} as ${e.message}.`);
@@ -591,16 +564,16 @@ let ServerService = class ServerService {
591
564
  return this.setupCode;
592
565
  }
593
566
  else {
594
- if (!await (0, fs_extra_1.pathExists)(this.accessoryInfoPath)) {
567
+ if (!await pathExists(this.accessoryInfoPath)) {
595
568
  return null;
596
569
  }
597
- const accessoryInfo = await (0, fs_extra_1.readJson)(this.accessoryInfoPath);
570
+ const accessoryInfo = await readJson(this.accessoryInfoPath);
598
571
  this.setupCode = this.generateSetupCode(accessoryInfo);
599
572
  return this.setupCode;
600
573
  }
601
574
  }
602
575
  generateSetupCode(accessoryInfo) {
603
- const buffer = node_buffer_1.Buffer.allocUnsafe(8);
576
+ const buffer = Buffer.allocUnsafe(8);
604
577
  let valueLow = Number.parseInt(accessoryInfo.pincode.replace(/-/g, ''), 10);
605
578
  const valueHigh = accessoryInfo.category >> 1;
606
579
  valueLow |= 1 << 28;
@@ -618,10 +591,10 @@ let ServerService = class ServerService {
618
591
  return `X-HM://${encodedPayload}${accessoryInfo.setupID}`;
619
592
  }
620
593
  async getBridgePairingInformation() {
621
- if (!await (0, fs_extra_1.pathExists)(this.accessoryInfoPath)) {
622
- return new common_1.ServiceUnavailableException('Pairing Information Not Available Yet');
594
+ if (!await pathExists(this.accessoryInfoPath)) {
595
+ return new ServiceUnavailableException('Pairing Information Not Available Yet');
623
596
  }
624
- const accessoryInfo = await (0, fs_extra_1.readJson)(this.accessoryInfoPath);
597
+ const accessoryInfo = await readJson(this.accessoryInfoPath);
625
598
  return {
626
599
  displayName: accessoryInfo.displayName,
627
600
  pincode: accessoryInfo.pincode,
@@ -631,7 +604,7 @@ let ServerService = class ServerService {
631
604
  }
632
605
  async getSystemNetworkInterfaces() {
633
606
  const fromCache = this.serverServiceCache.get('network-interfaces');
634
- const interfaces = fromCache || (await (0, systeminformation_1.networkInterfaces)()).filter((adapter) => {
607
+ const interfaces = fromCache || (await networkInterfaces()).filter((adapter) => {
635
608
  return !adapter.internal
636
609
  && (adapter.ip4 || (adapter.ip6));
637
610
  });
@@ -685,7 +658,7 @@ let ServerService = class ServerService {
685
658
  const max = this.configService.homebridgeConfig.ports?.end ?? 60000;
686
659
  const randomPort = () => Math.floor(Math.random() * (max - min + 1) + min);
687
660
  let port = randomPort();
688
- while (await (0, tcp_port_used_1.check)(port)) {
661
+ while (await tcpCheck(port)) {
689
662
  port = randomPort();
690
663
  }
691
664
  return { port };
@@ -708,11 +681,11 @@ let ServerService = class ServerService {
708
681
  }
709
682
  }
710
683
  for (let port = min; port <= max; port += 1) {
711
- if (!usedMatterPorts.has(port) && !await (0, tcp_port_used_1.check)(port)) {
684
+ if (!usedMatterPorts.has(port) && !await tcpCheck(port)) {
712
685
  return { port };
713
686
  }
714
687
  }
715
- throw new common_1.InternalServerErrorException('No available ports in the Matter port range (5530-5541)');
688
+ throw new InternalServerErrorException('No available ports in the Matter port range (5530-5541)');
716
689
  }
717
690
  async getHomebridgePort() {
718
691
  const config = await this.configEditorService.getConfigFile();
@@ -734,7 +707,7 @@ let ServerService = class ServerService {
734
707
  }
735
708
  async setHomebridgeName(name) {
736
709
  if (!name || !(/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u).test(name)) {
737
- throw new common_1.BadRequestException('Invalid name');
710
+ throw new BadRequestException('Invalid name');
738
711
  }
739
712
  const config = await this.configEditorService.getConfigFile();
740
713
  config.bridge.name = name;
@@ -742,7 +715,7 @@ let ServerService = class ServerService {
742
715
  }
743
716
  async setHomebridgePort(port) {
744
717
  if (!port || typeof port !== 'number' || !Number.isInteger(port) || port < 1025 || port > 65533) {
745
- throw new common_1.BadRequestException('Invalid port number');
718
+ throw new BadRequestException('Invalid port number');
746
719
  }
747
720
  const config = await this.configEditorService.getConfigFile();
748
721
  config.bridge.port = port;
@@ -757,19 +730,19 @@ let ServerService = class ServerService {
757
730
  delete value.end;
758
731
  }
759
732
  if ('start' in value && (typeof value.start !== 'number' || value.start < 1025 || value.start > 65533)) {
760
- throw new common_1.BadRequestException('Port start must be a number between 1025 and 65533.');
733
+ throw new BadRequestException('Port start must be a number between 1025 and 65533.');
761
734
  }
762
735
  if ('end' in value && (typeof value.end !== 'number' || value.end < 1025 || value.end > 65533)) {
763
- throw new common_1.BadRequestException('Port end must be a number between 1025 and 65533.');
736
+ throw new BadRequestException('Port end must be a number between 1025 and 65533.');
764
737
  }
765
738
  if ('start' in value && 'end' in value && value.start >= value.end) {
766
- throw new common_1.BadRequestException('Ports start must be less than end.');
739
+ throw new BadRequestException('Ports start must be less than end.');
767
740
  }
768
741
  if ('start' in value && !('end' in value) && config.ports?.end && value.start >= config.ports.end) {
769
- throw new common_1.BadRequestException('Ports start must be less than end.');
742
+ throw new BadRequestException('Ports start must be less than end.');
770
743
  }
771
744
  if ('end' in value && !('start' in value) && config.ports?.start && config.ports.start >= value.end) {
772
- throw new common_1.BadRequestException('Ports start must be less than end.');
745
+ throw new BadRequestException('Ports start must be less than end.');
773
746
  }
774
747
  if (!value.start && !value.end) {
775
748
  delete config.ports;
@@ -792,10 +765,10 @@ let ServerService = class ServerService {
792
765
  const uiConfigBlock = configFile.platforms.find(x => x.platform === 'config');
793
766
  if (uiConfigBlock) {
794
767
  if (uiConfigBlock.wallpaper) {
795
- const oldPath = (0, node_path_1.join)(this.configService.storagePath, uiConfigBlock.wallpaper);
796
- if (await (0, fs_extra_1.pathExists)(oldPath)) {
768
+ const oldPath = join(this.configService.storagePath, uiConfigBlock.wallpaper);
769
+ if (await pathExists(oldPath)) {
797
770
  try {
798
- await (0, fs_extra_1.unlink)(oldPath);
771
+ await unlink(oldPath);
799
772
  this.logger.log(`Old wallpaper file ${oldPath} deleted successfully.`);
800
773
  }
801
774
  catch (e) {
@@ -803,9 +776,9 @@ let ServerService = class ServerService {
803
776
  }
804
777
  }
805
778
  }
806
- const fileExtension = (0, node_path_1.extname)(data.filename);
807
- const newPath = (0, node_path_1.join)(this.configService.storagePath, `ui-wallpaper${fileExtension}`);
808
- await pump(data.file, (0, fs_extra_1.createWriteStream)(newPath));
779
+ const fileExtension = extname(data.filename);
780
+ const newPath = join(this.configService.storagePath, `ui-wallpaper${fileExtension}`);
781
+ await pump(data.file, createWriteStream(newPath));
809
782
  uiConfigBlock.wallpaper = `ui-wallpaper${fileExtension}`;
810
783
  await this.configEditorService.updateConfigFile(configFile);
811
784
  this.logger.log('Wallpaper uploaded and set in the config file.');
@@ -814,11 +787,11 @@ let ServerService = class ServerService {
814
787
  async deleteWallpaper() {
815
788
  const configFile = await this.configEditorService.getConfigFile();
816
789
  const uiConfigBlock = configFile.platforms.find(x => x.platform === 'config');
817
- const fullPath = (0, node_path_1.join)(this.configService.storagePath, uiConfigBlock.wallpaper);
790
+ const fullPath = join(this.configService.storagePath, uiConfigBlock.wallpaper);
818
791
  if (uiConfigBlock && uiConfigBlock.wallpaper) {
819
- if (await (0, fs_extra_1.pathExists)(fullPath)) {
792
+ if (await pathExists(fullPath)) {
820
793
  try {
821
- await (0, fs_extra_1.unlink)(fullPath);
794
+ await unlink(fullPath);
822
795
  this.logger.log(`Wallpaper file ${uiConfigBlock.wallpaper} deleted successfully.`);
823
796
  }
824
797
  catch (e) {
@@ -834,9 +807,9 @@ let ServerService = class ServerService {
834
807
  async nodeVersionChanged() {
835
808
  return new Promise((res) => {
836
809
  let result = false;
837
- const child = (0, node_child_process_1.spawn)(node_process_1.default.execPath, ['-v']);
810
+ const child = spawn(process.execPath, ['-v']);
838
811
  child.stdout.once('data', (data) => {
839
- result = data.toString().trim() !== node_process_1.default.version;
812
+ result = data.toString().trim() !== process.version;
840
813
  });
841
814
  child.on('error', () => {
842
815
  result = true;
@@ -863,22 +836,22 @@ let ServerService = class ServerService {
863
836
  }
864
837
  }
865
838
  if (!files.length) {
866
- throw new common_1.BadRequestException('No files uploaded. Please upload both the private key and certificate files.');
839
+ throw new BadRequestException('No files uploaded. Please upload both the private key and certificate files.');
867
840
  }
868
841
  const readStreamToBuffer = async (stream) => {
869
842
  const chunks = [];
870
843
  await new Promise((resolvePromise, rejectPromise) => {
871
- stream.on('data', (d) => chunks.push(node_buffer_1.Buffer.isBuffer(d) ? d : node_buffer_1.Buffer.from(d)));
844
+ stream.on('data', (d) => chunks.push(Buffer.isBuffer(d) ? d : Buffer.from(d)));
872
845
  stream.on('end', () => resolvePromise());
873
846
  stream.on('error', rejectPromise);
874
847
  });
875
- return node_buffer_1.Buffer.concat(chunks);
848
+ return Buffer.concat(chunks);
876
849
  };
877
850
  let keyPem = null;
878
851
  let certPem = null;
879
852
  for (const f of files) {
880
853
  if (f.file?.truncated) {
881
- throw new common_1.InternalServerErrorException(`Upload exceeds maximum size ${globalThis.backup.maxBackupSizeText}.`);
854
+ throw new InternalServerErrorException(`Upload exceeds maximum size ${globalThis.backup.maxBackupSizeText}.`);
882
855
  }
883
856
  const buf = await readStreamToBuffer(f.file);
884
857
  const text = buf.toString('utf8');
@@ -896,35 +869,35 @@ let ServerService = class ServerService {
896
869
  }
897
870
  }
898
871
  if (!keyPem || !certPem) {
899
- throw new common_1.BadRequestException('Both a PEM private key and certificate must be provided.');
872
+ throw new BadRequestException('Both a PEM private key and certificate must be provided.');
900
873
  }
901
874
  try {
902
- const x509 = new node_crypto_1.X509Certificate(certPem);
875
+ const x509 = new X509Certificate(certPem);
903
876
  const certPub = x509.publicKey.export({ type: 'spki', format: 'der' });
904
- const priv = (0, node_crypto_1.createPrivateKey)({ key: keyPem });
905
- const pubFromPriv = (0, node_crypto_1.createPublicKey)(priv).export({ type: 'spki', format: 'der' });
877
+ const priv = createPrivateKey({ key: keyPem });
878
+ const pubFromPriv = createPublicKey(priv).export({ type: 'spki', format: 'der' });
906
879
  if (!certPub.equals(pubFromPriv)) {
907
- throw new common_1.BadRequestException('The private key does not match the certificate public key.');
880
+ throw new BadRequestException('The private key does not match the certificate public key.');
908
881
  }
909
- (0, node_tls_1.createSecureContext)({ key: keyPem, cert: certPem });
882
+ createSecureContext({ key: keyPem, cert: certPem });
910
883
  }
911
884
  catch (e) {
912
- if (e instanceof common_1.BadRequestException) {
885
+ if (e instanceof BadRequestException) {
913
886
  throw e;
914
887
  }
915
- throw new common_1.BadRequestException(`Invalid key/certificate: ${e?.message || e}`);
888
+ throw new BadRequestException(`Invalid key/certificate: ${e?.message || e}`);
916
889
  }
917
- const sslDir = (0, node_path_1.join)(this.configService.storagePath, 'ssl-certs');
918
- const keyPath = (0, node_path_1.join)(sslDir, 'ui-ssl.key');
919
- const certPath = (0, node_path_1.join)(sslDir, 'ui-ssl.crt');
920
- const { ensureDir, writeFile } = await Promise.resolve().then(() => __importStar(require('fs-extra')));
890
+ const sslDir = join(this.configService.storagePath, 'ssl-certs');
891
+ const keyPath = join(sslDir, 'ui-ssl.key');
892
+ const certPath = join(sslDir, 'ui-ssl.crt');
893
+ const { ensureDir, writeFile } = await import('fs-extra');
921
894
  await ensureDir(sslDir);
922
895
  await writeFile(keyPath, keyPem);
923
896
  await writeFile(certPath, certPem);
924
897
  const configFile = await this.configEditorService.getConfigFile();
925
898
  const uiConfigBlock = configFile.platforms.find((x) => x.platform === 'config');
926
899
  if (!uiConfigBlock) {
927
- throw new common_1.InternalServerErrorException('Config platform block not found.');
900
+ throw new InternalServerErrorException('Config platform block not found.');
928
901
  }
929
902
  if (!uiConfigBlock.ssl) {
930
903
  uiConfigBlock.ssl = {};
@@ -963,36 +936,36 @@ let ServerService = class ServerService {
963
936
  passphrase = req.body?.passphrase;
964
937
  }
965
938
  if (!filePart) {
966
- throw new common_1.BadRequestException('No PFX file uploaded.');
939
+ throw new BadRequestException('No PFX file uploaded.');
967
940
  }
968
941
  if (filePart.file?.truncated) {
969
- throw new common_1.InternalServerErrorException(`Upload exceeds maximum size ${globalThis.backup.maxBackupSizeText}.`);
942
+ throw new InternalServerErrorException(`Upload exceeds maximum size ${globalThis.backup.maxBackupSizeText}.`);
970
943
  }
971
944
  const readStreamToBuffer = async (stream) => {
972
945
  const chunks = [];
973
946
  await new Promise((resolvePromise, rejectPromise) => {
974
- stream.on('data', (d) => chunks.push(node_buffer_1.Buffer.isBuffer(d) ? d : node_buffer_1.Buffer.from(d)));
947
+ stream.on('data', (d) => chunks.push(Buffer.isBuffer(d) ? d : Buffer.from(d)));
975
948
  stream.on('end', () => resolvePromise());
976
949
  stream.on('error', rejectPromise);
977
950
  });
978
- return node_buffer_1.Buffer.concat(chunks);
951
+ return Buffer.concat(chunks);
979
952
  };
980
953
  const pfxBuffer = await readStreamToBuffer(filePart.file);
981
954
  try {
982
- (0, node_tls_1.createSecureContext)({ pfx: pfxBuffer, passphrase });
955
+ createSecureContext({ pfx: pfxBuffer, passphrase });
983
956
  }
984
957
  catch (e) {
985
- throw new common_1.BadRequestException(`Invalid PFX or passphrase: ${e?.message || e}`);
958
+ throw new BadRequestException(`Invalid PFX or passphrase: ${e?.message || e}`);
986
959
  }
987
- const sslDir = (0, node_path_1.join)(this.configService.storagePath, 'ssl-certs');
988
- const pfxPath = (0, node_path_1.join)(sslDir, 'ui-ssl.pfx');
989
- const { ensureDir, writeFile } = await Promise.resolve().then(() => __importStar(require('fs-extra')));
960
+ const sslDir = join(this.configService.storagePath, 'ssl-certs');
961
+ const pfxPath = join(sslDir, 'ui-ssl.pfx');
962
+ const { ensureDir, writeFile } = await import('fs-extra');
990
963
  await ensureDir(sslDir);
991
964
  await writeFile(pfxPath, pfxBuffer);
992
965
  const configFile = await this.configEditorService.getConfigFile();
993
966
  const uiConfigBlock = configFile.platforms.find((x) => x.platform === 'config');
994
967
  if (!uiConfigBlock) {
995
- throw new common_1.InternalServerErrorException('Config platform block not found.');
968
+ throw new InternalServerErrorException('Config platform block not found.');
996
969
  }
997
970
  if (!uiConfigBlock.ssl) {
998
971
  uiConfigBlock.ssl = {};
@@ -1022,23 +995,23 @@ let ServerService = class ServerService {
1022
995
  }
1023
996
  try {
1024
997
  if (ssl.key && ssl.cert) {
1025
- const { readFile } = await Promise.resolve().then(() => __importStar(require('fs-extra')));
998
+ const { readFile } = await import('fs-extra');
1026
999
  const keyPem = await readFile(ssl.key);
1027
1000
  const certPem = await readFile(ssl.cert);
1028
- const x509 = new node_crypto_1.X509Certificate(certPem);
1001
+ const x509 = new X509Certificate(certPem);
1029
1002
  const certPub = x509.publicKey.export({ type: 'spki', format: 'der' });
1030
- const priv = (0, node_crypto_1.createPrivateKey)({ key: keyPem });
1031
- const pubFromPriv = (0, node_crypto_1.createPublicKey)(priv).export({ type: 'spki', format: 'der' });
1003
+ const priv = createPrivateKey({ key: keyPem });
1004
+ const pubFromPriv = createPublicKey(priv).export({ type: 'spki', format: 'der' });
1032
1005
  if (!certPub.equals(pubFromPriv)) {
1033
1006
  return { ok: true, valid: false, type: 'keycert', details: 'Private key does not match certificate.' };
1034
1007
  }
1035
- (0, node_tls_1.createSecureContext)({ key: keyPem, cert: certPem });
1008
+ createSecureContext({ key: keyPem, cert: certPem });
1036
1009
  return { ok: true, valid: true, type: 'keycert', details: 'Key and certificate are valid and match.' };
1037
1010
  }
1038
1011
  if (ssl.pfx) {
1039
- const { readFile } = await Promise.resolve().then(() => __importStar(require('fs-extra')));
1012
+ const { readFile } = await import('fs-extra');
1040
1013
  const pfx = await readFile(ssl.pfx);
1041
- (0, node_tls_1.createSecureContext)({ pfx, passphrase: ssl.passphrase });
1014
+ createSecureContext({ pfx, passphrase: ssl.passphrase });
1042
1015
  return { ok: true, valid: true, type: 'pfx', details: 'PFX file and passphrase are valid.' };
1043
1016
  }
1044
1017
  }
@@ -1052,11 +1025,11 @@ let ServerService = class ServerService {
1052
1025
  ? options.hostnames.map(h => String(h).trim()).filter(Boolean)
1053
1026
  : ['localhost', '127.0.0.1'];
1054
1027
  const mode = options.mode || 'keycert';
1055
- const generator = new ssl_cert_generator_service_1.SslCertGeneratorService();
1028
+ const generator = new SslCertGeneratorService();
1056
1029
  await generator.generateCertificate(hostnames);
1057
- const sslDir = (0, node_path_1.join)(this.configService.storagePath, 'ssl-certs');
1058
- const keyPath = (0, node_path_1.join)(sslDir, 'private-key.pem');
1059
- const certPath = (0, node_path_1.join)(sslDir, 'certificate.pem');
1030
+ const sslDir = join(this.configService.storagePath, 'ssl-certs');
1031
+ const keyPath = join(sslDir, 'private-key.pem');
1032
+ const certPath = join(sslDir, 'certificate.pem');
1060
1033
  const configFile = await this.configEditorService.getConfigFile();
1061
1034
  const uiConfigBlock = configFile.platforms.find((x) => x.platform === 'config');
1062
1035
  if (!uiConfigBlock.ssl) {
@@ -1089,13 +1062,18 @@ let ServerService = class ServerService {
1089
1062
  };
1090
1063
  }
1091
1064
  };
1092
- exports.ServerService = ServerService;
1093
- exports.ServerService = ServerService = __decorate([
1094
- (0, common_1.Injectable)(),
1095
- __metadata("design:paramtypes", [config_service_1.ConfigService,
1096
- config_editor_service_1.ConfigEditorService,
1097
- accessories_service_1.AccessoriesService,
1098
- homebridge_ipc_service_1.HomebridgeIpcService,
1099
- logger_service_1.Logger])
1065
+ ServerService = __decorate([
1066
+ Injectable(),
1067
+ __param(0, Inject(ConfigService)),
1068
+ __param(1, Inject(ConfigEditorService)),
1069
+ __param(2, Inject(AccessoriesService)),
1070
+ __param(3, Inject(HomebridgeIpcService)),
1071
+ __param(4, Inject(Logger)),
1072
+ __metadata("design:paramtypes", [ConfigService,
1073
+ ConfigEditorService,
1074
+ AccessoriesService,
1075
+ HomebridgeIpcService,
1076
+ Logger])
1100
1077
  ], ServerService);
1078
+ export { ServerService };
1101
1079
  //# sourceMappingURL=server.service.js.map