@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interface/index.html +44 -44
- package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.BAIU_p3r.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.mdCorqzE.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.D0vsSsly.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.we5ZpWr2.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.9AEBJ3H1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.CZcnEH0C.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.DE0LkcGu.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/Cammesh.CVvmkelB.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.CUr4pGoU.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.CaJhu4fF.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.5VUmgryj.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.iYmUxAR5.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.DXPyE5mF.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.BqtlOFnV.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.C_RI-SDQ.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.Ch_v02eN.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.BpXAYgSG.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/Recordings.CIKHJytH.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.BcLoGNEy.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.DMROW8kx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/SettingsAppearance.CUaHpihp.0.0.50-internal.2.js +1 -0
- 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.BuKZ-Uco.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.0QdwFSpv.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/SettingsRecordings.B-aj0U8_.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.Bi1YAJ76.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.CAx66Iir.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.CQcDtGy1.0.0.50-internal.2.js} +1 -1
- 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.BhXMzIhV.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0sCXSu5.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.DNqPWa0Q.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.DAXgG3bP.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.Bq3YocRX.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.9rxyNw0z.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.BuEvHAsS.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.DUdE08x8.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.DWU6YI8o.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.BpPyC6E4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.BoR2Rhdd.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BXzPONHs.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.DwcBYfWc.0.0.50-internal.2.js} +3 -3
- package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.BUDVOjPt.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CsG-OBoI.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CqEQao5R.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.D91sslRx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.SdSTPzZO.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.BwroebQ4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.DxM48YSv.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.Cmpbnzo4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.DF2YgZo1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.BUs2ineY.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.DmkT2LKx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.dPzyZDVa.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.y2ZlFveS.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.Y-alCADW.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.sRVFTqDf.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.D5WrXOZa.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.R0uz_abA.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.65mnGy-o.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.B1Qop6Uu.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.CwmyAcir.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.CMPALvRh.0.0.50-internal.2.js} +1 -1
- package/dist/interface/sw.js +1 -1
- package/dist/server/package.json +1 -1
- package/dist/server/src/rpc/server.js +4 -1
- package/dist/server/src/rpc/server.js.map +1 -1
- package/package.json +1 -1
- package/.prettierignore +0 -12
- package/.prettierrc.json +0 -12
- package/artillery.yaml +0 -29
- package/bin/cameraui-server.ts +0 -11
- package/dist/interface/js/Cammesh.D-6dAROQ.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/Recordings.DhxjIW7e.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/SettingsAppearance.DsTjKXk1.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/SettingsRecordings.DgW7M0jj.0.0.50-internal.0.js +0 -1
- package/eslint.config.js +0 -103
- package/localdeps.txt +0 -10
- package/mypy.ini +0 -30
- package/requirements.txt +0 -15
- package/ruff.toml +0 -90
- package/src/__init__.py +0 -0
- package/src/_camera_ui_tools/__init__.py +0 -0
- package/src/_camera_ui_tools/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/api/controllers/api.controller.ts +0 -19
- package/src/api/controllers/auth.controller.ts +0 -294
- package/src/api/controllers/backup.controller.ts +0 -72
- package/src/api/controllers/cameras.controller.ts +0 -1029
- package/src/api/controllers/config.controller.ts +0 -102
- package/src/api/controllers/files.controller.ts +0 -35
- package/src/api/controllers/frameWorkers.controller.ts +0 -109
- package/src/api/controllers/plugins.controller.ts +0 -1206
- package/src/api/controllers/system.controller.ts +0 -273
- package/src/api/controllers/users.controller.ts +0 -648
- package/src/api/database/checks.ts +0 -268
- package/src/api/database/constants.ts +0 -8
- package/src/api/database/index.ts +0 -262
- package/src/api/database/migration.ts +0 -62
- package/src/api/database/selfcheck.ts +0 -492
- package/src/api/database/types.ts +0 -104
- package/src/api/go2rtc/api/application.ts +0 -48
- package/src/api/go2rtc/api/config.ts +0 -61
- package/src/api/go2rtc/api/discover.ts +0 -197
- package/src/api/go2rtc/api/index.ts +0 -49
- package/src/api/go2rtc/api/snapshot.ts +0 -44
- package/src/api/go2rtc/api/streams.ts +0 -168
- package/src/api/go2rtc/index.ts +0 -43
- package/src/api/go2rtc/queue.ts +0 -50
- package/src/api/go2rtc/types.ts +0 -174
- package/src/api/index.ts +0 -286
- package/src/api/middlewares/authPermission.middleware.ts +0 -46
- package/src/api/middlewares/authValidation.middleware.ts +0 -160
- package/src/api/middlewares/pagination.middleware.ts +0 -67
- package/src/api/middlewares/socketAuth.middleware.ts +0 -136
- package/src/api/plugins/header.plugin.ts +0 -15
- package/src/api/plugins/logger.plugin.ts +0 -44
- package/src/api/plugins/proxy.plugin.ts +0 -255
- package/src/api/plugins/socket.plugin.ts +0 -28
- package/src/api/plugins/system.plugin.ts +0 -48
- package/src/api/plugins/useragent.plugin.ts +0 -19
- package/src/api/routes/api.routes.ts +0 -10
- package/src/api/routes/auth.routes.ts +0 -56
- package/src/api/routes/backup.routes.ts +0 -28
- package/src/api/routes/cameras.routes.ts +0 -281
- package/src/api/routes/config.routes.ts +0 -66
- package/src/api/routes/files.routes.ts +0 -15
- package/src/api/routes/frameWorkers.routes.ts +0 -39
- package/src/api/routes/index.ts +0 -37
- package/src/api/routes/plugins.routes.ts +0 -420
- package/src/api/routes/system.routes.ts +0 -101
- package/src/api/routes/users.routes.ts +0 -167
- package/src/api/schemas/backup.schema.ts +0 -112
- package/src/api/schemas/cameras.schema.ts +0 -479
- package/src/api/schemas/config.schema.ts +0 -38
- package/src/api/schemas/go2rtc.schema.ts +0 -189
- package/src/api/schemas/plugins.schema.ts +0 -126
- package/src/api/schemas/storage.schema.ts +0 -11
- package/src/api/schemas/system.schema.ts +0 -45
- package/src/api/schemas/users.schema.ts +0 -185
- package/src/api/services/auth.service.ts +0 -210
- package/src/api/services/backup.service.ts +0 -144
- package/src/api/services/cameras.service.ts +0 -671
- package/src/api/services/plugins.service.ts +0 -470
- package/src/api/services/system.service.ts +0 -85
- package/src/api/services/users.service.ts +0 -276
- package/src/api/types/index.ts +0 -675
- package/src/api/utils/cert.ts +0 -254
- package/src/api/utils/constants.ts +0 -17
- package/src/api/utils/fetch.ts +0 -21
- package/src/api/utils/moveFiles.ts +0 -45
- package/src/api/utils/parse.ts +0 -17
- package/src/api/websocket/index.ts +0 -110
- package/src/api/websocket/nsp/logs.ts +0 -240
- package/src/api/websocket/nsp/main.ts +0 -27
- package/src/api/websocket/nsp/metrics.ts +0 -301
- package/src/api/websocket/nsp/notifications.ts +0 -43
- package/src/api/websocket/nsp/plugins.ts +0 -37
- package/src/api/websocket/nsp/server.ts +0 -220
- package/src/api/websocket/nsp/status.ts +0 -77
- package/src/api/websocket/types.ts +0 -55
- package/src/api.ts +0 -163
- package/src/camera/classes.ts +0 -32
- package/src/camera/controller.ts +0 -579
- package/src/camera/device.ts +0 -422
- package/src/camera/frameWorker.ts +0 -403
- package/src/camera/index.ts +0 -679
- package/src/camera/interfaces.ts +0 -95
- package/src/camera/iou.ts +0 -153
- package/src/camera/polygon.ts +0 -226
- package/src/camera/python/__init__.py +0 -0
- package/src/camera/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/classes.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/delegate_controller.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/interfaces.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/iou.cpython-310.pyc +0 -0
- package/src/camera/python/__pycache__/iou.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/iou2.cpython-310.pyc +0 -0
- package/src/camera/python/__pycache__/polygon.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/video_frame.cpython-311.pyc +0 -0
- package/src/camera/python/classes.py +0 -41
- package/src/camera/python/interfaces.py +0 -130
- package/src/camera/python/iou.py +0 -158
- package/src/camera/python/polygon.py +0 -230
- package/src/camera/python/test/__pycache__/polygon.cpython-310.pyc +0 -0
- package/src/camera/python/test/iou_test.py +0 -799
- package/src/camera/python/test/polygon.py +0 -238
- package/src/camera/python/test/polygon_test.py +0 -256
- package/src/camera/python/test/polygon_test2.py +0 -484
- package/src/camera/python/typings.py +0 -50
- package/src/camera/python/video_frame.py +0 -143
- package/src/camera/session.ts +0 -192
- package/src/camera/streaming/fmp4-session.ts +0 -390
- package/src/camera/streaming/peer-connection.ts +0 -273
- package/src/camera/streaming/rtsp-session.ts +0 -331
- package/src/camera/streaming/webrtc-connection.ts +0 -260
- package/src/camera/streaming/werift-session.ts +0 -317
- package/src/camera/test/iou_test.ts +0 -761
- package/src/camera/test/polygon.test.ts +0 -611
- package/src/camera/test/polygon_test.ts +0 -210
- package/src/camera/types.ts +0 -48
- package/src/camera/utils.ts +0 -489
- package/src/camera/videoFrame.ts +0 -123
- package/src/cloud/index.ts +0 -61
- package/src/cloud/remote/cloudflare.ts +0 -18
- package/src/cloud/remote/upnp.ts +0 -18
- package/src/cloud/remote/utils.ts +0 -24
- package/src/cloud/types.ts +0 -16
- package/src/decoder/child.ts +0 -883
- package/src/decoder/imageUtils.ts +0 -275
- package/src/decoder/manager.ts +0 -251
- package/src/decoder/python/__init__.py +0 -0
- package/src/decoder/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/image_utils.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/utils.cpython-311.pyc +0 -0
- package/src/decoder/python/child.py +0 -903
- package/src/decoder/python/image_utils.py +0 -196
- package/src/decoder/python/pool.py +0 -45
- package/src/decoder/python/test/group.py +0 -62
- package/src/decoder/python/test/motion.mp4 +0 -0
- package/src/decoder/python/test/motion2.mp4 +0 -0
- package/src/decoder/python/test/opencl.cl +0 -70
- package/src/decoder/python/test/opencl2.cl +0 -130
- package/src/decoder/python/test/test.py +0 -427
- package/src/decoder/python/test/test1.jpg +0 -0
- package/src/decoder/python/test/test1_resized.jpg +0 -0
- package/src/decoder/python/test/test2.jpg +0 -0
- package/src/decoder/python/test/test2.py +0 -451
- package/src/decoder/python/test/test2_resized.jpg +0 -0
- package/src/decoder/python/test/test3.jpg +0 -0
- package/src/decoder/python/test/utils.py +0 -50
- package/src/decoder/python/typings.py +0 -57
- package/src/decoder/python/utils.py +0 -70
- package/src/decoder/test/child.ts +0 -117
- package/src/decoder/test/ffmpeg.ts +0 -371
- package/src/decoder/test/test.ts +0 -182
- package/src/decoder/types.ts +0 -27
- package/src/decoder/utils.ts +0 -64
- package/src/decoder/wasm/asconfig.json +0 -28
- package/src/decoder/wasm/assembly/console.ts +0 -1
- package/src/decoder/wasm/assembly/index.ts +0 -890
- package/src/decoder/wasm/build/decoder.d.ts +0 -43
- package/src/decoder/wasm/build/decoder.js +0 -108
- package/src/decoder/wasm/build/decoder.wasm +0 -0
- package/src/decoder/wasm/tsconfig.json +0 -5
- package/src/decoder/worker.ts +0 -113
- package/src/go2rtc/index.ts +0 -324
- package/src/go2rtc/types.ts +0 -88
- package/src/main.ts +0 -267
- package/src/manager/coreManager.ts +0 -78
- package/src/manager/deviceManager.ts +0 -132
- package/src/manager/types.ts +0 -17
- package/src/plugins/index.ts +0 -443
- package/src/plugins/plugin.ts +0 -177
- package/src/plugins/runtime/base.ts +0 -282
- package/src/plugins/runtime/index.ts +0 -15
- package/src/plugins/runtime/node/child.ts +0 -193
- package/src/plugins/runtime/node/index.ts +0 -67
- package/src/plugins/runtime/node/plugin.ts +0 -122
- package/src/plugins/runtime/node/pluginApi.ts +0 -27
- package/src/plugins/runtime/node/proxy/cameraDevice.ts +0 -299
- package/src/plugins/runtime/node/proxy/coreManager.ts +0 -128
- package/src/plugins/runtime/node/proxy/deviceManager.ts +0 -187
- package/src/plugins/runtime/node/storage.ts +0 -312
- package/src/plugins/runtime/node/storageController.ts +0 -91
- package/src/plugins/runtime/python/__init__.py +0 -0
- package/src/plugins/runtime/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/camera_storage.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/config_service.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/constants.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/ipc.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/logger.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/message_queue.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/namespaces.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin_api.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin_logger.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/proxy_utils.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/schema.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/storage.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/storage_controller.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/child.py +0 -248
- package/src/plugins/runtime/python/index.ts +0 -73
- package/src/plugins/runtime/python/namespaces.py +0 -101
- package/src/plugins/runtime/python/plugin.py +0 -155
- package/src/plugins/runtime/python/plugin_api.py +0 -29
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/core_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/camera_device.py +0 -1732
- package/src/plugins/runtime/python/proxy/core_manager.py +0 -126
- package/src/plugins/runtime/python/proxy/device_manager.py +0 -197
- package/src/plugins/runtime/python/schema.py +0 -99
- package/src/plugins/runtime/python/storage.py +0 -353
- package/src/plugins/runtime/python/storage_controller.py +0 -102
- package/src/plugins/runtime/python/typings.py +0 -195
- package/src/plugins/schema.ts +0 -472
- package/src/plugins/types.ts +0 -60
- package/src/plugins/worker.ts +0 -250
- package/src/rpc/index.ts +0 -149
- package/src/rpc/namespaces.ts +0 -79
- package/src/rpc/server.ts +0 -422
- package/src/rpc/types.ts +0 -119
- package/src/rpc/utils.ts +0 -16
- package/src/services/config/constants.ts +0 -47
- package/src/services/config/defaults.ts +0 -57
- package/src/services/config/index.ts +0 -744
- package/src/services/config/types.ts +0 -211
- package/src/services/logger/index.ts +0 -96
- package/src/types.ts +0 -47
- package/src/utils/path.ts +0 -16
- package/src/utils/pythonInstaller.ts +0 -597
- package/tsconfig.json +0 -37
- package/types/fastify.d.ts +0 -14
- package/updates.config.js +0 -3
- /package/dist/interface/assets/{@xterm.DYP7pi_n.0.0.50-internal.0.css → @xterm.DYP7pi_n.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.C-5Lxnx_.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{engine.io-parser.BiEtp6m2.0.0.50-internal.0.js → engine.io-parser.BiEtp6m2.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{ev-emitter.X5f1qa-c.0.0.50-internal.0.js → ev-emitter.X5f1qa-c.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{get-size.D1dS-IaP.0.0.50-internal.0.js → get-size.D1dS-IaP.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.2.js} +0 -0
package/src/camera/controller.ts
DELETED
|
@@ -1,579 +0,0 @@
|
|
|
1
|
-
import { generateSdp } from '@camera.ui/common/camera';
|
|
2
|
-
import { createSourceName, isEqual } from '@camera.ui/common/utils';
|
|
3
|
-
import { rpc } from '@camera.ui/rpc-common';
|
|
4
|
-
import { pathExists } from 'fs-extra/esm';
|
|
5
|
-
import { createWriteStream, ftruncate, read, rmSync } from 'node:fs';
|
|
6
|
-
import { open, stat } from 'node:fs/promises';
|
|
7
|
-
import { join } from 'node:path';
|
|
8
|
-
import { promisify } from 'node:util';
|
|
9
|
-
import { filter, pairwise } from 'rxjs/operators';
|
|
10
|
-
import { container } from 'tsyringe';
|
|
11
|
-
import { Agent } from 'undici';
|
|
12
|
-
import { PLUGIN_STATUS } from '../plugins/types.js';
|
|
13
|
-
import { NamespaceManager } from '../rpc/namespaces.js';
|
|
14
|
-
import { CameraDevice } from './device.js';
|
|
15
|
-
import { CameraInterface } from './interfaces.js';
|
|
16
|
-
|
|
17
|
-
import { API_EVENT } from '../api.js';
|
|
18
|
-
import { FrameWorker } from './frameWorker.js';
|
|
19
|
-
import { SessionController } from './session.js';
|
|
20
|
-
import { generateAudioStreamInfo, generateVideoStreamInfo } from './utils.js';
|
|
21
|
-
|
|
22
|
-
import type { Logger } from '@camera.ui/common/logger';
|
|
23
|
-
import type { Promisify, RPCBase } from '@camera.ui/rpc-common';
|
|
24
|
-
import type {
|
|
25
|
-
AudioState,
|
|
26
|
-
AudioStreamInfo,
|
|
27
|
-
Camera,
|
|
28
|
-
CameraDeviceCapability,
|
|
29
|
-
CameraDeviceSource,
|
|
30
|
-
DeviceStorage,
|
|
31
|
-
DoorbellState,
|
|
32
|
-
MotionSetEvent,
|
|
33
|
-
MotionState,
|
|
34
|
-
ObjectState,
|
|
35
|
-
ProbeConfig,
|
|
36
|
-
ProbeStream,
|
|
37
|
-
SetValues,
|
|
38
|
-
StateValues,
|
|
39
|
-
VideoStreamInfo,
|
|
40
|
-
} from '@camera.ui/types';
|
|
41
|
-
import type { WriteStream } from 'node:fs';
|
|
42
|
-
import type { BehaviorSubject, Subscription } from 'rxjs';
|
|
43
|
-
import type { CameraUiAPI } from '../api.js';
|
|
44
|
-
import type { Go2RtcApi } from '../api/go2rtc/index.js';
|
|
45
|
-
import type { ProxyServer } from '../rpc/index.js';
|
|
46
|
-
import type { CameraNamespaces, FrameWorkerNamespaces } from '../rpc/namespaces.js';
|
|
47
|
-
import type { CameraDeviceListenerMessagePayload, RefreshedStates } from '../rpc/types.js';
|
|
48
|
-
import type { ConfigService } from '../services/config/index.js';
|
|
49
|
-
import type { CameraDeviceInterface, PluginCapabilities } from './types.js';
|
|
50
|
-
|
|
51
|
-
const truncatePromise = promisify(ftruncate);
|
|
52
|
-
const readPromise = promisify(read);
|
|
53
|
-
|
|
54
|
-
export class CameraController extends CameraDevice implements CameraDeviceInterface {
|
|
55
|
-
public readonly frameWorker: FrameWorker;
|
|
56
|
-
public readonly sessionController: SessionController;
|
|
57
|
-
public readonly streamInfos = new Map<string, ProbeStream>();
|
|
58
|
-
public readonly logStream?: WriteStream;
|
|
59
|
-
|
|
60
|
-
protected cameraInterfaces: CameraInterface;
|
|
61
|
-
protected initialized = true;
|
|
62
|
-
|
|
63
|
-
private proxy: RPCBase;
|
|
64
|
-
private namespaces: CameraNamespaces & FrameWorkerNamespaces;
|
|
65
|
-
|
|
66
|
-
private motionTimeout?: NodeJS.Timeout;
|
|
67
|
-
private objectTimeout?: NodeJS.Timeout;
|
|
68
|
-
private objectTimeoutDuration = 5;
|
|
69
|
-
private audioTimeout?: NodeJS.Timeout;
|
|
70
|
-
private audioTimeoutDuration = 5;
|
|
71
|
-
private blockMotionResetEvents = false;
|
|
72
|
-
|
|
73
|
-
private proxyServer: ProxyServer;
|
|
74
|
-
private go2rtcApi: Go2RtcApi;
|
|
75
|
-
private configService: ConfigService;
|
|
76
|
-
private api: CameraUiAPI;
|
|
77
|
-
|
|
78
|
-
private truncateInterval?: NodeJS.Timeout;
|
|
79
|
-
private truncateIntervalMs: number = 1000 * 60 * 60 * 2;
|
|
80
|
-
|
|
81
|
-
private pluginIds = new Set<string>();
|
|
82
|
-
|
|
83
|
-
get logPath(): string {
|
|
84
|
-
return join(this.configService.LOGS_PATH, `camera-${this.id}.log`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get streamSource(): CameraDeviceSource {
|
|
88
|
-
return (this.highResolutionSource ?? this.midResolutionSource ?? this.lowResolutionSource)!;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
get camera(): Camera {
|
|
92
|
-
return this.cameraObject;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
constructor(camera: Camera, logger: Logger) {
|
|
96
|
-
const proxyServer = container.resolve<ProxyServer>('proxy');
|
|
97
|
-
const namespaces = {
|
|
98
|
-
...NamespaceManager.cameraNamespaces(camera._id),
|
|
99
|
-
...NamespaceManager.frameWorkerNamespaces(camera._id),
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
super(camera, proxyServer.proxy, namespaces, logger);
|
|
103
|
-
|
|
104
|
-
this.proxyServer = proxyServer;
|
|
105
|
-
this.api = container.resolve<CameraUiAPI>('api');
|
|
106
|
-
this.go2rtcApi = container.resolve<Go2RtcApi>('go2rtcApi');
|
|
107
|
-
this.configService = container.resolve<ConfigService>('configService');
|
|
108
|
-
|
|
109
|
-
this.logStream = createWriteStream(this.logPath, { flags: 'a' });
|
|
110
|
-
this.writeHeader();
|
|
111
|
-
|
|
112
|
-
this.truncateInterval = setInterval(() => this.truncateLog(), this.truncateIntervalMs);
|
|
113
|
-
this.truncateLog();
|
|
114
|
-
|
|
115
|
-
(this.logger as Logger).logStream = this.logStream;
|
|
116
|
-
this.proxy = this.proxyServer.proxy;
|
|
117
|
-
|
|
118
|
-
this.frameWorker = new FrameWorker(this);
|
|
119
|
-
this.sessionController = new SessionController(this);
|
|
120
|
-
this.cameraInterfaces = new CameraInterface(this.proxy, this.capabilities, this.camera._id);
|
|
121
|
-
|
|
122
|
-
this.namespaces = namespaces;
|
|
123
|
-
|
|
124
|
-
this.addSubscriptions(
|
|
125
|
-
this.subscribeToCameraState(),
|
|
126
|
-
this.subscribeToFrameWorkerState(),
|
|
127
|
-
this.subscribeToCameraChanges(),
|
|
128
|
-
this.subscribeToCapabilityChanges(),
|
|
129
|
-
this.subscribeToStateChanges('light', this.lightState),
|
|
130
|
-
this.subscribeToStateChanges('motion', this.motionState),
|
|
131
|
-
this.subscribeToStateChanges('audio', this.audioState),
|
|
132
|
-
this.subscribeToStateChanges('object', this.objectState),
|
|
133
|
-
this.subscribeToStateChanges('doorbell', this.doorbellState),
|
|
134
|
-
this.subscribeToStateChanges('siren', this.sirenState),
|
|
135
|
-
this.onPropertyChange('name').subscribe(() => {
|
|
136
|
-
(this.logger as Logger).prefix = this.camera.name;
|
|
137
|
-
}),
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
this.api.setMaxListeners(this.api.getMaxListeners() + 1);
|
|
141
|
-
this.api.once(API_EVENT.SHUTDOWN, () => {
|
|
142
|
-
this.cleanup();
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public async init(): Promise<void> {
|
|
147
|
-
await this.proxy.registerRPCHandler(this.namespaces.cameraControllerRpc, this);
|
|
148
|
-
await this.frameWorker.start();
|
|
149
|
-
this.sessionController.start(this.sources);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
public extend(): void {
|
|
153
|
-
throw new Error('Method not implemented.');
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
public addCapabilities(): void {
|
|
157
|
-
throw new Error('Method not implemented.');
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
public removeCapabilities(): void {
|
|
161
|
-
throw new Error('Method not implemented.');
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
@rpc({ public: true })
|
|
165
|
-
public async connect(): Promise<void> {
|
|
166
|
-
this.cameraState.next(true);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
@rpc({ public: true })
|
|
170
|
-
public async disconnect(): Promise<void> {
|
|
171
|
-
this.cameraState.next(false);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
@rpc({ public: true })
|
|
175
|
-
public async updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], frame?: undefined, override?: boolean): Promise<void> {
|
|
176
|
-
if (!override && stateName === 'motion' && this.blockMotionResetEvents && !(eventData as MotionSetEvent).state) {
|
|
177
|
-
(eventData as MotionSetEvent).state = true;
|
|
178
|
-
(eventData as MotionSetEvent).detections = [];
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
super.updateStateInternal(stateName as any, eventData as any);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
@rpc({ public: true })
|
|
185
|
-
public async snapshot(sourceId: string, forceNew?: boolean): Promise<ArrayBuffer | undefined> {
|
|
186
|
-
const fromCache = this.snapshotCache.get(sourceId);
|
|
187
|
-
if (!forceNew && fromCache) {
|
|
188
|
-
return fromCache;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
try {
|
|
192
|
-
if (this.cameraObject.pluginId !== 'native') {
|
|
193
|
-
try {
|
|
194
|
-
const snapshotFromPlugin = await this.cameraInterfaces.snapshot(sourceId, forceNew);
|
|
195
|
-
if (snapshotFromPlugin && snapshotFromPlugin.byteLength > 0) {
|
|
196
|
-
this.snapshotCache.set(sourceId, snapshotFromPlugin);
|
|
197
|
-
return snapshotFromPlugin;
|
|
198
|
-
}
|
|
199
|
-
} catch {
|
|
200
|
-
//
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const source = this.sources.find((source) => source._id === sourceId);
|
|
205
|
-
if (!source) {
|
|
206
|
-
throw new Error('Source not found');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const snapshotUrl = source.urls.snapshot.jpeg;
|
|
210
|
-
const controller = new AbortController();
|
|
211
|
-
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
212
|
-
|
|
213
|
-
const response = await fetch(snapshotUrl, {
|
|
214
|
-
signal: controller.signal,
|
|
215
|
-
// @ts-ignore
|
|
216
|
-
dispatcher: new Agent({
|
|
217
|
-
connect: {
|
|
218
|
-
cert: this.configService.ssl.cert,
|
|
219
|
-
key: this.configService.ssl.key,
|
|
220
|
-
ca: this.configService.ssl.ca,
|
|
221
|
-
},
|
|
222
|
-
}),
|
|
223
|
-
});
|
|
224
|
-
clearTimeout(timeout);
|
|
225
|
-
|
|
226
|
-
if (!response.ok) {
|
|
227
|
-
throw new Error('Status Code: ' + response.status);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const snapshot = await response.arrayBuffer();
|
|
231
|
-
if (snapshot.byteLength > 0) {
|
|
232
|
-
this.snapshotCache.set(source._id, snapshot);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return snapshot;
|
|
236
|
-
} catch (error) {
|
|
237
|
-
this.logger.error('Error while fetching snapshot', error);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
@rpc({ public: true })
|
|
242
|
-
public addPluginCapabilities(pluginId: string, capabilities: CameraDeviceCapability[]): void {
|
|
243
|
-
super.addCapabilitiesInternal(pluginId, capabilities);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
@rpc({ public: true })
|
|
247
|
-
public removePluginCapabilities(pluginId: string, capabilities: CameraDeviceCapability[] = []): void {
|
|
248
|
-
super.removeCapabilitiesInternal(pluginId, capabilities);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
@rpc({ public: true })
|
|
252
|
-
public async probeStream(sourceId: string, probeConfig?: ProbeConfig, refresh = false): Promise<ProbeStream | undefined> {
|
|
253
|
-
let streamInfo = this.streamInfos.get(sourceId);
|
|
254
|
-
if (streamInfo && !refresh) {
|
|
255
|
-
return Promise.resolve(streamInfo);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const cameraSource = this.sources.find((source) => source._id === sourceId);
|
|
259
|
-
if (!cameraSource) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
try {
|
|
264
|
-
const src = createSourceName(this.name, cameraSource?.name);
|
|
265
|
-
const probe = await this.go2rtcApi.streamsApi.probeStreamSource({ src }, probeConfig);
|
|
266
|
-
|
|
267
|
-
const videoStreamInfo: VideoStreamInfo[] = generateVideoStreamInfo(probe.producers);
|
|
268
|
-
const audioStreamInfo: AudioStreamInfo[] = generateAudioStreamInfo(probe.producers);
|
|
269
|
-
const sdp = generateSdp(videoStreamInfo, audioStreamInfo);
|
|
270
|
-
|
|
271
|
-
streamInfo = {
|
|
272
|
-
sdp,
|
|
273
|
-
video: videoStreamInfo,
|
|
274
|
-
audio: audioStreamInfo,
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
this.streamInfos.set(sourceId, streamInfo);
|
|
278
|
-
} catch (err) {
|
|
279
|
-
this.logger.error('Error while probing stream source', err);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return streamInfo;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
@rpc({ public: true })
|
|
286
|
-
public async refreshStates(): Promise<RefreshedStates> {
|
|
287
|
-
return {
|
|
288
|
-
camera: this.camera,
|
|
289
|
-
cameraState: this.connected,
|
|
290
|
-
frameWorkerState: this.frameWorker.status === PLUGIN_STATUS.STARTED,
|
|
291
|
-
capabilities: this.capabilities.getValue(),
|
|
292
|
-
states: {
|
|
293
|
-
light: this.getValue('light'),
|
|
294
|
-
motion: this.getValue('motion'),
|
|
295
|
-
audio: this.getValue('audio'),
|
|
296
|
-
object: this.getValue('object'),
|
|
297
|
-
doorbell: this.getValue('doorbell'),
|
|
298
|
-
siren: this.getValue('siren'),
|
|
299
|
-
battery: this.getValue('battery'),
|
|
300
|
-
},
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
public updateCamera(updatedCamera: Camera): void {
|
|
305
|
-
super.updateCamera(updatedCamera);
|
|
306
|
-
this.sessionController.start(this.sources);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
public updateFrameWorkerState(state: boolean): void {
|
|
310
|
-
super.updateFrameWorkerState(state);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
public async cleanup(): Promise<void> {
|
|
314
|
-
await this.frameWorker.close();
|
|
315
|
-
this.sessionController.stop();
|
|
316
|
-
this.closeLogStream();
|
|
317
|
-
this.removeAllListeners();
|
|
318
|
-
this.unsubscribe();
|
|
319
|
-
this.clearTimers();
|
|
320
|
-
await this.disconnectRpc();
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
public async stop(): Promise<void> {
|
|
324
|
-
await this.cleanup();
|
|
325
|
-
this.removeLogStream();
|
|
326
|
-
this.triggerProxyEvent('removed');
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
public writeLog(...args: any[]): void {
|
|
330
|
-
this.safeWriteLog(args.join(' ').replace(/\r?\n*$/, '\n'));
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
public async storageProxy(pluginId: string): Promise<Promisify<DeviceStorage>> {
|
|
334
|
-
this.pluginIds.add(pluginId);
|
|
335
|
-
const namespaces = NamespaceManager.pluginCameraNamespaces(pluginId, this.id);
|
|
336
|
-
return this.proxy.createRPCProxy<DeviceStorage>(namespaces.cameraStorageRpc);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
private subscribeToCameraState(): Subscription {
|
|
340
|
-
return this.cameraState
|
|
341
|
-
.pipe(
|
|
342
|
-
pairwise(),
|
|
343
|
-
filter(([oldState, newState]) => oldState !== newState),
|
|
344
|
-
)
|
|
345
|
-
.subscribe(([, newState]) => this.triggerProxyEvent('cameraState', newState));
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
private subscribeToFrameWorkerState(): Subscription {
|
|
349
|
-
return this.frameWorkerState
|
|
350
|
-
.pipe(
|
|
351
|
-
pairwise(),
|
|
352
|
-
filter(([oldState, newState]) => oldState !== newState),
|
|
353
|
-
)
|
|
354
|
-
.subscribe(([, newState]) => this.triggerProxyEvent('frameWorkerState', newState));
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
private subscribeToCameraChanges(): Subscription {
|
|
358
|
-
return this.cameraSubject
|
|
359
|
-
.pipe(
|
|
360
|
-
pairwise(),
|
|
361
|
-
filter(([oldCamera, newCamera]) => !isEqual(oldCamera, newCamera, true)),
|
|
362
|
-
)
|
|
363
|
-
.subscribe(([, newCamera]) => this.triggerProxyEvent('updated', newCamera));
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
private subscribeToCapabilityChanges(): Subscription {
|
|
367
|
-
return this.capabilities
|
|
368
|
-
.pipe(
|
|
369
|
-
pairwise(),
|
|
370
|
-
filter(([oldCapabilities, newCapabilities]) => !isEqual(oldCapabilities, newCapabilities, true)),
|
|
371
|
-
)
|
|
372
|
-
.subscribe(([, newCapabilities]) => {
|
|
373
|
-
this.triggerProxyEvent('capabilities', newCapabilities);
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
private subscribeToStateChanges<T extends keyof StateValues>(stateName: T, stateSubject: BehaviorSubject<StateValues[T]>): Subscription {
|
|
378
|
-
return stateSubject
|
|
379
|
-
.pipe(
|
|
380
|
-
pairwise(),
|
|
381
|
-
filter(([oldState, newState]) => {
|
|
382
|
-
return this.stateChanged(oldState, newState, stateName);
|
|
383
|
-
}),
|
|
384
|
-
)
|
|
385
|
-
.subscribe(([oldState, newState]) => {
|
|
386
|
-
this.triggerProxyEvent(stateName, newState, oldState);
|
|
387
|
-
|
|
388
|
-
switch (stateName) {
|
|
389
|
-
case 'motion':
|
|
390
|
-
this.motionStateChange(oldState as MotionState, newState as MotionState);
|
|
391
|
-
break;
|
|
392
|
-
case 'object':
|
|
393
|
-
this.objectStateChange(oldState as ObjectState, newState as ObjectState);
|
|
394
|
-
break;
|
|
395
|
-
case 'audio':
|
|
396
|
-
this.audioStateChange(oldState as AudioState, newState as AudioState);
|
|
397
|
-
break;
|
|
398
|
-
case 'doorbell':
|
|
399
|
-
this.doorbellStateChange(oldState as DoorbellState, newState as DoorbellState);
|
|
400
|
-
break;
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
private motionStateChange(oldState: MotionState, newState: MotionState): void {
|
|
406
|
-
if (oldState.state !== newState.state) {
|
|
407
|
-
this.logger.log('Motion state changed:', newState.state);
|
|
408
|
-
|
|
409
|
-
clearTimeout(this.motionTimeout);
|
|
410
|
-
|
|
411
|
-
if (newState.state) {
|
|
412
|
-
this.blockMotionResetEvents = true;
|
|
413
|
-
const timeout = this.detectionSettings.motion.timeout;
|
|
414
|
-
|
|
415
|
-
this.logger.trace(`Blocking motion reset events for ${timeout}s`);
|
|
416
|
-
|
|
417
|
-
this.motionTimeout = setTimeout(async () => {
|
|
418
|
-
this.logger.trace(`Motion timeout reached after ${timeout}s, unblocking motion reset events and resetting motion state`);
|
|
419
|
-
this.blockMotionResetEvents = false;
|
|
420
|
-
super.updateStateInternal('motion', { detections: [], state: false }, true);
|
|
421
|
-
}, timeout * 1000);
|
|
422
|
-
} else {
|
|
423
|
-
if (this.blockMotionResetEvents) {
|
|
424
|
-
this.logger.trace('Overriding motion reset event block, unblocking motion reset events');
|
|
425
|
-
this.blockMotionResetEvents = false;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
private objectStateChange(oldState: ObjectState, newState: ObjectState): void {
|
|
432
|
-
const lastEventLabels = Array.from(new Set(oldState.lastEvent?.detections.map((detection) => detection.label).filter(Boolean)));
|
|
433
|
-
const oldLabels = Array.from(new Set(oldState.detections.map((detection) => detection.label).filter(Boolean)));
|
|
434
|
-
const newLabels = Array.from(new Set(newState.detections.map((detection) => detection.label).filter(Boolean)));
|
|
435
|
-
|
|
436
|
-
const equalLabels = isEqual(oldLabels, newLabels, true);
|
|
437
|
-
const equalLastEventLabels = isEqual(lastEventLabels, newLabels, true);
|
|
438
|
-
|
|
439
|
-
if (!equalLabels && !equalLastEventLabels) {
|
|
440
|
-
if (newLabels.length) {
|
|
441
|
-
this.logger.log('Objects detected:', newLabels.join(', '));
|
|
442
|
-
} else {
|
|
443
|
-
// this.logger.log('No objects detected');
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
clearTimeout(this.objectTimeout);
|
|
448
|
-
|
|
449
|
-
if (newState.detections.length > 0) {
|
|
450
|
-
const timeout = this.objectTimeoutDuration;
|
|
451
|
-
this.objectTimeout = setTimeout(async () => {
|
|
452
|
-
super.updateStateInternal('object', { detections: [] }, true);
|
|
453
|
-
}, timeout * 1000);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
private audioStateChange(oldState: AudioState, newState: AudioState): void {
|
|
458
|
-
this.logger.log('Audio state changed:', newState.state);
|
|
459
|
-
|
|
460
|
-
clearTimeout(this.audioTimeout);
|
|
461
|
-
|
|
462
|
-
if (newState.state) {
|
|
463
|
-
const timeout = this.audioTimeoutDuration;
|
|
464
|
-
this.audioTimeout = setTimeout(async () => {
|
|
465
|
-
super.updateStateInternal('audio', { state: false, db: 0 }, true);
|
|
466
|
-
}, timeout * 1000);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
private doorbellStateChange(oldState: DoorbellState, newState: DoorbellState): void {
|
|
471
|
-
this.logger.log('Doorbell state changed:', newState.state);
|
|
472
|
-
|
|
473
|
-
if (newState.state) {
|
|
474
|
-
super.updateStateInternal('doorbell', { state: false }, true);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
private triggerProxyEvent(stateName: CameraDeviceListenerMessagePayload['type'], newEvent?: Camera | PluginCapabilities[] | boolean): void;
|
|
479
|
-
private triggerProxyEvent<T extends keyof StateValues>(stateName: T, newEvent: StateValues[T], oldEvent: StateValues[T]): void;
|
|
480
|
-
private triggerProxyEvent(
|
|
481
|
-
stateName: keyof StateValues | CameraDeviceListenerMessagePayload['type'],
|
|
482
|
-
newEvent?: StateValues[keyof StateValues] | Camera | PluginCapabilities[] | boolean,
|
|
483
|
-
oldEvent?: StateValues[keyof StateValues] | Camera,
|
|
484
|
-
): void {
|
|
485
|
-
if (this.isCameraEvent(stateName as CameraDeviceListenerMessagePayload['type'])) {
|
|
486
|
-
this.proxyServer.publishCameraEvent(this.id, stateName as CameraDeviceListenerMessagePayload['type'], newEvent);
|
|
487
|
-
} else {
|
|
488
|
-
this.proxyServer.publishCameraEvent(this.id, stateName as any, { newEvent, oldEvent });
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
private isCameraEvent(stateName: CameraDeviceListenerMessagePayload['type']): stateName is CameraDeviceListenerMessagePayload['type'] {
|
|
493
|
-
return stateName === 'updated' || stateName === 'removed' || stateName === 'cameraState' || stateName === 'frameWorkerState' || stateName === 'capabilities';
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
private clearTimers(): void {
|
|
497
|
-
clearTimeout(this.motionTimeout);
|
|
498
|
-
clearTimeout(this.objectTimeout);
|
|
499
|
-
clearTimeout(this.audioTimeout);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
private writeHeader(): void {
|
|
503
|
-
const date = new Date().toLocaleString('en-US');
|
|
504
|
-
const content = `${date}: ${this.name}`;
|
|
505
|
-
const lineLength = content.length + 3;
|
|
506
|
-
const line = '-'.repeat(lineLength);
|
|
507
|
-
|
|
508
|
-
this.safeWriteLog(`\n${line}\n`);
|
|
509
|
-
this.safeWriteLog(content.padEnd(lineLength));
|
|
510
|
-
this.safeWriteLog(`\n${line}\n\n`);
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
private closeLogStream(): void {
|
|
514
|
-
clearInterval(this.truncateInterval);
|
|
515
|
-
this.logStream?.close();
|
|
516
|
-
(this.logger as Logger).logStream = undefined;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
private removeLogStream(): void {
|
|
520
|
-
this.closeLogStream();
|
|
521
|
-
rmSync(this.logPath);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
private async disconnectRpc(): Promise<void> {
|
|
525
|
-
await this.proxy.unregisterRPCHandler(this.namespaces.cameraControllerRpc);
|
|
526
|
-
|
|
527
|
-
await Promise.allSettled(
|
|
528
|
-
Array.from(this.pluginIds).map((pluginId) => this.proxy.disconnectRPCConnection(NamespaceManager.pluginCameraNamespaces(pluginId, this.id).cameraStorageRpc)),
|
|
529
|
-
);
|
|
530
|
-
|
|
531
|
-
await this.cameraInterfaces.disconnect();
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
private async truncateLog(): Promise<void> {
|
|
535
|
-
if (!(await pathExists(this.logPath))) {
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
const maxSize = 1000000; // ~1 MB
|
|
540
|
-
const truncateSize = 200000; // ~0.2 MB
|
|
541
|
-
|
|
542
|
-
try {
|
|
543
|
-
const logStats = await stat(this.logPath);
|
|
544
|
-
|
|
545
|
-
if (logStats.size < maxSize) {
|
|
546
|
-
// this.logger.debug(`Log file size is less than ${maxSize} bytes, skipping truncate`);
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
// this.logger.debug(`Truncating log file to ${truncateSize} bytes...`);
|
|
551
|
-
|
|
552
|
-
const logStartPosition = logStats.size - truncateSize;
|
|
553
|
-
const logBuffer = Buffer.alloc(truncateSize);
|
|
554
|
-
const fileHandle = await open(this.logPath, 'r+');
|
|
555
|
-
|
|
556
|
-
try {
|
|
557
|
-
await readPromise(fileHandle.fd, logBuffer, 0, truncateSize, logStartPosition);
|
|
558
|
-
await truncatePromise(fileHandle.fd, 0);
|
|
559
|
-
await fileHandle.write(logBuffer, 0, truncateSize, 0);
|
|
560
|
-
} finally {
|
|
561
|
-
await fileHandle.close();
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// this.logger.debug('Log file truncated successfully');
|
|
565
|
-
} catch (e) {
|
|
566
|
-
this.logger.error(`Failed to truncate log file: ${e.message}`);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
private safeWriteLog(message: string): void {
|
|
571
|
-
if (this.logStream?.writable) {
|
|
572
|
-
try {
|
|
573
|
-
this.logStream?.write(message);
|
|
574
|
-
} catch {
|
|
575
|
-
// Ignore
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|