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

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