@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,1029 +0,0 @@
1
- import { createSourceName, orderBy } from '@camera.ui/common/utils';
2
- import { createReadStream, truncate } from 'node:fs';
3
- import { Readable } from 'node:stream';
4
- import { container } from 'tsyringe';
5
-
6
- import { createCameraSchema } from '../schemas/cameras.schema.js';
7
- import { CamerasService } from '../services/cameras.service.js';
8
- import { PluginsService } from '../services/plugins.service.js';
9
-
10
- import type { CameraInputSettings, CameraRole, Extension, ProbeConfig } from '@camera.ui/types';
11
- import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
12
- import type { CameraUiAPI } from '../../api.js';
13
- import type { ProxyServer } from '../../rpc/index.js';
14
- import type { ConfigService } from '../../services/config/index.js';
15
- import type { DBCamera } from '../database/types.js';
16
- import type { Go2RtcApi } from '../go2rtc/index.js';
17
- import type { OnvifSource } from '../go2rtc/types.js';
18
- import type {
19
- AuthLoginRequest,
20
- CameraDiscoverQueryRequest,
21
- CameraPairRequest,
22
- CameraProbeSourceQueryRequest,
23
- CameraSnapshotQueryRequest,
24
- CameraSourceParamsRequest,
25
- CameraZoneInsertPatchRequest,
26
- CamerasExtensionsParamsRequest,
27
- CamerasExtensionsRequest,
28
- CamerasInsertRequest,
29
- CamerasParamsIdRequest,
30
- CamerasParamsRequest,
31
- CamerasPatchRequest,
32
- CamerasPreviewRequest,
33
- CamerasStreamRequest,
34
- PaginationRequest,
35
- PluginExtension,
36
- PluginExtensionConfig,
37
- StoragePatchRequest,
38
- StorageSetRequest,
39
- StorageSubmitRequest,
40
- } from '../types/index.js';
41
-
42
- export class CamerasController {
43
- private app: FastifyInstance;
44
- private api: CameraUiAPI;
45
- private go2rtcApi: Go2RtcApi;
46
- private configService: ConfigService;
47
- private service: CamerasService;
48
- private pluginsService: PluginsService;
49
- private proxyServer: ProxyServer;
50
-
51
- constructor(app: FastifyInstance) {
52
- this.app = app;
53
- this.service = new CamerasService();
54
- this.pluginsService = new PluginsService();
55
-
56
- this.api = container.resolve<CameraUiAPI>('api');
57
- this.configService = container.resolve<ConfigService>('configService');
58
- this.proxyServer = container.resolve<ProxyServer>('proxy');
59
- this.go2rtcApi = container.resolve<Go2RtcApi>('go2rtcApi');
60
- }
61
-
62
- public getByName(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest>, reply: FastifyReply): FastifyReply {
63
- try {
64
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
65
-
66
- if (!camera) {
67
- return reply.code(404).send({
68
- statusCode: 404,
69
- message: 'Camera not exists',
70
- });
71
- }
72
-
73
- return reply.code(200).send(camera);
74
- } catch (error: any) {
75
- return reply.code(500).send({
76
- statusCode: 500,
77
- message: error.message,
78
- });
79
- }
80
- }
81
-
82
- public getZones(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest>, reply: FastifyReply): FastifyReply {
83
- try {
84
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
85
-
86
- if (!camera) {
87
- return reply.code(404).send({
88
- statusCode: 404,
89
- message: 'Camera not exists',
90
- });
91
- }
92
-
93
- return reply.code(200).send(camera.detectionZones);
94
- } catch (error: any) {
95
- return reply.code(500).send({
96
- statusCode: 500,
97
- message: error.message,
98
- });
99
- }
100
- }
101
-
102
- public async patchZones(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest & CameraZoneInsertPatchRequest>, reply: FastifyReply): Promise<FastifyReply> {
103
- try {
104
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
105
-
106
- if (!camera) {
107
- return reply.code(404).send({
108
- statusCode: 404,
109
- message: 'Camera not exists',
110
- });
111
- }
112
-
113
- const newZone = await this.service.patchZones(req.params.cameraname, req.body);
114
-
115
- return reply.code(200).send(newZone);
116
- } catch (error: any) {
117
- return reply.code(500).send({
118
- statusCode: 500,
119
- message: error.message,
120
- });
121
- }
122
- }
123
-
124
- public getExtensionsByName(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest>, reply: FastifyReply): FastifyReply {
125
- try {
126
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
127
-
128
- if (!camera) {
129
- return reply.code(404).send({
130
- statusCode: 404,
131
- message: 'Camera not exists',
132
- });
133
- }
134
-
135
- const cameraExtensions: PluginExtension[] = [];
136
-
137
- camera.extensions.plugins.forEach((extension: Extension) => {
138
- const plugin = this.pluginsService.getPluginByName(extension.name);
139
- if (plugin) {
140
- cameraExtensions.push({
141
- pluginName: plugin.pluginName,
142
- displayName: plugin.displayName,
143
- type: plugin.contract.extensions,
144
- });
145
- }
146
- });
147
-
148
- const ordered = orderBy(cameraExtensions, ['displayName'], ['asc', 'asc']);
149
-
150
- return reply.code(200).send(ordered);
151
- } catch (error: any) {
152
- return reply.code(500).send({
153
- statusCode: 500,
154
- message: error.message,
155
- });
156
- }
157
- }
158
-
159
- public async getExtensionConfigByName(req: FastifyRequest<AuthLoginRequest & CamerasExtensionsParamsRequest>, reply: FastifyReply): Promise<FastifyReply> {
160
- try {
161
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
162
-
163
- if (!camera) {
164
- return reply.code(404).send({
165
- statusCode: 404,
166
- message: 'Camera not exists',
167
- });
168
- }
169
-
170
- const pluginName = this.resolvePluginName(req.params);
171
- const plugin = this.pluginsService.getPluginByName(pluginName);
172
- const cameraDevice = this.api.getCamera(camera._id);
173
-
174
- if (!plugin) {
175
- return reply.code(404).send({
176
- statusCode: 404,
177
- message: 'Plugin not exists',
178
- });
179
- }
180
-
181
- if (!cameraDevice) {
182
- return reply.code(404).send({
183
- statusCode: 404,
184
- message: 'Camera not exists',
185
- });
186
- }
187
-
188
- const proxy = await cameraDevice.storageProxy(plugin.id);
189
- const cameraSchemaConfig = await proxy.getConfig();
190
-
191
- const cameraExtension: PluginExtensionConfig = {
192
- pluginName: plugin.pluginName,
193
- displayName: plugin.displayName,
194
- type: plugin.contract.extensions,
195
- ...cameraSchemaConfig,
196
- };
197
-
198
- return reply.code(200).send(cameraExtension);
199
- } catch (error: any) {
200
- return reply.code(500).send({
201
- statusCode: 500,
202
- message: error.message,
203
- });
204
- }
205
- }
206
-
207
- public async patchExtensionConfigByName(
208
- req: FastifyRequest<AuthLoginRequest & CamerasExtensionsParamsRequest & StoragePatchRequest>,
209
- reply: FastifyReply,
210
- ): Promise<FastifyReply> {
211
- try {
212
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
213
-
214
- if (!camera) {
215
- return reply.code(404).send({
216
- statusCode: 404,
217
- message: 'Camera not exists',
218
- });
219
- }
220
-
221
- const pluginName = this.resolvePluginName(req.params);
222
- const plugin = this.pluginsService.getPluginByName(pluginName);
223
- const cameraDevice = this.api.getCamera(camera._id);
224
-
225
- if (!plugin) {
226
- return reply.code(404).send({
227
- statusCode: 404,
228
- message: 'Plugin not exists',
229
- });
230
- }
231
-
232
- if (!cameraDevice) {
233
- return reply.code(404).send({
234
- statusCode: 404,
235
- message: 'Camera not exists',
236
- });
237
- }
238
-
239
- const proxy = await cameraDevice.storageProxy(plugin.id);
240
- await proxy.setConfig(req.body);
241
-
242
- return reply.code(200).send(req.body);
243
- } catch (error: any) {
244
- return reply.code(500).send({
245
- statusCode: 500,
246
- message: error.message,
247
- });
248
- }
249
- }
250
-
251
- public async setExtensionConfigByName(
252
- req: FastifyRequest<AuthLoginRequest & CamerasExtensionsParamsRequest & StorageSetRequest>,
253
- reply: FastifyReply,
254
- ): Promise<FastifyReply> {
255
- try {
256
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
257
-
258
- if (!camera) {
259
- return reply.code(404).send({
260
- statusCode: 404,
261
- message: 'Camera not exists',
262
- });
263
- }
264
-
265
- const pluginName = this.resolvePluginName(req.params);
266
- const plugin = this.pluginsService.getPluginByName(pluginName);
267
- const cameraDevice = this.api.getCamera(camera._id);
268
-
269
- if (!plugin) {
270
- return reply.code(404).send({
271
- statusCode: 404,
272
- message: 'Plugin not exists',
273
- });
274
- }
275
-
276
- if (!cameraDevice) {
277
- return reply.code(404).send({
278
- statusCode: 404,
279
- message: 'Camera not exists',
280
- });
281
- }
282
-
283
- const proxy = await cameraDevice.storageProxy(plugin.id);
284
- await proxy.setValue<undefined>(req.body.key, undefined);
285
-
286
- return reply.code(204).send();
287
- } catch (error: any) {
288
- return reply.code(500).send({
289
- statusCode: 500,
290
- message: error.message,
291
- });
292
- }
293
- }
294
-
295
- public async submitExtensionConfigByName(
296
- req: FastifyRequest<AuthLoginRequest & CamerasExtensionsParamsRequest & StorageSubmitRequest>,
297
- reply: FastifyReply,
298
- ): Promise<FastifyReply> {
299
- try {
300
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
301
-
302
- if (!camera) {
303
- return reply.code(404).send({
304
- statusCode: 404,
305
- message: 'Camera not exists',
306
- });
307
- }
308
-
309
- const pluginName = this.resolvePluginName(req.params);
310
- const plugin = this.pluginsService.getPluginByName(pluginName);
311
- const cameraDevice = this.api.getCamera(camera._id);
312
-
313
- if (!plugin) {
314
- return reply.code(404).send({
315
- statusCode: 404,
316
- message: 'Plugin not exists',
317
- });
318
- }
319
-
320
- if (!cameraDevice) {
321
- return reply.code(404).send({
322
- statusCode: 404,
323
- message: 'Camera not exists',
324
- });
325
- }
326
-
327
- const proxy = await cameraDevice.storageProxy(plugin.id);
328
- const response = await proxy.submitValue(req.body.key, req.body.payload);
329
-
330
- return reply.code(200).send(response);
331
- } catch (error: any) {
332
- return reply.code(500).send({
333
- statusCode: 500,
334
- message: error.message,
335
- });
336
- }
337
- }
338
-
339
- public async probeSourceByName(
340
- req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest & CameraSourceParamsRequest & CameraProbeSourceQueryRequest>,
341
- reply: FastifyReply,
342
- ): Promise<FastifyReply> {
343
- try {
344
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
345
- const cameraController = this.api.getCamera(camera?._id ?? '');
346
-
347
- if (!camera || !cameraController) {
348
- return reply.code(404).send({
349
- statusCode: 404,
350
- message: 'Camera not exists',
351
- });
352
- }
353
-
354
- const source = cameraController.sources.find((s) => s.name === req.params.sourcename);
355
-
356
- if (!source) {
357
- return reply.code(404).send({
358
- statusCode: 404,
359
- message: 'Source not exists',
360
- });
361
- }
362
-
363
- const probeConfig: ProbeConfig = {
364
- video: req.query.video,
365
- audio: req.query.audio,
366
- microphone: req.query.microphone,
367
- };
368
-
369
- const probe = await this.service.probeCameraSource(camera, source, probeConfig);
370
- return reply.code(200).send({ rtspUrl: source.urls.rtsp.base, onvifUrl: source.urls.rtsp.onvif, probe });
371
- } catch (error: any) {
372
- return reply.code(error.response?.status ?? 500).send({
373
- statusCode: error.response?.status ?? 500,
374
- message: error.response?.statusText ?? error.message,
375
- });
376
- }
377
- }
378
-
379
- public async getSnapshotByName(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest & CameraSnapshotQueryRequest>, reply: FastifyReply): Promise<FastifyReply> {
380
- try {
381
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
382
- const cameraController = this.api.getCamera(camera?._id ?? '');
383
-
384
- if (!camera || !cameraController) {
385
- return reply.code(404).send({
386
- statusCode: 404,
387
- message: 'Camera not exists',
388
- });
389
- }
390
-
391
- const source = cameraController.snapshotSource ?? cameraController.streamSource;
392
- const snapshot = await cameraController.snapshot(source._id, req.query.forceNew);
393
- const base64string = snapshot ? Buffer.from(snapshot).toString('base64') : undefined;
394
-
395
- reply.header('Content-Type', 'image/jpeg');
396
- return reply.code(200).send(base64string);
397
- } catch (error: any) {
398
- return reply.code(error.response?.status ?? 500).send({
399
- statusCode: error.response?.status ?? 500,
400
- message: error.response?.statusText ?? error.message,
401
- });
402
- }
403
- }
404
-
405
- public async getSnapshotById(req: FastifyRequest<AuthLoginRequest & CamerasParamsIdRequest & CameraSnapshotQueryRequest>, reply: FastifyReply): Promise<FastifyReply> {
406
- try {
407
- const camera = this.service.findById(req.params.cameraid);
408
- const cameraController = this.api.getCamera(camera?._id ?? '');
409
-
410
- if (!camera || !cameraController) {
411
- return reply.code(404).send({
412
- statusCode: 404,
413
- message: 'Camera not exists',
414
- });
415
- }
416
-
417
- const source = cameraController.snapshotSource ?? cameraController.streamSource;
418
- const snapshot = await cameraController.snapshot(source._id, req.query.forceNew);
419
- const base64string = snapshot ? Buffer.from(snapshot).toString('base64') : undefined;
420
-
421
- reply.header('Content-Type', 'image/jpeg');
422
- return reply.code(200).send(base64string);
423
- } catch (error: any) {
424
- return reply.code(error.response?.status ?? 500).send({
425
- statusCode: error.response?.status ?? 500,
426
- message: error.response?.statusText ?? error.message,
427
- });
428
- }
429
- }
430
-
431
- public async insert(req: FastifyRequest<AuthLoginRequest & CamerasInsertRequest>, reply: FastifyReply): Promise<FastifyReply> {
432
- try {
433
- const camera = this.service.findByName(req.body.name) ?? this.service.findById(req.body.name);
434
-
435
- if (camera) {
436
- return reply.code(409).send({
437
- statusCode: 409,
438
- message: 'Camera already exists',
439
- });
440
- }
441
-
442
- const existingGo2RtcSources = Object.keys(this.configService.go2rtcConfig.streams ?? {});
443
-
444
- if (req.body.sources.some((source) => existingGo2RtcSources.includes(source.name))) {
445
- return reply.code(409).send({
446
- statusCode: 409,
447
- message: 'Go2Rtc Source already exist',
448
- });
449
- }
450
-
451
- const newCamera = await this.service.createCamera(req.body);
452
-
453
- return reply.code(201).send(newCamera);
454
- } catch (error: any) {
455
- return reply.code(500).send({
456
- statusCode: 500,
457
- message: error.message,
458
- });
459
- }
460
- }
461
-
462
- public async pairCamera(req: FastifyRequest<AuthLoginRequest & CameraPairRequest>, reply: FastifyReply): Promise<FastifyReply> {
463
- try {
464
- const camera = this.service.findByName(req.body.name) ?? this.service.findById(req.body.name);
465
-
466
- if (camera) {
467
- return reply.code(409).send({
468
- statusCode: 409,
469
- message: 'Camera already exists',
470
- });
471
- }
472
-
473
- const cameraSources: Omit<CameraInputSettings, '_id'>[] = [];
474
- const existingGo2RtcSources = Object.keys(this.configService.go2rtcConfig.streams ?? {});
475
-
476
- const checkSourceExists = (sourceName: string): FastifyReply | undefined => {
477
- if (existingGo2RtcSources.includes(sourceName)) {
478
- return reply.code(409).send({
479
- statusCode: 409,
480
- message: 'Go2Rtc Source already exist',
481
- });
482
- }
483
- return undefined;
484
- };
485
-
486
- if (req.body.type === 'HomeKit') {
487
- const sourceName = createSourceName(req.body.name, 'main');
488
-
489
- const sourceExistsError = checkSourceExists(sourceName);
490
- if (sourceExistsError) {
491
- return sourceExistsError;
492
- }
493
-
494
- if (!req.body.pin) {
495
- return reply.code(400).send({
496
- statusCode: 400,
497
- message: 'PIN is required for HomeKit',
498
- });
499
- }
500
-
501
- const { source } = await this.go2rtcApi.streamsApi.pairHomekit({
502
- id: sourceName,
503
- url: req.body.url,
504
- pin: req.body.pin,
505
- });
506
-
507
- cameraSources.push({
508
- name: 'main',
509
- role: 'high-resolution',
510
- urls: [source.url],
511
- useForSnapshot: true,
512
- hotMode: false,
513
- });
514
- } else if (req.body.type === 'Onvif') {
515
- const url = new URL(req.body.url);
516
- url.username = req.body.username ?? '';
517
- url.password = req.body.password ?? '';
518
- const { sources } = await this.go2rtcApi.discoverApi.discoverOnvif({ src: url.toString() });
519
-
520
- if (!sources.length) {
521
- throw new Error('No sources found');
522
- }
523
-
524
- const streamSources = sources.filter((source) => source.id !== 'snapshot');
525
- const snapshotSource = sources.find((source) => source.id === 'snapshot');
526
-
527
- const hasMultipleStreams = streamSources.length > 2;
528
- const sourceAssignments: { source: OnvifSource; role: CameraRole }[] = [];
529
-
530
- if (streamSources[0]) {
531
- sourceAssignments.push({
532
- source: streamSources[0],
533
- role: 'high-resolution',
534
- });
535
- }
536
-
537
- if (streamSources[1]) {
538
- sourceAssignments.push({
539
- source: streamSources[1],
540
- role: hasMultipleStreams ? 'mid-resolution' : 'low-resolution',
541
- });
542
- }
543
-
544
- if (streamSources[2]) {
545
- sourceAssignments.push({
546
- source: streamSources[2],
547
- role: 'low-resolution',
548
- });
549
- }
550
-
551
- if (snapshotSource) {
552
- sourceAssignments.push({
553
- source: snapshotSource,
554
- role: 'snapshot',
555
- });
556
- }
557
-
558
- for (const { source } of sourceAssignments) {
559
- const sourceName = createSourceName(req.body.name, source.id);
560
- const sourceExistsError = checkSourceExists(sourceName);
561
- if (sourceExistsError) {
562
- return sourceExistsError;
563
- }
564
- }
565
-
566
- const determineSnapshotSource = () => {
567
- if (snapshotSource) return false;
568
- if (streamSources[2]) return 'low-resolution';
569
- if (streamSources[1]) return hasMultipleStreams ? 'mid-resolution' : 'low-resolution';
570
- return 'high-resolution';
571
- };
572
-
573
- const snapshotRole = determineSnapshotSource();
574
-
575
- for (const { source, role } of sourceAssignments) {
576
- cameraSources.push({
577
- name: source.id,
578
- role: role,
579
- urls: [source.url],
580
- useForSnapshot: role === 'snapshot' ? false : snapshotRole === role,
581
- hotMode: false,
582
- });
583
- }
584
- } else if (req.body.type === 'Google') {
585
- const sourceName = createSourceName(req.body.name, 'main');
586
-
587
- const sourceExistsError = checkSourceExists(sourceName);
588
- if (sourceExistsError) {
589
- return sourceExistsError;
590
- }
591
-
592
- if (!req.body.clientId || !req.body.clientSecret || !req.body.refreshToken || !req.body.projectId) {
593
- return reply.code(400).send({
594
- statusCode: 400,
595
- message: 'Google credentials are required',
596
- });
597
- }
598
-
599
- // Todo
600
- } else if (req.body.type === 'Ring') {
601
- const sourceName = createSourceName(req.body.name, 'main');
602
-
603
- const sourceExistsError = checkSourceExists(sourceName);
604
- if (sourceExistsError) {
605
- return sourceExistsError;
606
- }
607
-
608
- if (!req.body.email || !req.body.password) {
609
- return reply.code(400).send({
610
- statusCode: 400,
611
- message: 'Ring credentials are required',
612
- });
613
- }
614
-
615
- // Todo
616
- } else if (req.body.type === 'Roborock') {
617
- const sourceName = createSourceName(req.body.name, 'main');
618
-
619
- const sourceExistsError = checkSourceExists(sourceName);
620
- if (sourceExistsError) {
621
- return sourceExistsError;
622
- }
623
-
624
- if (!req.body.username || !req.body.password) {
625
- return reply.code(400).send({
626
- statusCode: 400,
627
- message: 'Roborock credentials are required',
628
- });
629
- }
630
-
631
- // Todo
632
- } else {
633
- return reply.code(400).send({
634
- statusCode: 400,
635
- message: 'Invalid camera type',
636
- });
637
- }
638
-
639
- if (!cameraSources.length) {
640
- return reply.code(500).send({
641
- statusCode: 500,
642
- message: 'No sources found',
643
- });
644
- }
645
-
646
- const parsedCamera: DBCamera = createCameraSchema.parse({
647
- name: req.body.name,
648
- sources: cameraSources,
649
- });
650
-
651
- const newCamera = await this.service.createCamera(parsedCamera);
652
-
653
- return reply.code(201).send(newCamera);
654
- } catch (error: any) {
655
- return reply.code(500).send({
656
- statusCode: 500,
657
- message: error.message,
658
- });
659
- }
660
- }
661
-
662
- public async preview(req: FastifyRequest<AuthLoginRequest & CamerasPreviewRequest>, reply: FastifyReply): Promise<FastifyReply> {
663
- const sourceName: string = Math.random().toString(36).substring(7);
664
- const streamSource = req.body.url;
665
-
666
- try {
667
- await this.go2rtcApi.streamsApi.createStream({
668
- name: sourceName,
669
- src: [streamSource],
670
- });
671
-
672
- const img = await this.go2rtcApi.snapshotApi.jpeg({ src: sourceName });
673
-
674
- await this.go2rtcApi.streamsApi.deleteStream({
675
- src: sourceName,
676
- });
677
-
678
- if (!img.byteLength) {
679
- return reply.code(500).send({
680
- statusCode: 500,
681
- message: 'Failed to take snapshot',
682
- });
683
- }
684
-
685
- reply.header('Content-Type', 'image/jpeg');
686
- return reply.code(201).send(Buffer.from(img).toString('base64'));
687
- } catch (error: any) {
688
- try {
689
- await this.go2rtcApi.streamsApi.deleteStream({
690
- src: sourceName,
691
- });
692
- } catch {
693
- //
694
- }
695
-
696
- return reply.code(error.response?.status ?? 500).send({
697
- statusCode: error.response?.status ?? 500,
698
- message: error.response?.statusText ?? error.message,
699
- });
700
- }
701
- }
702
-
703
- public list(req: FastifyRequest<AuthLoginRequest & PaginationRequest>, reply: FastifyReply): FastifyReply | DBCamera[] {
704
- try {
705
- const result = this.service.list();
706
- const ordered = orderBy(result, ['name'], ['asc']);
707
-
708
- return ordered;
709
- } catch (error: any) {
710
- return reply.code(500).send({
711
- statusCode: 500,
712
- message: error.message,
713
- });
714
- }
715
- }
716
-
717
- public async getStreamUrl(req: FastifyRequest<CamerasStreamRequest>, reply: FastifyReply): Promise<FastifyReply> {
718
- try {
719
- const camera = this.api.getCamera(req.params.cameraid);
720
- if (!camera) {
721
- return reply.code(404).send({
722
- statusCode: 404,
723
- message: 'Camera not exists',
724
- });
725
- }
726
-
727
- const streamUrl = await camera.interfaces.streamUrl(req.params.sourcename);
728
- if (!streamUrl) {
729
- return reply.code(404).send({
730
- statusCode: 404,
731
- message: 'Stream URL not found',
732
- });
733
- }
734
-
735
- return reply.code(200).send({ streamUrl });
736
- } catch (error: any) {
737
- return reply.code(500).send({
738
- statusCode: 500,
739
- message: error.message,
740
- });
741
- }
742
- }
743
-
744
- public async discoverCameras(req: FastifyRequest<AuthLoginRequest & CameraDiscoverQueryRequest>, reply: FastifyReply): Promise<FastifyReply> {
745
- try {
746
- const devices = await this.service.discoverCameras(req.query.type, req.query.src);
747
- devices.sources = devices.sources.filter((source) => !this.configService.cameraURLExists(source.url));
748
- return reply.code(200).send(devices);
749
- } catch (error: any) {
750
- return reply.code(500).send({
751
- statusCode: 500,
752
- message: error.message,
753
- });
754
- }
755
- }
756
-
757
- public async patchByName(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest & CamerasPatchRequest>, reply: FastifyReply): Promise<FastifyReply | void> {
758
- try {
759
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
760
-
761
- if (!camera) {
762
- return reply.code(404).send({
763
- statusCode: 404,
764
- message: 'Camera not exists',
765
- });
766
- }
767
-
768
- const newCamera = await this.service.patchCameraByName(req.params.cameraname, req.body);
769
-
770
- return reply.code(200).send(newCamera);
771
- } catch (error: any) {
772
- return reply.code(500).send({
773
- statusCode: 500,
774
- message: error.message,
775
- });
776
- }
777
- }
778
-
779
- public clearLog(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest>, reply: FastifyReply): FastifyReply | void {
780
- try {
781
- const cameraController = this.api.getCamera(req.params.cameraname);
782
-
783
- if (!cameraController) {
784
- return reply.code(404).send({
785
- statusCode: 404,
786
- message: 'Camera not exists',
787
- });
788
- }
789
-
790
- truncate(cameraController.logPath, (error) => {
791
- if (error) {
792
- return reply.code(500).send({
793
- statusCode: 500,
794
- message: error.message,
795
- });
796
- }
797
-
798
- this.app.io.of('/logs').emit('clear-camera-log', cameraController.name);
799
-
800
- return reply.code(204).send();
801
- });
802
- } catch (error: any) {
803
- return reply.code(500).send({
804
- statusCode: 500,
805
- message: error.message,
806
- });
807
- }
808
- }
809
-
810
- public downloadLog(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest>, reply: FastifyReply): FastifyReply | void {
811
- try {
812
- const cameraController = this.api.getCamera(req.params.cameraname);
813
-
814
- if (!cameraController) {
815
- return reply.code(404).send({
816
- statusCode: 404,
817
- message: 'Camera not exists',
818
- });
819
- }
820
-
821
- const buffer = new Readable();
822
- buffer._read = () => {};
823
-
824
- const readStream = createReadStream(cameraController.logPath);
825
-
826
- readStream.on('data', (data) => {
827
- buffer.push(data.toString('utf8').replace(/\x1b\[[0-9;]*m/g, ''));
828
- });
829
-
830
- readStream.on('end', () => {
831
- buffer.push(null);
832
- });
833
-
834
- reply.header('Content-Type', 'application/octet-stream');
835
- reply.header('Content-Disposition', `attachment; filename=camera.ui.${cameraController.name.replace(/ /g, '_')}.log.txt`);
836
-
837
- return reply.code(200).send(buffer);
838
- } catch (error: any) {
839
- return reply.code(500).send({
840
- statusCode: 500,
841
- message: error.message,
842
- });
843
- }
844
- }
845
-
846
- public async enableExtensionByName(
847
- req: FastifyRequest<AuthLoginRequest & CamerasExtensionsParamsRequest & CamerasExtensionsRequest>,
848
- reply: FastifyReply,
849
- ): Promise<FastifyReply | void> {
850
- try {
851
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
852
-
853
- if (!camera) {
854
- return reply.code(404).send({
855
- statusCode: 404,
856
- message: 'Camera not exists',
857
- });
858
- }
859
-
860
- const pluginName = this.resolvePluginName(req.params);
861
- const plugin = this.pluginsService.getPluginByName(pluginName);
862
-
863
- if (!plugin) {
864
- return reply.code(404).send({
865
- statusCode: 404,
866
- message: 'Plugin not exists',
867
- });
868
- }
869
-
870
- const newCamera = await this.service.enableExtensionByName(req.params.cameraname, pluginName, req.query.type);
871
-
872
- return reply.code(200).send(newCamera);
873
- } catch (error: any) {
874
- return reply.code(500).send({
875
- statusCode: 500,
876
- message: error.message,
877
- });
878
- }
879
- }
880
-
881
- public async disableExtensionByName(
882
- req: FastifyRequest<AuthLoginRequest & CamerasExtensionsParamsRequest & CamerasExtensionsRequest>,
883
- reply: FastifyReply,
884
- ): Promise<FastifyReply | void> {
885
- try {
886
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
887
-
888
- if (!camera) {
889
- return reply.code(404).send({
890
- statusCode: 404,
891
- message: 'Camera not exists',
892
- });
893
- }
894
-
895
- const pluginName = this.resolvePluginName(req.params);
896
- const plugin = this.pluginsService.getPluginByName(pluginName);
897
-
898
- if (!plugin) {
899
- return reply.code(404).send({
900
- statusCode: 404,
901
- message: 'Plugin not exists',
902
- });
903
- }
904
-
905
- const newCamera = await this.service.disableExtensionByName(req.params.cameraname, pluginName, req.query.type);
906
-
907
- return reply.code(200).send(newCamera);
908
- } catch (error: any) {
909
- return reply.code(500).send({
910
- statusCode: 500,
911
- message: error.message,
912
- });
913
- }
914
- }
915
-
916
- public async addExtensionByName(
917
- req: FastifyRequest<AuthLoginRequest & CamerasExtensionsParamsRequest & CamerasExtensionsRequest>,
918
- reply: FastifyReply,
919
- ): Promise<FastifyReply | void> {
920
- try {
921
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
922
-
923
- if (!camera) {
924
- return reply.code(404).send({
925
- statusCode: 404,
926
- message: 'Camera not exists',
927
- });
928
- }
929
-
930
- const pluginName = this.resolvePluginName(req.params);
931
- const plugin = this.pluginsService.getPluginByName(pluginName);
932
-
933
- if (!plugin) {
934
- return reply.code(404).send({
935
- statusCode: 404,
936
- message: 'Plugin not exists',
937
- });
938
- }
939
-
940
- const newCamera = await this.service.addExtensionByName(req.params.cameraname, pluginName, req.query.type);
941
-
942
- return reply.code(200).send(newCamera);
943
- } catch (error: any) {
944
- return reply.code(500).send({
945
- statusCode: 500,
946
- message: error.message,
947
- });
948
- }
949
- }
950
-
951
- public async removeExtensionByName(
952
- req: FastifyRequest<AuthLoginRequest & CamerasExtensionsParamsRequest & CamerasExtensionsRequest>,
953
- reply: FastifyReply,
954
- ): Promise<FastifyReply | void> {
955
- try {
956
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
957
-
958
- if (!camera) {
959
- return reply.code(404).send({
960
- statusCode: 404,
961
- message: 'Camera not exists',
962
- });
963
- }
964
-
965
- const pluginName = this.resolvePluginName(req.params);
966
- const plugin = this.pluginsService.getPluginByName(pluginName);
967
-
968
- if (!plugin) {
969
- return reply.code(404).send({
970
- statusCode: 404,
971
- message: 'Plugin not exists',
972
- });
973
- }
974
-
975
- const newCamera = await this.service.removeExtensionByName(req.params.cameraname, pluginName, req.query.type);
976
-
977
- return reply.code(200).send(newCamera);
978
- } catch (error: any) {
979
- return reply.code(500).send({
980
- statusCode: 500,
981
- message: error.message,
982
- });
983
- }
984
- }
985
-
986
- public async removeByName(req: FastifyRequest<AuthLoginRequest & CamerasParamsRequest>, reply: FastifyReply): Promise<FastifyReply> {
987
- try {
988
- const camera = this.service.findByName(req.params.cameraname) ?? this.service.findById(req.params.cameraname);
989
-
990
- if (!camera) {
991
- return reply.code(404).send({
992
- statusCode: 404,
993
- message: 'Camera not exists',
994
- });
995
- }
996
-
997
- await this.service.removeByName(req.params.cameraname);
998
-
999
- return reply.code(204).send();
1000
- } catch (error: any) {
1001
- return reply.code(500).send({
1002
- statusCode: 500,
1003
- message: error.message,
1004
- });
1005
- }
1006
- }
1007
-
1008
- public async removeAll(req: FastifyRequest<AuthLoginRequest>, reply: FastifyReply): Promise<FastifyReply> {
1009
- try {
1010
- await this.service.removeAll();
1011
-
1012
- return reply.code(204).send();
1013
- } catch (error: any) {
1014
- return reply.code(500).send({
1015
- statusCode: 500,
1016
- message: error.message,
1017
- });
1018
- }
1019
- }
1020
-
1021
- private resolvePluginName(params: CamerasExtensionsParamsRequest['Params']): string {
1022
- if (params.scope) {
1023
- const at = params.scope.startsWith('@') ? '' : '@';
1024
- return `${at}${params.scope}/${params.pluginname}`;
1025
- } else {
1026
- return params.pluginname;
1027
- }
1028
- }
1029
- }