@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.1

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 (387) hide show
  1. package/dist/interface/index.html +44 -44
  2. package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.CiB2EGly.0.0.50-internal.1.js} +1 -1
  3. package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.DxMw_rJn.0.0.50-internal.1.js} +1 -1
  4. package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.RxZ3hn6V.0.0.50-internal.1.js} +1 -1
  5. package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.C-k73ACm.0.0.50-internal.1.js} +1 -1
  6. package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.DumNu6GD.0.0.50-internal.1.js} +1 -1
  7. package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.BuosoqFl.0.0.50-internal.1.js} +1 -1
  8. package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.A7NJflGG.0.0.50-internal.1.js} +2 -2
  9. package/dist/interface/js/Cammesh.Dv3C0UiR.0.0.50-internal.1.js +1 -0
  10. package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.GgjJp7JR.0.0.50-internal.1.js} +1 -1
  11. package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.BL3L-BFE.0.0.50-internal.1.js} +2 -2
  12. package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.CxwRmUVF.0.0.50-internal.1.js} +1 -1
  13. package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.D16kkT6R.0.0.50-internal.1.js} +1 -1
  14. package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.Bkp__d8n.0.0.50-internal.1.js} +1 -1
  15. package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.C9HKvo0G.0.0.50-internal.1.js} +1 -1
  16. package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.QuJjtAtF.0.0.50-internal.1.js} +1 -1
  17. package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.BLUUbEej.0.0.50-internal.1.js} +1 -1
  18. package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.DviCIk7w.0.0.50-internal.1.js} +1 -1
  19. package/dist/interface/js/Recordings.Dsp07cHs.0.0.50-internal.1.js +1 -0
  20. package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.Clx4y9gP.0.0.50-internal.1.js} +1 -1
  21. package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.cfY4-PYd.0.0.50-internal.1.js} +1 -1
  22. package/dist/interface/js/SettingsAppearance.CBGZAazb.0.0.50-internal.1.js +1 -0
  23. package/dist/interface/js/{SettingsAppearance.vue_vue_type_script_setup_true_lang.CBQ6lL3T.0.0.50-internal.0.js → SettingsAppearance.vue_vue_type_script_setup_true_lang.kxAPXcBy.0.0.50-internal.1.js} +1 -1
  24. package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.DOaJA4pp.0.0.50-internal.1.js} +1 -1
  25. package/dist/interface/js/SettingsRecordings.BGcwL6tk.0.0.50-internal.1.js +1 -0
  26. package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.BVU_w1Jm.0.0.50-internal.1.js} +1 -1
  27. package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.P0vy90vA.0.0.50-internal.1.js} +1 -1
  28. package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.DaP5m7eo.0.0.50-internal.1.js} +1 -1
  29. package/dist/interface/js/{VersionsHandler.vue_vue_type_script_setup_true_lang.xDishkkS.0.0.50-internal.0.js → VersionsHandler.vue_vue_type_script_setup_true_lang.MmrWYW3K.0.0.50-internal.1.js} +1 -1
  30. package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0aqA_3x.0.0.50-internal.1.js} +2 -2
  31. package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.C9wgzklI.0.0.50-internal.1.js} +1 -1
  32. package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.BeH6lJ5t.0.0.50-internal.1.js} +1 -1
  33. package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.BQHSWV_g.0.0.50-internal.1.js} +1 -1
  34. package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.DDKMxauw.0.0.50-internal.1.js} +1 -1
  35. package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.dWz9rJqH.0.0.50-internal.1.js} +1 -1
  36. package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.D-iZIS1n.0.0.50-internal.1.js} +1 -1
  37. package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.BwxOddB_.0.0.50-internal.1.js} +1 -1
  38. package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.Dz96RC_N.0.0.50-internal.1.js} +1 -1
  39. package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.CmcM8OM6.0.0.50-internal.1.js} +1 -1
  40. package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BgLcBzlw.0.0.50-internal.1.js} +1 -1
  41. package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.6bOgRV7D.0.0.50-internal.1.js} +3 -3
  42. package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.CTgfs-3p.0.0.50-internal.1.js} +1 -1
  43. package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CMhnq8jS.0.0.50-internal.1.js} +1 -1
  44. package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CuC5ZfNs.0.0.50-internal.1.js} +1 -1
  45. package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.DmwjJ4xV.0.0.50-internal.1.js} +1 -1
  46. package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.DGZO3j1c.0.0.50-internal.1.js} +1 -1
  47. package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.CEGHlD-T.0.0.50-internal.1.js} +1 -1
  48. package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.D0keXzBc.0.0.50-internal.1.js} +1 -1
  49. package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.CiDbFOB0.0.0.50-internal.1.js} +1 -1
  50. package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.BPcXPAHG.0.0.50-internal.1.js} +1 -1
  51. package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.DSGzrW_l.0.0.50-internal.1.js} +1 -1
  52. package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.BKlEObmx.0.0.50-internal.1.js} +1 -1
  53. package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.BDFILs86.0.0.50-internal.1.js} +1 -1
  54. package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.DcxsxHCS.0.0.50-internal.1.js} +1 -1
  55. package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.BGRg3oQ8.0.0.50-internal.1.js} +1 -1
  56. package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.B9yk2de7.0.0.50-internal.1.js} +1 -1
  57. package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.DXDZITpf.0.0.50-internal.1.js} +1 -1
  58. package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.BDYaTfbi.0.0.50-internal.1.js} +1 -1
  59. package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.CFEDA008.0.0.50-internal.1.js} +1 -1
  60. package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.zqTafMgD.0.0.50-internal.1.js} +1 -1
  61. package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.BxM3dbYs.0.0.50-internal.1.js} +1 -1
  62. package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.B6SY9IIj.0.0.50-internal.1.js} +1 -1
  63. package/dist/interface/sw.js +1 -1
  64. package/dist/server/package.json +1 -1
  65. package/package.json +1 -1
  66. package/.prettierignore +0 -12
  67. package/.prettierrc.json +0 -12
  68. package/artillery.yaml +0 -29
  69. package/bin/cameraui-server.ts +0 -11
  70. package/dist/interface/js/Cammesh.D-6dAROQ.0.0.50-internal.0.js +0 -1
  71. package/dist/interface/js/Recordings.DhxjIW7e.0.0.50-internal.0.js +0 -1
  72. package/dist/interface/js/SettingsAppearance.DsTjKXk1.0.0.50-internal.0.js +0 -1
  73. package/dist/interface/js/SettingsRecordings.DgW7M0jj.0.0.50-internal.0.js +0 -1
  74. package/eslint.config.js +0 -103
  75. package/localdeps.txt +0 -10
  76. package/mypy.ini +0 -30
  77. package/requirements.txt +0 -15
  78. package/ruff.toml +0 -90
  79. package/src/__init__.py +0 -0
  80. package/src/_camera_ui_tools/__init__.py +0 -0
  81. package/src/_camera_ui_tools/__pycache__/__init__.cpython-311.pyc +0 -0
  82. package/src/api/controllers/api.controller.ts +0 -19
  83. package/src/api/controllers/auth.controller.ts +0 -294
  84. package/src/api/controllers/backup.controller.ts +0 -72
  85. package/src/api/controllers/cameras.controller.ts +0 -1029
  86. package/src/api/controllers/config.controller.ts +0 -102
  87. package/src/api/controllers/files.controller.ts +0 -35
  88. package/src/api/controllers/frameWorkers.controller.ts +0 -109
  89. package/src/api/controllers/plugins.controller.ts +0 -1206
  90. package/src/api/controllers/system.controller.ts +0 -273
  91. package/src/api/controllers/users.controller.ts +0 -648
  92. package/src/api/database/checks.ts +0 -268
  93. package/src/api/database/constants.ts +0 -8
  94. package/src/api/database/index.ts +0 -262
  95. package/src/api/database/migration.ts +0 -62
  96. package/src/api/database/selfcheck.ts +0 -492
  97. package/src/api/database/types.ts +0 -104
  98. package/src/api/go2rtc/api/application.ts +0 -48
  99. package/src/api/go2rtc/api/config.ts +0 -61
  100. package/src/api/go2rtc/api/discover.ts +0 -197
  101. package/src/api/go2rtc/api/index.ts +0 -49
  102. package/src/api/go2rtc/api/snapshot.ts +0 -44
  103. package/src/api/go2rtc/api/streams.ts +0 -168
  104. package/src/api/go2rtc/index.ts +0 -43
  105. package/src/api/go2rtc/queue.ts +0 -50
  106. package/src/api/go2rtc/types.ts +0 -174
  107. package/src/api/index.ts +0 -286
  108. package/src/api/middlewares/authPermission.middleware.ts +0 -46
  109. package/src/api/middlewares/authValidation.middleware.ts +0 -160
  110. package/src/api/middlewares/pagination.middleware.ts +0 -67
  111. package/src/api/middlewares/socketAuth.middleware.ts +0 -136
  112. package/src/api/plugins/header.plugin.ts +0 -15
  113. package/src/api/plugins/logger.plugin.ts +0 -44
  114. package/src/api/plugins/proxy.plugin.ts +0 -255
  115. package/src/api/plugins/socket.plugin.ts +0 -28
  116. package/src/api/plugins/system.plugin.ts +0 -48
  117. package/src/api/plugins/useragent.plugin.ts +0 -19
  118. package/src/api/routes/api.routes.ts +0 -10
  119. package/src/api/routes/auth.routes.ts +0 -56
  120. package/src/api/routes/backup.routes.ts +0 -28
  121. package/src/api/routes/cameras.routes.ts +0 -281
  122. package/src/api/routes/config.routes.ts +0 -66
  123. package/src/api/routes/files.routes.ts +0 -15
  124. package/src/api/routes/frameWorkers.routes.ts +0 -39
  125. package/src/api/routes/index.ts +0 -37
  126. package/src/api/routes/plugins.routes.ts +0 -420
  127. package/src/api/routes/system.routes.ts +0 -101
  128. package/src/api/routes/users.routes.ts +0 -167
  129. package/src/api/schemas/backup.schema.ts +0 -112
  130. package/src/api/schemas/cameras.schema.ts +0 -479
  131. package/src/api/schemas/config.schema.ts +0 -38
  132. package/src/api/schemas/go2rtc.schema.ts +0 -189
  133. package/src/api/schemas/plugins.schema.ts +0 -126
  134. package/src/api/schemas/storage.schema.ts +0 -11
  135. package/src/api/schemas/system.schema.ts +0 -45
  136. package/src/api/schemas/users.schema.ts +0 -185
  137. package/src/api/services/auth.service.ts +0 -210
  138. package/src/api/services/backup.service.ts +0 -144
  139. package/src/api/services/cameras.service.ts +0 -671
  140. package/src/api/services/plugins.service.ts +0 -470
  141. package/src/api/services/system.service.ts +0 -85
  142. package/src/api/services/users.service.ts +0 -276
  143. package/src/api/types/index.ts +0 -675
  144. package/src/api/utils/cert.ts +0 -254
  145. package/src/api/utils/constants.ts +0 -17
  146. package/src/api/utils/fetch.ts +0 -21
  147. package/src/api/utils/moveFiles.ts +0 -45
  148. package/src/api/utils/parse.ts +0 -17
  149. package/src/api/websocket/index.ts +0 -110
  150. package/src/api/websocket/nsp/logs.ts +0 -240
  151. package/src/api/websocket/nsp/main.ts +0 -27
  152. package/src/api/websocket/nsp/metrics.ts +0 -301
  153. package/src/api/websocket/nsp/notifications.ts +0 -43
  154. package/src/api/websocket/nsp/plugins.ts +0 -37
  155. package/src/api/websocket/nsp/server.ts +0 -220
  156. package/src/api/websocket/nsp/status.ts +0 -77
  157. package/src/api/websocket/types.ts +0 -55
  158. package/src/api.ts +0 -163
  159. package/src/camera/classes.ts +0 -32
  160. package/src/camera/controller.ts +0 -579
  161. package/src/camera/device.ts +0 -422
  162. package/src/camera/frameWorker.ts +0 -403
  163. package/src/camera/index.ts +0 -679
  164. package/src/camera/interfaces.ts +0 -95
  165. package/src/camera/iou.ts +0 -153
  166. package/src/camera/polygon.ts +0 -226
  167. package/src/camera/python/__init__.py +0 -0
  168. package/src/camera/python/__pycache__/__init__.cpython-311.pyc +0 -0
  169. package/src/camera/python/__pycache__/classes.cpython-311.pyc +0 -0
  170. package/src/camera/python/__pycache__/delegate_controller.cpython-311.pyc +0 -0
  171. package/src/camera/python/__pycache__/interfaces.cpython-311.pyc +0 -0
  172. package/src/camera/python/__pycache__/iou.cpython-310.pyc +0 -0
  173. package/src/camera/python/__pycache__/iou.cpython-311.pyc +0 -0
  174. package/src/camera/python/__pycache__/iou2.cpython-310.pyc +0 -0
  175. package/src/camera/python/__pycache__/polygon.cpython-311.pyc +0 -0
  176. package/src/camera/python/__pycache__/typings.cpython-311.pyc +0 -0
  177. package/src/camera/python/__pycache__/video_frame.cpython-311.pyc +0 -0
  178. package/src/camera/python/classes.py +0 -41
  179. package/src/camera/python/interfaces.py +0 -130
  180. package/src/camera/python/iou.py +0 -158
  181. package/src/camera/python/polygon.py +0 -230
  182. package/src/camera/python/test/__pycache__/polygon.cpython-310.pyc +0 -0
  183. package/src/camera/python/test/iou_test.py +0 -799
  184. package/src/camera/python/test/polygon.py +0 -238
  185. package/src/camera/python/test/polygon_test.py +0 -256
  186. package/src/camera/python/test/polygon_test2.py +0 -484
  187. package/src/camera/python/typings.py +0 -50
  188. package/src/camera/python/video_frame.py +0 -143
  189. package/src/camera/session.ts +0 -192
  190. package/src/camera/streaming/fmp4-session.ts +0 -390
  191. package/src/camera/streaming/peer-connection.ts +0 -273
  192. package/src/camera/streaming/rtsp-session.ts +0 -331
  193. package/src/camera/streaming/webrtc-connection.ts +0 -260
  194. package/src/camera/streaming/werift-session.ts +0 -317
  195. package/src/camera/test/iou_test.ts +0 -761
  196. package/src/camera/test/polygon.test.ts +0 -611
  197. package/src/camera/test/polygon_test.ts +0 -210
  198. package/src/camera/types.ts +0 -48
  199. package/src/camera/utils.ts +0 -489
  200. package/src/camera/videoFrame.ts +0 -123
  201. package/src/cloud/index.ts +0 -61
  202. package/src/cloud/remote/cloudflare.ts +0 -18
  203. package/src/cloud/remote/upnp.ts +0 -18
  204. package/src/cloud/remote/utils.ts +0 -24
  205. package/src/cloud/types.ts +0 -16
  206. package/src/decoder/child.ts +0 -883
  207. package/src/decoder/imageUtils.ts +0 -275
  208. package/src/decoder/manager.ts +0 -251
  209. package/src/decoder/python/__init__.py +0 -0
  210. package/src/decoder/python/__pycache__/__init__.cpython-311.pyc +0 -0
  211. package/src/decoder/python/__pycache__/image_utils.cpython-311.pyc +0 -0
  212. package/src/decoder/python/__pycache__/typings.cpython-311.pyc +0 -0
  213. package/src/decoder/python/__pycache__/utils.cpython-311.pyc +0 -0
  214. package/src/decoder/python/child.py +0 -903
  215. package/src/decoder/python/image_utils.py +0 -196
  216. package/src/decoder/python/pool.py +0 -45
  217. package/src/decoder/python/test/group.py +0 -62
  218. package/src/decoder/python/test/motion.mp4 +0 -0
  219. package/src/decoder/python/test/motion2.mp4 +0 -0
  220. package/src/decoder/python/test/opencl.cl +0 -70
  221. package/src/decoder/python/test/opencl2.cl +0 -130
  222. package/src/decoder/python/test/test.py +0 -427
  223. package/src/decoder/python/test/test1.jpg +0 -0
  224. package/src/decoder/python/test/test1_resized.jpg +0 -0
  225. package/src/decoder/python/test/test2.jpg +0 -0
  226. package/src/decoder/python/test/test2.py +0 -451
  227. package/src/decoder/python/test/test2_resized.jpg +0 -0
  228. package/src/decoder/python/test/test3.jpg +0 -0
  229. package/src/decoder/python/test/utils.py +0 -50
  230. package/src/decoder/python/typings.py +0 -57
  231. package/src/decoder/python/utils.py +0 -70
  232. package/src/decoder/test/child.ts +0 -117
  233. package/src/decoder/test/ffmpeg.ts +0 -371
  234. package/src/decoder/test/test.ts +0 -182
  235. package/src/decoder/types.ts +0 -27
  236. package/src/decoder/utils.ts +0 -64
  237. package/src/decoder/wasm/asconfig.json +0 -28
  238. package/src/decoder/wasm/assembly/console.ts +0 -1
  239. package/src/decoder/wasm/assembly/index.ts +0 -890
  240. package/src/decoder/wasm/build/decoder.d.ts +0 -43
  241. package/src/decoder/wasm/build/decoder.js +0 -108
  242. package/src/decoder/wasm/build/decoder.wasm +0 -0
  243. package/src/decoder/wasm/tsconfig.json +0 -5
  244. package/src/decoder/worker.ts +0 -113
  245. package/src/go2rtc/index.ts +0 -324
  246. package/src/go2rtc/types.ts +0 -88
  247. package/src/main.ts +0 -267
  248. package/src/manager/coreManager.ts +0 -78
  249. package/src/manager/deviceManager.ts +0 -132
  250. package/src/manager/types.ts +0 -17
  251. package/src/plugins/index.ts +0 -443
  252. package/src/plugins/plugin.ts +0 -177
  253. package/src/plugins/runtime/base.ts +0 -282
  254. package/src/plugins/runtime/index.ts +0 -15
  255. package/src/plugins/runtime/node/child.ts +0 -193
  256. package/src/plugins/runtime/node/index.ts +0 -67
  257. package/src/plugins/runtime/node/plugin.ts +0 -122
  258. package/src/plugins/runtime/node/pluginApi.ts +0 -27
  259. package/src/plugins/runtime/node/proxy/cameraDevice.ts +0 -299
  260. package/src/plugins/runtime/node/proxy/coreManager.ts +0 -128
  261. package/src/plugins/runtime/node/proxy/deviceManager.ts +0 -187
  262. package/src/plugins/runtime/node/storage.ts +0 -312
  263. package/src/plugins/runtime/node/storageController.ts +0 -91
  264. package/src/plugins/runtime/python/__init__.py +0 -0
  265. package/src/plugins/runtime/python/__pycache__/__init__.cpython-311.pyc +0 -0
  266. package/src/plugins/runtime/python/__pycache__/camera_storage.cpython-311.pyc +0 -0
  267. package/src/plugins/runtime/python/__pycache__/config_service.cpython-311.pyc +0 -0
  268. package/src/plugins/runtime/python/__pycache__/constants.cpython-311.pyc +0 -0
  269. package/src/plugins/runtime/python/__pycache__/ipc.cpython-311.pyc +0 -0
  270. package/src/plugins/runtime/python/__pycache__/logger.cpython-311.pyc +0 -0
  271. package/src/plugins/runtime/python/__pycache__/message_queue.cpython-311.pyc +0 -0
  272. package/src/plugins/runtime/python/__pycache__/namespaces.cpython-311.pyc +0 -0
  273. package/src/plugins/runtime/python/__pycache__/plugin.cpython-311.pyc +0 -0
  274. package/src/plugins/runtime/python/__pycache__/plugin_api.cpython-311.pyc +0 -0
  275. package/src/plugins/runtime/python/__pycache__/plugin_logger.cpython-311.pyc +0 -0
  276. package/src/plugins/runtime/python/__pycache__/proxy_utils.cpython-311.pyc +0 -0
  277. package/src/plugins/runtime/python/__pycache__/schema.cpython-311.pyc +0 -0
  278. package/src/plugins/runtime/python/__pycache__/storage.cpython-311.pyc +0 -0
  279. package/src/plugins/runtime/python/__pycache__/storage_controller.cpython-311.pyc +0 -0
  280. package/src/plugins/runtime/python/__pycache__/typings.cpython-311.pyc +0 -0
  281. package/src/plugins/runtime/python/child.py +0 -248
  282. package/src/plugins/runtime/python/index.ts +0 -73
  283. package/src/plugins/runtime/python/namespaces.py +0 -101
  284. package/src/plugins/runtime/python/plugin.py +0 -155
  285. package/src/plugins/runtime/python/plugin_api.py +0 -29
  286. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-310.pyc +0 -0
  287. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-311.pyc +0 -0
  288. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-38.pyc +0 -0
  289. package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-39.pyc +0 -0
  290. package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-311.pyc +0 -0
  291. package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-39.pyc +0 -0
  292. package/src/plugins/runtime/python/proxy/__pycache__/core_manager.cpython-311.pyc +0 -0
  293. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-310.pyc +0 -0
  294. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-311.pyc +0 -0
  295. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-38.pyc +0 -0
  296. package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-39.pyc +0 -0
  297. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-310.pyc +0 -0
  298. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-311.pyc +0 -0
  299. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-38.pyc +0 -0
  300. package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-39.pyc +0 -0
  301. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-310.pyc +0 -0
  302. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-311.pyc +0 -0
  303. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-38.pyc +0 -0
  304. package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-39.pyc +0 -0
  305. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-310.pyc +0 -0
  306. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-311.pyc +0 -0
  307. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-38.pyc +0 -0
  308. package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-39.pyc +0 -0
  309. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-310.pyc +0 -0
  310. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-311.pyc +0 -0
  311. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-38.pyc +0 -0
  312. package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-39.pyc +0 -0
  313. package/src/plugins/runtime/python/proxy/camera_device.py +0 -1732
  314. package/src/plugins/runtime/python/proxy/core_manager.py +0 -126
  315. package/src/plugins/runtime/python/proxy/device_manager.py +0 -197
  316. package/src/plugins/runtime/python/schema.py +0 -99
  317. package/src/plugins/runtime/python/storage.py +0 -353
  318. package/src/plugins/runtime/python/storage_controller.py +0 -102
  319. package/src/plugins/runtime/python/typings.py +0 -195
  320. package/src/plugins/schema.ts +0 -472
  321. package/src/plugins/types.ts +0 -60
  322. package/src/plugins/worker.ts +0 -250
  323. package/src/rpc/index.ts +0 -149
  324. package/src/rpc/namespaces.ts +0 -79
  325. package/src/rpc/server.ts +0 -422
  326. package/src/rpc/types.ts +0 -119
  327. package/src/rpc/utils.ts +0 -16
  328. package/src/services/config/constants.ts +0 -47
  329. package/src/services/config/defaults.ts +0 -57
  330. package/src/services/config/index.ts +0 -744
  331. package/src/services/config/types.ts +0 -211
  332. package/src/services/logger/index.ts +0 -96
  333. package/src/types.ts +0 -47
  334. package/src/utils/path.ts +0 -16
  335. package/src/utils/pythonInstaller.ts +0 -597
  336. package/tsconfig.json +0 -37
  337. package/updates.config.js +0 -3
  338. /package/dist/interface/assets/{@xterm.DYP7pi_n.0.0.50-internal.0.css → @xterm.DYP7pi_n.0.0.50-internal.1.css} +0 -0
  339. /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.1.css} +0 -0
  340. /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.1.css} +0 -0
  341. /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.1.css} +0 -0
  342. /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.1.css} +0 -0
  343. /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.1.css} +0 -0
  344. /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.1.css} +0 -0
  345. /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.1.css} +0 -0
  346. /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.1.css} +0 -0
  347. /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.1.css} +0 -0
  348. /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.1.css} +0 -0
  349. /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.1.css} +0 -0
  350. /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.1.css} +0 -0
  351. /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.1.png} +0 -0
  352. /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.1.png} +0 -0
  353. /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.1.png} +0 -0
  354. /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.1.css} +0 -0
  355. /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.1.js} +0 -0
  356. /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.1.js} +0 -0
  357. /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.1.js} +0 -0
  358. /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.1.js} +0 -0
  359. /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.1.js} +0 -0
  360. /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  361. /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.1.js} +0 -0
  362. /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.1.js} +0 -0
  363. /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.1.js} +0 -0
  364. /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.1.js} +0 -0
  365. /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.1.js} +0 -0
  366. /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.1.js} +0 -0
  367. /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.DIUBesyz.0.0.50-internal.1.js} +0 -0
  368. /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.1.js} +0 -0
  369. /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  370. /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.1.js} +0 -0
  371. /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.1.js} +0 -0
  372. /package/dist/interface/js/{engine.io-parser.BiEtp6m2.0.0.50-internal.0.js → engine.io-parser.BiEtp6m2.0.0.50-internal.1.js} +0 -0
  373. /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.1.js} +0 -0
  374. /package/dist/interface/js/{ev-emitter.X5f1qa-c.0.0.50-internal.0.js → ev-emitter.X5f1qa-c.0.0.50-internal.1.js} +0 -0
  375. /package/dist/interface/js/{get-size.D1dS-IaP.0.0.50-internal.0.js → get-size.D1dS-IaP.0.0.50-internal.1.js} +0 -0
  376. /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  377. /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.1.js} +0 -0
  378. /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  379. /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.1.js} +0 -0
  380. /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.1.js} +0 -0
  381. /package/dist/interface/js/{react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.1.js} +0 -0
  382. /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.1.js} +0 -0
  383. /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.1.js} +0 -0
  384. /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.1.js} +0 -0
  385. /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.1.js} +0 -0
  386. /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
  387. /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.1.js} +0 -0
@@ -1,744 +0,0 @@
1
- import 'reflect-metadata';
2
-
3
- import { getUserHomeDir, IS_DEV, IS_DOCKER, IS_ELECTRON, IS_HA, isEqual, isFfmpegInstalled, mergeWith, structuredClone } from '@camera.ui/common';
4
- import { ffmpegPath, isFFmpegAvailable } from '@camera.ui/ffmpeg';
5
- import { go2rtcPath } from '@camera.ui/go2rtc';
6
- import { natsServerPath } from '@camera.ui/nats';
7
- import { config } from 'dotenv';
8
- import { emptyDirSync, ensureDirSync, ensureFileSync, pathExistsSync, readJsonSync, removeSync, writeJsonSync } from 'fs-extra/esm';
9
- import { dump, load } from 'js-yaml';
10
- import { randomBytes } from 'node:crypto';
11
- import { readFileSync, writeFileSync } from 'node:fs';
12
- import { createRequire } from 'node:module';
13
- import { arch, platform, release, tmpdir, type } from 'node:os';
14
- import { dirname, join, resolve } from 'node:path';
15
- import { fileURLToPath } from 'node:url';
16
- import { container } from 'tsyringe';
17
- import { ZodError } from 'zod';
18
-
19
- import { patchConfigSchema } from '../../api/schemas/config.schema.js';
20
- import { patchGo2RtcSchema } from '../../api/schemas/go2rtc.schema.js';
21
- import { CertificateGeneration } from '../../api/utils/cert.js';
22
- import { HOST_CERT_FILENAME, HOST_KEY_FILENAME, OLD_ROOT_CERT_FILENAME, OLD_ROOT_KEY_FILENAME, ROOT_CERT_FILENAME } from '../../api/utils/constants.js';
23
- import { DEFAULT_CONFIG, DEFAULT_GO2RTC_CONFIG } from './constants.js';
24
-
25
- import type { LoggerOptions } from '@camera.ui/common/logger';
26
- import type { ProcInfo } from '../../api/database/checks.js';
27
- import type { Database } from '../../api/database/index.js';
28
- import type { Go2RtcApi } from '../../api/go2rtc/index.js';
29
- import type { DeepPartial } from '../../types.js';
30
- import type { LoggerService } from '../logger/index.js';
31
- import type { EnvironmentInfo, Go2RtcConfig, IConfig, Secrets, SSLConfig } from './types.js';
32
-
33
- const __require = createRequire(import.meta.url);
34
- const __filename = fileURLToPath(import.meta.url);
35
- const __dirname = dirname(__filename);
36
-
37
- const packageJson = __require('../../../package.json');
38
-
39
- config({ path: resolve(join(__dirname, '../../../../.env')) });
40
-
41
- export class ConfigService {
42
- static get VERSION(): string {
43
- const pjson = readJsonSync(resolve(join(__dirname, '../../../package.json')));
44
- return pjson.version;
45
- }
46
-
47
- static get ENVIRONMENT(): EnvironmentInfo {
48
- return {
49
- development: IS_DEV,
50
- docker: IS_DOCKER,
51
- electron: IS_ELECTRON,
52
- homeassistant: IS_HA,
53
- };
54
- }
55
-
56
- static readonly NODE_VERSION = process.version;
57
- static readonly MIN_NODE_VERSION = ConfigService.extractVersion(packageJson.engines.node)!;
58
-
59
- // paths
60
- static readonly SERVER_PATH = resolve(join(__dirname, '../../../'));
61
- static readonly INTERFACE_PATH = IS_DEV && !IS_ELECTRON ? join(ConfigService.SERVER_PATH, 'dist', 'interface') : join(ConfigService.SERVER_PATH, '..', 'interface');
62
-
63
- private logger: LoggerService;
64
- private _config!: IConfig;
65
- private _go2rtcConfig!: Go2RtcConfig;
66
- private _ssl!: SSLConfig;
67
-
68
- // database
69
- readonly SECRETS!: Secrets;
70
-
71
- // dirs
72
- readonly HOME_PATH: string;
73
- readonly STORAGE_PATH: string;
74
- readonly LOGS_PATH: string;
75
- readonly PIDS_FILE: string;
76
- readonly DATABASE_PATH: string;
77
- readonly TOKENS_PATH: string;
78
- readonly USERS_STORAGE_PATH: string;
79
- readonly TMP_PATH: string;
80
-
81
- readonly PLUGINS_STORAGE_PATH: string;
82
- readonly PLUGINS_INSTALL_PATH: string;
83
-
84
- // files
85
- readonly REPORTS_FILE: string;
86
- readonly LOG_FILE: string;
87
- readonly CONFIG_FILE: string;
88
- readonly SECRETS_FILE: string;
89
- readonly GO2RTC_BINARY: string;
90
- readonly GO2RTC_CONFIG_FILE: string;
91
- readonly NATS_BINARY: string;
92
- readonly BACKUP_INFO_FILE: string;
93
-
94
- // server
95
- readonly UI_PORT = parseInt(process.env.CAMERA_UI_DEV_UI_PORT!); // dotenv
96
- readonly WS_PORT = parseInt(process.env.CAMERA_UI_DEV_WS_PORT!); // dotenv
97
-
98
- // certs
99
- get ssl(): SSLConfig {
100
- return this._ssl;
101
- }
102
-
103
- // Proxy for main config to track nested changes
104
- get config(): IConfig {
105
- return this._config;
106
- }
107
-
108
- set config(newConfig: IConfig) {
109
- this.validateAndSetConfig(newConfig);
110
- }
111
-
112
- // Proxy for go2rtc config to track nested changes
113
- get go2rtcConfig(): Go2RtcConfig {
114
- return this._go2rtcConfig;
115
- }
116
-
117
- set go2rtcConfig(newConfig: Go2RtcConfig) {
118
- this.validateAndSetGo2RtcConfig(newConfig);
119
- }
120
-
121
- get processes(): ProcInfo[] {
122
- try {
123
- return JSON.parse(readFileSync(this.PIDS_FILE, 'utf-8'));
124
- } catch {
125
- return [];
126
- }
127
- }
128
-
129
- set processes(pids: ProcInfo[]) {
130
- writeFileSync(this.PIDS_FILE, JSON.stringify(pids));
131
- }
132
-
133
- get loggerOptions(): LoggerOptions {
134
- return {
135
- prefix: 'camera.ui',
136
- suffix: undefined,
137
- disableTimestamps: this._config.logger?.disableTimestamps === true,
138
- debugEnabled: this._config.logger?.level === 'debug' || this._config.logger?.level === 'trace',
139
- traceEnabled: this._config.logger?.level === 'trace',
140
- };
141
- }
142
-
143
- get go2rtcLoggerOptions(): LoggerOptions {
144
- return {
145
- prefix: 'Go2RTC',
146
- suffix: undefined,
147
- disableTimestamps: this._config.logger?.disableTimestamps === true,
148
- debugEnabled: this._go2rtcConfig.log?.level === 'debug' || this._go2rtcConfig.log?.level === 'trace',
149
- traceEnabled: this._go2rtcConfig.log?.level === 'trace',
150
- };
151
- }
152
-
153
- constructor(homePath?: string) {
154
- container.registerInstance('configService', this);
155
-
156
- this.logger = container.resolve<LoggerService>('logger');
157
-
158
- if (!homePath) {
159
- if (IS_DEV) {
160
- this.HOME_PATH = join(__dirname, '..', '..', '..', '..', '.camera.ui');
161
- } else {
162
- this.HOME_PATH = join(getUserHomeDir(), '.camera.ui');
163
- }
164
- } else {
165
- this.HOME_PATH = resolve(homePath);
166
- }
167
-
168
- this.TMP_PATH = join(tmpdir(), '.camera.ui');
169
- this.STORAGE_PATH = join(this.HOME_PATH, 'volume');
170
- this.LOGS_PATH = join(this.STORAGE_PATH, 'logs');
171
- this.PIDS_FILE = join(this.STORAGE_PATH, 'camera.ui.pids');
172
- this.REPORTS_FILE = join(this.STORAGE_PATH, 'camera.ui.report.yaml');
173
- this.GO2RTC_CONFIG_FILE = join(this.STORAGE_PATH, 'go2rtc.yaml');
174
- this.CONFIG_FILE = join(this.STORAGE_PATH, 'camera.ui.yaml');
175
- this.BACKUP_INFO_FILE = join(this.STORAGE_PATH, 'camera.ui.backup.json');
176
- this.DATABASE_PATH = join(this.STORAGE_PATH, 'database');
177
- this.TOKENS_PATH = join(this.STORAGE_PATH, 'tokens');
178
- this.USERS_STORAGE_PATH = join(this.STORAGE_PATH, 'users');
179
-
180
- this.PLUGINS_STORAGE_PATH = join(this.STORAGE_PATH, 'plugins', 'storage');
181
- this.PLUGINS_INSTALL_PATH = join(this.HOME_PATH, 'plugins');
182
-
183
- this.GO2RTC_BINARY = go2rtcPath().replace('app.asar', 'app.asar.unpacked');
184
- this.NATS_BINARY = natsServerPath().replace('app.asar', 'app.asar.unpacked');
185
-
186
- this.SECRETS_FILE = join(this.STORAGE_PATH, '.camera.ui.secrets');
187
- this.LOG_FILE = join(this.STORAGE_PATH, 'camera.ui.log');
188
- this.SECRETS = this.updateSecrets();
189
-
190
- this.createDirs();
191
- this.read();
192
- this.logStart();
193
- }
194
-
195
- public static extractVersion(str: string): string | null {
196
- const regex = /(?:[>=^]*)(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.]+)?)/;
197
- const matches = regex.exec(str);
198
-
199
- if (matches?.[1]) {
200
- return matches[1];
201
- } else {
202
- return null;
203
- }
204
- }
205
-
206
- /**
207
- * Updates the main configuration and writes it to disk
208
- * @param newConfig Partial config to merge with existing
209
- */
210
- public writeConfig(newConfig?: DeepPartial<IConfig>): void {
211
- const oldSSL = structuredClone(this._config.ssl);
212
-
213
- if (newConfig) {
214
- this.mergeAndValidate(this._config, newConfig);
215
- }
216
-
217
- const newSSL = structuredClone(this._config.ssl);
218
- const sslChanged = isEqual(oldSSL, newSSL, true) === false;
219
- const certFile = join(this.STORAGE_PATH, HOST_CERT_FILENAME);
220
- const keyFile = join(this.STORAGE_PATH, HOST_KEY_FILENAME);
221
-
222
- if (sslChanged) {
223
- removeSync(certFile);
224
- removeSync(keyFile);
225
- this._ssl = this.readSSL();
226
- }
227
-
228
- writeFileSync(this.CONFIG_FILE, dump(this._config, { lineWidth: -1, noRefs: true }));
229
- }
230
-
231
- /**
232
- * Common implementation for both file and API-based go2rtc config updates
233
- * @param newConfig Partial config to merge with existing
234
- * @param writeMethod Method to use for writing the config (file or API)
235
- */
236
- private async updateGo2RtcConfigCommon(newConfig?: DeepPartial<Go2RtcConfig>, writeMethod: 'file' | 'api' = 'file'): Promise<void> {
237
- if (newConfig) {
238
- this.mergeAndValidate(this._go2rtcConfig, newConfig);
239
- }
240
-
241
- // Handle empty streams object
242
- if (this._go2rtcConfig.streams && Object.keys(this._go2rtcConfig.streams).length === 0) {
243
- delete this._go2rtcConfig.streams;
244
- }
245
-
246
- // Use the appropriate write method
247
- if (writeMethod === 'api') {
248
- const go2rtcApi = container.resolve<Go2RtcApi>('go2rtcApi');
249
- await go2rtcApi.configApi.rewriteConfig(this._go2rtcConfig);
250
- } else {
251
- writeFileSync(this.GO2RTC_CONFIG_FILE, dump(this._go2rtcConfig, { lineWidth: -1, noRefs: true }));
252
- }
253
- }
254
-
255
- /**
256
- * Write Go2RTC config to file
257
- */
258
- public async writeGo2RtcConfigFile(newConfig?: DeepPartial<Go2RtcConfig>): Promise<void> {
259
- await this.updateGo2RtcConfigCommon(newConfig, 'file');
260
- }
261
-
262
- /**
263
- * Write Go2RTC config using the API
264
- */
265
- public async writeGo2RtcConfigApi(newConfig?: DeepPartial<Go2RtcConfig>): Promise<void> {
266
- await this.updateGo2RtcConfigCommon(newConfig, 'api');
267
- }
268
-
269
- /**
270
- * Merge Go2RTC config from file and update database
271
- */
272
- public async mergeGo2RtcConfig(): Promise<void> {
273
- // refresh stored go2rtc config and also update database
274
- const fileConfig = load(readFileSync(this.GO2RTC_CONFIG_FILE, 'utf-8')) as Go2RtcConfig;
275
- this.validateAndSetGo2RtcConfig(fileConfig);
276
-
277
- const db: Database = container.resolve<Database>('dbs');
278
- await db?.updateCameras();
279
- }
280
-
281
- /**
282
- * Update WebRTC filter settings
283
- */
284
- public async updateGo2RtcWebRtcFilter(serverAddresses: string[] = [], oldAddresses: string[] = [], api?: boolean): Promise<void> {
285
- const webRtcConfig = this._go2rtcConfig.webrtc;
286
-
287
- // Initialize filters object if it doesn't exist
288
- webRtcConfig.filters ??= {};
289
-
290
- // Initialize candidates array if it doesn't exist
291
- webRtcConfig.filters.candidates ??= [];
292
-
293
- // Initialize IPs array if it doesn't exist
294
- webRtcConfig.filters.ips ??= [];
295
-
296
- // Remove old addresses from filters
297
- if (oldAddresses.length) {
298
- webRtcConfig.filters.candidates = webRtcConfig.filters.candidates.filter((address) => !oldAddresses.includes(address));
299
- webRtcConfig.filters.ips = webRtcConfig.filters.ips.filter((address) => !oldAddresses.includes(address));
300
- }
301
-
302
- // Add new server addresses to filters
303
- if (serverAddresses.length) {
304
- for (const address of serverAddresses) {
305
- if (!webRtcConfig.filters.candidates.includes(address)) {
306
- webRtcConfig.filters.candidates.push(address);
307
- }
308
-
309
- if (!webRtcConfig.filters.ips.includes(address)) {
310
- webRtcConfig.filters.ips.push(address);
311
- }
312
- }
313
- } else {
314
- // Clear filters if no addresses are provided
315
- webRtcConfig.filters.candidates = [];
316
- webRtcConfig.filters.ips = [];
317
- }
318
-
319
- // Clean up empty filter arrays
320
- this.cleanupWebRtcFilters(webRtcConfig);
321
-
322
- // Write the updated config
323
- if (api) {
324
- await this.writeGo2RtcConfigApi({ webrtc: webRtcConfig });
325
- } else {
326
- await this.writeGo2RtcConfigFile({ webrtc: webRtcConfig });
327
- }
328
- }
329
-
330
- /**
331
- * Reset camera.ui
332
- */
333
- public async reset(): Promise<void> {
334
- this.logger.attention('Resetting camera.ui...');
335
-
336
- // Cleanup
337
- this.safetyEmptyDir(this.STORAGE_PATH); // .camera.ui/volume
338
- // this.safetyEmptyDir(resolve(this.HOME_PATH, 'python')); // .camera.ui/python
339
- this.safetyEmptyDir(this.PLUGINS_INSTALL_PATH); // .camera.ui/plugins
340
- }
341
-
342
- /**
343
- * Clean up empty WebRTC filter arrays
344
- */
345
- private cleanupWebRtcFilters(webRtcConfig: any): void {
346
- // Remove empty filter arrays
347
- for (const key of ['candidates', 'ips', 'networks', 'interfaces', 'udp_ports']) {
348
- if (!webRtcConfig.filters[key]?.length) {
349
- delete webRtcConfig.filters[key];
350
- }
351
- }
352
-
353
- // Remove empty filters object
354
- if (Object.keys(webRtcConfig.filters).length === 0) {
355
- delete webRtcConfig.filters;
356
- }
357
- }
358
-
359
- public addProcess(proc: ProcInfo): ProcInfo {
360
- const processes = this.processes;
361
- processes.push(proc);
362
- writeFileSync(this.PIDS_FILE, JSON.stringify(processes));
363
- return proc;
364
- }
365
-
366
- public removeProcessByPID(pid?: number): void {
367
- if (!pid) {
368
- return;
369
- }
370
-
371
- const processes = this.processes;
372
- const index = processes.findIndex((process) => process.pid === pid);
373
-
374
- if (index > -1) {
375
- processes.splice(index, 1);
376
- writeFileSync(this.PIDS_FILE, JSON.stringify(processes));
377
- }
378
- }
379
-
380
- public go2rtcAddress(mod: 'api' | 'rtsp' | 'onvif' | 'srtp' | 'rtmp' | 'webrtc' | 'ws' = 'api'): string {
381
- let go2rtcPort: number;
382
- let protocol: string | undefined;
383
-
384
- const isTls = this._go2rtcConfig.api.listen === '';
385
-
386
- if (mod === 'api' || mod === 'ws' || mod === 'onvif') {
387
- const listen = isTls ? this._go2rtcConfig.api.tls_listen : this._go2rtcConfig.api.listen;
388
- go2rtcPort = parseInt(listen.split(':')[1], 10);
389
- } else {
390
- go2rtcPort = parseInt(this._go2rtcConfig[mod].listen.split(':')[1], 10);
391
- }
392
-
393
- if (!protocol) {
394
- switch (mod) {
395
- case 'api':
396
- case 'webrtc':
397
- protocol = isTls ? 'https' : 'http';
398
- break;
399
- case 'ws':
400
- protocol = isTls ? 'wss' : 'ws';
401
- break;
402
- case 'rtsp':
403
- protocol = 'rtsp';
404
- break;
405
- case 'onvif':
406
- protocol = 'onvif';
407
- break;
408
- case 'srtp':
409
- protocol = 'srtp';
410
- break;
411
- case 'rtmp':
412
- protocol = 'rtmp';
413
- break;
414
- default:
415
- protocol = 'http';
416
- break;
417
- }
418
- }
419
-
420
- return `${protocol}://127.0.0.1:${go2rtcPort}`;
421
- }
422
-
423
- public cameraURLExists(cameraUrl: string): boolean {
424
- const url = new URL(cameraUrl);
425
- const host = url.host;
426
- const port = url.port;
427
-
428
- const sources = this._go2rtcConfig.streams ?? {};
429
- const urls = Object.values(sources)
430
- .filter((source) => source)
431
- .map((source) => source!)
432
- .flat();
433
-
434
- return urls.some((url) => {
435
- if (!host) {
436
- return host === url;
437
- }
438
-
439
- const u = new URL(url);
440
- return u.host === host && u.port === port;
441
- });
442
- }
443
-
444
- /**
445
- * Validate and set the main config, handling Zod validation
446
- */
447
- private validateAndSetConfig(newConfig: IConfig): void {
448
- try {
449
- const config = patchConfigSchema.parse(newConfig);
450
- this._config = config;
451
- } catch (error: any) {
452
- if (error instanceof ZodError) {
453
- this.logger.error('Invalid camera.ui config!');
454
- throw error;
455
- }
456
-
457
- this.logger.error('Failed to parse camera.ui config!');
458
- throw error;
459
- }
460
- }
461
-
462
- /**
463
- * Validate and set the Go2RTC config, handling Zod validation
464
- */
465
- private validateAndSetGo2RtcConfig(newConfig: Go2RtcConfig): void {
466
- // Handle null streams
467
- if (!newConfig.streams || newConfig.streams === null) {
468
- delete newConfig.streams;
469
- }
470
-
471
- try {
472
- // Validate using Zod schema
473
- const config = patchGo2RtcSchema.parse(newConfig);
474
-
475
- // Apply restrictions and ensure correct configuration
476
- this._go2rtcConfig = this.updateGo2RtcConfig(config);
477
- } catch (error: any) {
478
- if (error instanceof ZodError) {
479
- this.logger.error('Invalid go2rtc config!');
480
- throw error;
481
- }
482
-
483
- this.logger.error('Failed to parse go2rtc config!');
484
- throw error;
485
- }
486
- }
487
-
488
- /**
489
- * Merge a partial config with the existing config and validate it
490
- */
491
- private mergeAndValidate<T>(target: T, source: DeepPartial<T>): void {
492
- mergeWith(target, source, (sourceVal: any, targetVal: any) => {
493
- if (Array.isArray(sourceVal)) {
494
- return targetVal;
495
- }
496
- });
497
- }
498
-
499
- private read() {
500
- this.updateConfig();
501
- this.writeConfig();
502
- this.writeGo2RtcConfigFile();
503
- }
504
-
505
- private defaultConfig(): IConfig {
506
- const defaultConfig = structuredClone(DEFAULT_CONFIG);
507
- defaultConfig.ssl.certFile = join(this.STORAGE_PATH, HOST_CERT_FILENAME);
508
- defaultConfig.ssl.keyFile = join(this.STORAGE_PATH, HOST_KEY_FILENAME);
509
- defaultConfig.ssl.caFile = join(this.STORAGE_PATH, ROOT_CERT_FILENAME);
510
- return patchConfigSchema.parse(defaultConfig);
511
- }
512
-
513
- private defaultGo2RtcConfig(): Go2RtcConfig {
514
- const defaultConfig = structuredClone(DEFAULT_GO2RTC_CONFIG);
515
- defaultConfig.api.tls_cert = join(this.STORAGE_PATH, HOST_CERT_FILENAME);
516
- defaultConfig.api.tls_key = join(this.STORAGE_PATH, HOST_KEY_FILENAME);
517
- defaultConfig.api.tls_ca = join(this.STORAGE_PATH, ROOT_CERT_FILENAME);
518
- return patchGo2RtcSchema.parse(defaultConfig);
519
- }
520
-
521
- private readConfig(): IConfig {
522
- let config = this.defaultConfig();
523
-
524
- if (pathExistsSync(this.CONFIG_FILE)) {
525
- let configFileData = load(readFileSync(this.CONFIG_FILE, 'utf-8')) as IConfig;
526
- configFileData = this.cleanupConfig(config, configFileData);
527
-
528
- config = mergeWith(this.defaultConfig(), configFileData, (source: any, target: any) => {
529
- if (Array.isArray(source)) {
530
- return target;
531
- }
532
- });
533
-
534
- // Update legacy cert paths
535
- if (config.ssl.certFile === join(this.STORAGE_PATH, OLD_ROOT_CERT_FILENAME)) {
536
- config.ssl.certFile = join(this.STORAGE_PATH, HOST_CERT_FILENAME);
537
- }
538
-
539
- if (config.ssl.keyFile === join(this.STORAGE_PATH, OLD_ROOT_KEY_FILENAME)) {
540
- config.ssl.keyFile = join(this.STORAGE_PATH, HOST_KEY_FILENAME);
541
- }
542
- }
543
-
544
- return config;
545
- }
546
-
547
- private readGo2RtcConfig(): Go2RtcConfig {
548
- let go2rtcConfig = this.defaultGo2RtcConfig();
549
-
550
- if (pathExistsSync(this.GO2RTC_CONFIG_FILE)) {
551
- const configFileData = load(readFileSync(this.GO2RTC_CONFIG_FILE, 'utf-8')) as Go2RtcConfig;
552
-
553
- go2rtcConfig = mergeWith(go2rtcConfig, configFileData, (source: any, target: any) => {
554
- if (Array.isArray(source)) {
555
- return target;
556
- }
557
- });
558
- }
559
-
560
- return this.updateGo2RtcConfig(go2rtcConfig);
561
- }
562
-
563
- private cleanupConfig(config: IConfig, newConfig: IConfig): IConfig {
564
- for (const key in newConfig) {
565
- if ((config as any)[key] === undefined) {
566
- delete (newConfig as any)[key];
567
- } else if (Object.keys((newConfig as any)[key]).length > 0) {
568
- const keys = Object.keys((newConfig as any)[key]);
569
- for (const k of keys) {
570
- if ((config as any)[key][k] === undefined) {
571
- delete (newConfig as any)[key][k];
572
- }
573
- }
574
- }
575
- }
576
-
577
- return newConfig;
578
- }
579
-
580
- private updateConfig(): void {
581
- // validate and setup configs
582
- this.validateAndSetConfig(this.readConfig());
583
- this.validateAndSetGo2RtcConfig(this.readGo2RtcConfig());
584
- this._ssl = this.readSSL();
585
-
586
- // setup logger
587
- this.logger.debugEnabled = this._config.logger?.level === 'debug' || this._config.logger?.level === 'trace';
588
- this.logger.traceEnabled = this._config.logger?.level === 'trace';
589
- this.logger.disableTimestamps = this._config.logger?.disableTimestamps === true;
590
- }
591
-
592
- private updateGo2RtcConfig(go2rtcConfig: Go2RtcConfig): Go2RtcConfig {
593
- const config = structuredClone(go2rtcConfig);
594
-
595
- // Validate api
596
- config.api.listen = '';
597
- config.api.origin = '*';
598
- config.api.tls_cert = this.config.ssl.certFile;
599
- config.api.tls_key = this.config.ssl.keyFile;
600
- config.api.tls_ca = this.config.ssl.caFile;
601
-
602
- // Validate ffmpeg
603
- if (!isFfmpegInstalled(config.ffmpeg.bin)) {
604
- config.ffmpeg.bin = !isFFmpegAvailable() ? (platform() === 'win32' ? 'ffmpeg.exe' : 'ffmpeg') : ffmpegPath().replace('app.asar', 'app.asar.unpacked');
605
- }
606
-
607
- // Validate webrtc
608
-
609
- // Initialize filters if needed
610
- config.webrtc.filters ??= {};
611
-
612
- // Clean up configuration
613
- if (!config.streams) {
614
- delete config.streams;
615
- }
616
-
617
- if (!config.webrtc.candidates?.length) {
618
- delete config.webrtc.candidates;
619
- }
620
-
621
- this.cleanupWebRtcFilters(config.webrtc);
622
-
623
- return config;
624
- }
625
-
626
- private readSSL(): SSLConfig {
627
- const { cert, key, ca } = CertificateGeneration.generateCert();
628
-
629
- return {
630
- cert: Buffer.from(cert),
631
- key: Buffer.from(key),
632
- ca: Buffer.from(ca),
633
- };
634
- }
635
-
636
- private updateSecrets(): Secrets {
637
- const createSecrets = (): Secrets => {
638
- const secrets: Secrets = {
639
- jwtAccessKey: randomBytes(32).toString('hex'),
640
- jwtRefreshKey: randomBytes(32).toString('hex'),
641
- };
642
-
643
- writeJsonSync(this.SECRETS_FILE, secrets, { spaces: 2 });
644
-
645
- return secrets;
646
- };
647
-
648
- if (pathExistsSync(this.SECRETS_FILE)) {
649
- try {
650
- const secrets: Secrets = readJsonSync(this.SECRETS_FILE);
651
-
652
- if (!secrets.jwtAccessKey || !secrets.jwtRefreshKey) {
653
- return createSecrets();
654
- } else {
655
- return secrets;
656
- }
657
- } catch {
658
- return createSecrets();
659
- }
660
- } else {
661
- return createSecrets();
662
- }
663
- }
664
-
665
- private async createDirs(): Promise<void> {
666
- this.safetyEmptyDir(this.TMP_PATH);
667
- this.safetyEnsureDir(this.HOME_PATH);
668
- this.safetyEnsureDir(this.LOGS_PATH);
669
- this.safetyEnsureDir(this.STORAGE_PATH);
670
- this.safetyEnsureDir(this.USERS_STORAGE_PATH);
671
- this.safetyEnsureDir(this.PLUGINS_STORAGE_PATH);
672
- this.safetyEnsureDir(this.PLUGINS_INSTALL_PATH);
673
- this.safetyEnsureDir(this.DATABASE_PATH);
674
- this.safetyEnsureDir(this.TOKENS_PATH);
675
- this.safetyEnsureFile(this.CONFIG_FILE);
676
- this.safetyEnsureFile(this.GO2RTC_CONFIG_FILE);
677
- this.safetyEnsureFile(this.SECRETS_FILE);
678
- this.safetyEnsureFile(this.LOG_FILE);
679
- this.safetyEnsureFile(this.REPORTS_FILE);
680
- this.safetyEnsureFile(this.PIDS_FILE);
681
- }
682
-
683
- private safetyEnsureDir(dir: string): void {
684
- try {
685
- ensureDirSync(dir);
686
- } catch (error: any) {
687
- if (error.code !== 'EACCES') {
688
- this.logger.warn(`Failed to create directory: ${dir}`);
689
- this.logger.warn(`Please make sure the user "${process.env.USER}" has the correct permissions`);
690
- this.logger.warn(`EXAMPLE: sudo chown -R ${process.env.USER}:${process.env.USER} ${dir}`);
691
- }
692
-
693
- throw error;
694
- }
695
- }
696
-
697
- private safetyEmptyDir(dir: string): void {
698
- try {
699
- emptyDirSync(dir);
700
- } catch (error: any) {
701
- if (error.code !== 'EACCES') {
702
- this.logger.warn(`Failed to empty directory: ${dir}`);
703
- this.logger.warn(`Please make sure the user "${process.env.USER}" has the correct permissions`);
704
- this.logger.warn(`EXAMPLE: sudo chown -R ${process.env.USER}:${process.env.USER} ${dir}`);
705
- }
706
-
707
- throw error;
708
- }
709
- }
710
-
711
- private safetyEnsureFile(file: string): void {
712
- try {
713
- ensureFileSync(file);
714
- } catch (error: any) {
715
- if (error.code !== 'EACCES') {
716
- this.logger.warn(`Failed to create file: ${file}`);
717
- this.logger.warn(`Please make sure the user "${process.env.USER}" has the correct permissions`);
718
- this.logger.warn(`EXAMPLE: sudo chown ${process.env.USER}:${process.env.USER} ${file}`);
719
- }
720
-
721
- throw error;
722
- }
723
- }
724
-
725
- private logStart(): void {
726
- this.logger.log('---');
727
- this.logger.log(`Initializing camera.ui with PID: ${process.pid}`);
728
- this.logger.log('---');
729
- this.logger.log(`camera.ui Home Path: ${this.HOME_PATH}`);
730
- this.logger.log(`camera.ui Storage Path: ${this.STORAGE_PATH}`);
731
- this.logger.log(`camera.ui Config Path: ${this.CONFIG_FILE}`);
732
- this.logger.log(`Go2RTC Binary Path: ${this.GO2RTC_BINARY}`);
733
- this.logger.log(`Go2RTC Config Path ${this.GO2RTC_CONFIG_FILE}`);
734
- this.logger.log(`Nats Binary Path: ${this.NATS_BINARY}`);
735
- this.logger.log(`Plugins Storage Path: ${this.PLUGINS_STORAGE_PATH}`);
736
- this.logger.log(`Plugins Install Path: ${this.PLUGINS_INSTALL_PATH}`);
737
- this.logger.log('---');
738
- this.logger.log(`OS: ${type()} ${release()} ${arch()}`);
739
- this.logger.log(`Node.js ${process.version} ${process.execPath}`);
740
- this.logger.log(`User: ${process.env.USER ?? process.env.USERNAME}`);
741
- this.logger.log('Environment:', ConfigService.ENVIRONMENT);
742
- this.logger.log('---');
743
- }
744
- }