@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
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { isProcessRunning } from '@camera.ui/common';
|
|
2
|
-
import { ffmpegPath } from '@camera.ui/ffmpeg';
|
|
3
|
-
import fkill from 'fkill';
|
|
4
|
-
import { open } from 'lmdb';
|
|
5
|
-
import { exec } from 'node:child_process';
|
|
6
|
-
import { constants, existsSync } from 'node:fs';
|
|
7
|
-
import { access, unlink } from 'node:fs/promises';
|
|
8
|
-
import { createServer } from 'node:net';
|
|
9
|
-
import { promisify } from 'node:util';
|
|
10
|
-
import psList from 'ps-list';
|
|
11
|
-
import { container } from 'tsyringe';
|
|
12
|
-
|
|
13
|
-
import type { ConfigService } from '../../services/config/index.js';
|
|
14
|
-
|
|
15
|
-
export interface PathExistenceResult {
|
|
16
|
-
path: string;
|
|
17
|
-
exists: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface FFmpegExistenceResult {
|
|
21
|
-
path: string;
|
|
22
|
-
exists: boolean;
|
|
23
|
-
hasPermissions: boolean;
|
|
24
|
-
error?: Error;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface PathPermissionsResult {
|
|
28
|
-
path: string;
|
|
29
|
-
hasPermissions: boolean;
|
|
30
|
-
error?: Error;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface CleanedUpFilesResult {
|
|
34
|
-
path: string;
|
|
35
|
-
wasCleaned: boolean;
|
|
36
|
-
error?: Error;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface DatabaseCorruptionResult {
|
|
40
|
-
dbPath: string;
|
|
41
|
-
isCorrupt: boolean;
|
|
42
|
-
error?: Error;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface PortAvailabilityResult {
|
|
46
|
-
port: number;
|
|
47
|
-
isAvailable: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface OrphanedProcessesResult {
|
|
51
|
-
processInfo: ProcInfo;
|
|
52
|
-
killed?: boolean;
|
|
53
|
-
wasOrphaned?: boolean;
|
|
54
|
-
error?: Error;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface PathPermission {
|
|
58
|
-
path: string;
|
|
59
|
-
mode: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface ProcInfo {
|
|
63
|
-
pid: number;
|
|
64
|
-
startTime: number;
|
|
65
|
-
command: string;
|
|
66
|
-
args: string[];
|
|
67
|
-
titles?: string[];
|
|
68
|
-
uniqueId?: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const execAsync = promisify(exec);
|
|
72
|
-
|
|
73
|
-
async function defaultFFmpegPath(): Promise<string | undefined> {
|
|
74
|
-
try {
|
|
75
|
-
const command = process.platform === 'win32' ? 'where ffmpeg' : 'which ffmpeg';
|
|
76
|
-
const { stdout } = await execAsync(command);
|
|
77
|
-
const ffmpegPath = stdout.trim();
|
|
78
|
-
return ffmpegPath;
|
|
79
|
-
} catch {
|
|
80
|
-
//
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
async function isPortAvailable(port: number): Promise<boolean> {
|
|
85
|
-
return new Promise((resolve) => {
|
|
86
|
-
const server = createServer();
|
|
87
|
-
server.once('error', (err: NodeJS.ErrnoException) => {
|
|
88
|
-
server.close();
|
|
89
|
-
resolve(err.code !== 'EADDRINUSE');
|
|
90
|
-
});
|
|
91
|
-
server.once('listening', () => {
|
|
92
|
-
server.close();
|
|
93
|
-
resolve(true);
|
|
94
|
-
});
|
|
95
|
-
server.listen(port);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async function isOwnProcess(processInfo: ProcInfo): Promise<boolean> {
|
|
100
|
-
const processes = await psList();
|
|
101
|
-
const proc = processes.find((p) => p.pid === processInfo.pid);
|
|
102
|
-
|
|
103
|
-
if (!proc) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const isCommandMatch = Boolean(proc.name === processInfo.command || proc.cmd?.includes(processInfo.command));
|
|
108
|
-
const areArgsMatch = processInfo.args.every((arg) => proc.cmd?.includes(arg));
|
|
109
|
-
const idMatch = Boolean(processInfo.uniqueId ? proc.cmd?.includes(processInfo.uniqueId) : false);
|
|
110
|
-
const titleMatch = Boolean(processInfo.titles ? processInfo.titles.some((title) => proc.name?.includes(title) || proc.cmd?.includes(title)) : false);
|
|
111
|
-
|
|
112
|
-
if (idMatch || titleMatch || (isCommandMatch && areArgsMatch)) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export async function checkPathsExist(pathsToCheck: string[]): Promise<PathExistenceResult[]> {
|
|
120
|
-
const results: PathExistenceResult[] = [];
|
|
121
|
-
|
|
122
|
-
for (const path of pathsToCheck) {
|
|
123
|
-
const exists = existsSync(path);
|
|
124
|
-
results.push({ path, exists });
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return results;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export async function checkPathPermissions(pathsWithPermissionsToCheck: PathPermission[]): Promise<PathPermissionsResult[]> {
|
|
131
|
-
const results: PathPermissionsResult[] = [];
|
|
132
|
-
|
|
133
|
-
for (const { path, mode } of pathsWithPermissionsToCheck) {
|
|
134
|
-
try {
|
|
135
|
-
await access(path, mode);
|
|
136
|
-
results.push({ path, hasPermissions: true });
|
|
137
|
-
} catch (err) {
|
|
138
|
-
results.push({ path, hasPermissions: false, error: err as Error });
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return results;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export async function cleanUpFiles(filesToClean: string[]): Promise<CleanedUpFilesResult[]> {
|
|
146
|
-
const cleanedFiles: CleanedUpFilesResult[] = [];
|
|
147
|
-
|
|
148
|
-
for (const file of filesToClean) {
|
|
149
|
-
try {
|
|
150
|
-
await access(file, constants.W_OK);
|
|
151
|
-
await unlink(file);
|
|
152
|
-
|
|
153
|
-
cleanedFiles.push({ path: file, wasCleaned: true });
|
|
154
|
-
} catch (err) {
|
|
155
|
-
cleanedFiles.push({ path: file, wasCleaned: false, error: err as Error });
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return cleanedFiles;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export async function checkDatabaseCorruption(dbPath: string): Promise<DatabaseCorruptionResult> {
|
|
163
|
-
try {
|
|
164
|
-
const db = open({
|
|
165
|
-
path: dbPath,
|
|
166
|
-
readOnly: true,
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
await db.get('test_key');
|
|
170
|
-
await db.close();
|
|
171
|
-
|
|
172
|
-
return { dbPath, isCorrupt: false };
|
|
173
|
-
} catch (err) {
|
|
174
|
-
return { dbPath, isCorrupt: true, error: err as Error };
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export async function checkPortAvailability(portsToCheck: number[]): Promise<PortAvailabilityResult[]> {
|
|
179
|
-
const results: PortAvailabilityResult[] = [];
|
|
180
|
-
|
|
181
|
-
for (const port of portsToCheck) {
|
|
182
|
-
const isAvailable = await isPortAvailable(port);
|
|
183
|
-
results.push({ port, isAvailable });
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return results;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export async function checkFfmpegBinary(ffmpegPaths: string[]): Promise<PathExistenceResult[]> {
|
|
190
|
-
const results: PathExistenceResult[] = [];
|
|
191
|
-
|
|
192
|
-
for (const ffmpegPath of ffmpegPaths) {
|
|
193
|
-
try {
|
|
194
|
-
await access(ffmpegPath, constants.X_OK);
|
|
195
|
-
results.push({ exists: true, path: ffmpegPath });
|
|
196
|
-
} catch {
|
|
197
|
-
results.push({ exists: false, path: ffmpegPath });
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return results;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export async function checkOrphanedProcesses(processInfos: ProcInfo[]): Promise<OrphanedProcessesResult[]> {
|
|
205
|
-
const configService = container.resolve<ConfigService>('configService');
|
|
206
|
-
const results: OrphanedProcessesResult[] = [];
|
|
207
|
-
|
|
208
|
-
for (const processInfo of processInfos) {
|
|
209
|
-
try {
|
|
210
|
-
const isRunning = isProcessRunning(processInfo.pid);
|
|
211
|
-
if (isRunning) {
|
|
212
|
-
const isOwnProc = await isOwnProcess(processInfo);
|
|
213
|
-
if (isOwnProc) {
|
|
214
|
-
const info: OrphanedProcessesResult = {
|
|
215
|
-
processInfo,
|
|
216
|
-
wasOrphaned: true,
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
try {
|
|
220
|
-
await fkill(processInfo.pid, { force: true });
|
|
221
|
-
info.killed = true;
|
|
222
|
-
} catch (error) {
|
|
223
|
-
info.killed = false;
|
|
224
|
-
info.error = error as Error;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
results.push(info);
|
|
228
|
-
} else {
|
|
229
|
-
results.push({ processInfo, wasOrphaned: false });
|
|
230
|
-
configService.removeProcessByPID(processInfo.pid);
|
|
231
|
-
}
|
|
232
|
-
} else {
|
|
233
|
-
results.push({ processInfo, wasOrphaned: false });
|
|
234
|
-
configService.removeProcessByPID(processInfo.pid);
|
|
235
|
-
}
|
|
236
|
-
} catch (err) {
|
|
237
|
-
results.push({ processInfo, error: err as Error });
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return results;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export async function checkInstalledFFmpegs(): Promise<FFmpegExistenceResult[]> {
|
|
245
|
-
const configService = container.resolve<ConfigService>('configService');
|
|
246
|
-
const results: FFmpegExistenceResult[] = [];
|
|
247
|
-
|
|
248
|
-
const osFFmpegPath = await defaultFFmpegPath();
|
|
249
|
-
const ffmpegPaths = new Set<string>([configService.go2rtcConfig.ffmpeg.binary, ffmpegPath(), osFFmpegPath].filter(Boolean) as string[]);
|
|
250
|
-
|
|
251
|
-
for (const ffmpegPath of ffmpegPaths) {
|
|
252
|
-
const exists = existsSync(ffmpegPath);
|
|
253
|
-
|
|
254
|
-
if (!exists) {
|
|
255
|
-
results.push({ path: ffmpegPath, exists, hasPermissions: false });
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
try {
|
|
260
|
-
await access(ffmpegPath, constants.X_OK);
|
|
261
|
-
results.push({ exists, path: ffmpegPath, hasPermissions: true });
|
|
262
|
-
} catch (error) {
|
|
263
|
-
results.push({ exists, path: ffmpegPath, hasPermissions: false, error: error as Error });
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return results;
|
|
268
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const CAMERAS_ID = 'cameras';
|
|
2
|
-
export const DATABASE_ID = 'database';
|
|
3
|
-
export const PLUGINS_ID = 'plugins';
|
|
4
|
-
export const USER_PLUGINS_ID = 'user-plugins';
|
|
5
|
-
export const SETTINGS_ID = 'settings';
|
|
6
|
-
export const USERS_ID = 'users';
|
|
7
|
-
export const SYSTEM_ID = 'system';
|
|
8
|
-
export const TOKENS_ID = 'tokens';
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { createSourceName, sleep } from '@camera.ui/common/utils';
|
|
2
|
-
import { open } from 'lmdb';
|
|
3
|
-
import { createHmac, randomBytes, randomUUID } from 'node:crypto';
|
|
4
|
-
import semver from 'semver';
|
|
5
|
-
import { container } from 'tsyringe';
|
|
6
|
-
|
|
7
|
-
import { API_EVENT } from '../../api.js';
|
|
8
|
-
import { CAMERAS_ID, DATABASE_ID, PLUGINS_ID, SETTINGS_ID, SYSTEM_ID, TOKENS_ID, USERS_ID } from './constants.js';
|
|
9
|
-
import { DatabaseMigrationTable } from './migration.js';
|
|
10
|
-
import { SelfCheck } from './selfcheck.js';
|
|
11
|
-
|
|
12
|
-
import type { Database as DB, RootDatabase as RootDB } from 'lmdb';
|
|
13
|
-
import type { CameraUiAPI } from '../../api.js';
|
|
14
|
-
import type { ConfigService } from '../../services/config/index.js';
|
|
15
|
-
import type { LoggerService } from '../../services/logger/index.js';
|
|
16
|
-
import type { DBAuth, DBCamera, DBPlugin, DBSettings, DBSystem, DBUser } from './types.js';
|
|
17
|
-
|
|
18
|
-
export class Database {
|
|
19
|
-
static readonly VERSION = '2.0.0';
|
|
20
|
-
|
|
21
|
-
public authDB: RootDB<DBAuth, 'auth'>;
|
|
22
|
-
public camerasDB: DB<DBCamera[], 'cameras'>;
|
|
23
|
-
public pluginsDB: DB<DBPlugin[], 'plugins'>;
|
|
24
|
-
public settingsDB: DB<DBSettings, 'settings'>;
|
|
25
|
-
public usersDB: DB<DBUser[], 'users'>;
|
|
26
|
-
public systemDB: DB<DBSystem, 'system'>;
|
|
27
|
-
|
|
28
|
-
private lowdb: RootDB;
|
|
29
|
-
private databaseMigration: DatabaseMigrationTable;
|
|
30
|
-
private selfCheck: SelfCheck;
|
|
31
|
-
|
|
32
|
-
private configService: ConfigService;
|
|
33
|
-
private logger: LoggerService;
|
|
34
|
-
private api: CameraUiAPI;
|
|
35
|
-
|
|
36
|
-
constructor() {
|
|
37
|
-
container.registerInstance('dbs', this);
|
|
38
|
-
|
|
39
|
-
this.configService = container.resolve<ConfigService>('configService');
|
|
40
|
-
this.logger = container.resolve<LoggerService>('logger');
|
|
41
|
-
this.api = container.resolve<CameraUiAPI>('api');
|
|
42
|
-
this.authDB = open({
|
|
43
|
-
path: this.configService.TOKENS_PATH,
|
|
44
|
-
name: TOKENS_ID,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
this.lowdb = open({
|
|
48
|
-
path: this.configService.DATABASE_PATH,
|
|
49
|
-
name: DATABASE_ID,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
this.camerasDB = this.lowdb.openDB({
|
|
53
|
-
name: CAMERAS_ID,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
this.pluginsDB = this.lowdb.openDB({
|
|
57
|
-
name: PLUGINS_ID,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
this.settingsDB = this.lowdb.openDB({
|
|
61
|
-
name: SETTINGS_ID,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
this.usersDB = this.lowdb.openDB({
|
|
65
|
-
name: USERS_ID,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
this.systemDB = this.lowdb.openDB({
|
|
69
|
-
name: SYSTEM_ID,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
this.selfCheck = new SelfCheck();
|
|
73
|
-
this.databaseMigration = new DatabaseMigrationTable(this.authDB, this.camerasDB, this.pluginsDB, this.settingsDB, this.usersDB, this.systemDB);
|
|
74
|
-
|
|
75
|
-
this.logger.debug('Databases opened!');
|
|
76
|
-
|
|
77
|
-
this.api.setMaxListeners(this.api.getMaxListeners() + 1);
|
|
78
|
-
this.api.once(API_EVENT.SHUTDOWN, this.close.bind(this));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public async initialize(): Promise<void> {
|
|
82
|
-
this.logger.debug('Initializing database...');
|
|
83
|
-
|
|
84
|
-
await this.checkOldVersion();
|
|
85
|
-
await this.selfCheck.run();
|
|
86
|
-
await this.ensureDatabases();
|
|
87
|
-
await this.prepareDatabases();
|
|
88
|
-
await this.ensureMaster();
|
|
89
|
-
await this.databaseMigration.migrate();
|
|
90
|
-
this.updateConfig();
|
|
91
|
-
|
|
92
|
-
this.logger.debug('Database initialized!');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public async close(): Promise<void> {
|
|
96
|
-
await Promise.allSettled([this.authDB.close(), this.lowdb.close()]);
|
|
97
|
-
this.logger.debug('Databases closed!');
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public async updateCameras(): Promise<void> {
|
|
101
|
-
const cameras = this.camerasDB.get('cameras') ?? [];
|
|
102
|
-
|
|
103
|
-
for (const camera of cameras) {
|
|
104
|
-
const go2rtcSources = Object.keys(this.configService.go2rtcConfig.streams ?? {});
|
|
105
|
-
|
|
106
|
-
for (const source of camera.sources) {
|
|
107
|
-
const sourceName = createSourceName(camera.name, source.name);
|
|
108
|
-
if (go2rtcSources.includes(sourceName)) {
|
|
109
|
-
let go2rtcUrls = this.configService.go2rtcConfig.streams?.[sourceName] ?? [];
|
|
110
|
-
go2rtcUrls = Array.isArray(go2rtcUrls) ? go2rtcUrls : [go2rtcUrls];
|
|
111
|
-
source.urls = go2rtcUrls.filter((url) => !url.includes('#cameraui'));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
await this.camerasDB.put('cameras', cameras);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
private async checkOldVersion(): Promise<void> {
|
|
120
|
-
const settingsDB = this.settingsDB.get('settings');
|
|
121
|
-
const oldVersion = settingsDB?.version ?? Database.VERSION;
|
|
122
|
-
|
|
123
|
-
if (semver.lt(oldVersion, '2.0.0')) {
|
|
124
|
-
this.logger.attention('Database version is too old! camera.ui will reset the database and restart!');
|
|
125
|
-
|
|
126
|
-
this.configService.reset();
|
|
127
|
-
|
|
128
|
-
await this.settingsDB.put('settings', {
|
|
129
|
-
version: Database.VERSION,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
await sleep(1000);
|
|
133
|
-
|
|
134
|
-
process.exit(0);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private async ensureDatabases(): Promise<void> {
|
|
139
|
-
const authDB = this.authDB.get('auth');
|
|
140
|
-
if (!authDB) {
|
|
141
|
-
await this.authDB.put('auth', {
|
|
142
|
-
tokens: [],
|
|
143
|
-
clients: [],
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const camerasDB = this.camerasDB.get('cameras');
|
|
148
|
-
if (!camerasDB) {
|
|
149
|
-
await this.camerasDB.put('cameras', []);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const usersDB = this.usersDB.get('users');
|
|
153
|
-
if (!usersDB) {
|
|
154
|
-
await this.usersDB.put('users', []);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const pluginsDB = this.pluginsDB.get('plugins');
|
|
158
|
-
if (!pluginsDB) {
|
|
159
|
-
await this.pluginsDB.put('plugins', []);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const settingsDB = this.settingsDB.get('settings');
|
|
163
|
-
if (!settingsDB) {
|
|
164
|
-
await this.settingsDB.put('settings', {
|
|
165
|
-
version: Database.VERSION,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const systemDB = this.systemDB.get('system');
|
|
170
|
-
if (!systemDB) {
|
|
171
|
-
await this.systemDB.put('system', {
|
|
172
|
-
serverAddresses: [],
|
|
173
|
-
remoteAccess: {
|
|
174
|
-
mode: 'disabled',
|
|
175
|
-
cloudflare: {},
|
|
176
|
-
customDomain: {},
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
private async prepareDatabases(): Promise<void> {
|
|
183
|
-
const systemDB = this.systemDB.get('system');
|
|
184
|
-
const serverAddresses = systemDB?.serverAddresses ?? [];
|
|
185
|
-
await this.configService.updateGo2RtcWebRtcFilter(serverAddresses, undefined);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
private async ensureMaster(): Promise<void> {
|
|
189
|
-
const users = this.usersDB.get('users') ?? [];
|
|
190
|
-
let master = users.find((user) => user.role === 'master');
|
|
191
|
-
|
|
192
|
-
if (!master) {
|
|
193
|
-
this.logger.attention('No master found! Creating new master...');
|
|
194
|
-
master = this.generateMaster();
|
|
195
|
-
users.push(master);
|
|
196
|
-
await this.usersDB.put('users', users);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
private generateMaster(): DBUser {
|
|
201
|
-
const salt = randomBytes(16).toString('base64');
|
|
202
|
-
const hash = createHmac('sha512', salt).update('admin').digest('base64');
|
|
203
|
-
|
|
204
|
-
return {
|
|
205
|
-
_id: randomUUID(),
|
|
206
|
-
avatar: 'logo-256.png',
|
|
207
|
-
username: 'admin',
|
|
208
|
-
password: salt + '$' + hash,
|
|
209
|
-
sessionTimer: 14400,
|
|
210
|
-
role: 'master',
|
|
211
|
-
rememberMe: false,
|
|
212
|
-
firstLogin: true,
|
|
213
|
-
singleSession: false,
|
|
214
|
-
preferences: {
|
|
215
|
-
camview: {
|
|
216
|
-
views: [],
|
|
217
|
-
},
|
|
218
|
-
cameras: {},
|
|
219
|
-
},
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
private updateConfig(): void {
|
|
224
|
-
const cameras = this.camerasDB.get('cameras') ?? [];
|
|
225
|
-
|
|
226
|
-
this.configService.go2rtcConfig.streams ??= {};
|
|
227
|
-
|
|
228
|
-
for (const camera of cameras) {
|
|
229
|
-
const go2rtcSources = Object.keys(this.configService.go2rtcConfig.streams || {});
|
|
230
|
-
|
|
231
|
-
for (const source of camera.sources) {
|
|
232
|
-
source.urls = source.urls.map((url) => {
|
|
233
|
-
if (url.startsWith('cui://')) {
|
|
234
|
-
url = `cui://127.0.0.1:${this.configService.config.port}/api/cameras/streams/${camera._id}/${source.name}`;
|
|
235
|
-
}
|
|
236
|
-
return url;
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
const sourceName = createSourceName(camera.name, source.name);
|
|
240
|
-
const ffmpegUrl = `ffmpeg:${sourceName}#cameraui#audio=pcma#audio=opus#audio=aac`;
|
|
241
|
-
const baseUrls = [...source.urls, ffmpegUrl];
|
|
242
|
-
|
|
243
|
-
if (!go2rtcSources.includes(sourceName)) {
|
|
244
|
-
this.configService.go2rtcConfig.streams[sourceName] = baseUrls;
|
|
245
|
-
} else {
|
|
246
|
-
let go2rtcUrls = this.configService.go2rtcConfig.streams[sourceName] ?? [];
|
|
247
|
-
go2rtcUrls = Array.isArray(go2rtcUrls) ? go2rtcUrls : [go2rtcUrls];
|
|
248
|
-
|
|
249
|
-
const hasFFmpegUrl = go2rtcUrls.some((url) => url.startsWith('ffmpeg:') && url.includes('#cameraui'));
|
|
250
|
-
if (!hasFFmpegUrl && source.role !== 'snapshot') {
|
|
251
|
-
go2rtcUrls.push(ffmpegUrl);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
this.configService.go2rtcConfig.streams[sourceName] = go2rtcUrls;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// update manually go2rtc config file, because go2rtc is not running yet
|
|
260
|
-
this.configService.writeGo2RtcConfigFile();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import semver from 'semver';
|
|
2
|
-
import { container } from 'tsyringe';
|
|
3
|
-
|
|
4
|
-
import { Database } from './index.js';
|
|
5
|
-
|
|
6
|
-
import type { Database as DB, RootDatabase as RootDB } from 'lmdb';
|
|
7
|
-
import type { ConfigService } from '../../services/config/index.js';
|
|
8
|
-
import type { LoggerService } from '../../services/logger/index.js';
|
|
9
|
-
import type { DBAuth, DBCamera, DBPlugin, DBSettings, DBSystem, DBUser } from './types.js';
|
|
10
|
-
|
|
11
|
-
export class DatabaseMigrationTable {
|
|
12
|
-
private logger: LoggerService;
|
|
13
|
-
private configService: ConfigService;
|
|
14
|
-
|
|
15
|
-
constructor(
|
|
16
|
-
private authDB: RootDB<DBAuth, 'auth'>,
|
|
17
|
-
private camerasDB: DB<DBCamera[], 'cameras'>,
|
|
18
|
-
private pluginsDB: DB<DBPlugin[], 'plugins'>,
|
|
19
|
-
private settingsDB: DB<DBSettings, 'settings'>,
|
|
20
|
-
private usersDB: DB<DBUser[], 'users'>,
|
|
21
|
-
private systemDB: DB<DBSystem, 'system'>,
|
|
22
|
-
) {
|
|
23
|
-
this.logger = container.resolve<LoggerService>('logger');
|
|
24
|
-
this.configService = container.resolve<ConfigService>('configService');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public async migrate(): Promise<void> {
|
|
28
|
-
const settingsDb = this.settingsDB.get('settings')!;
|
|
29
|
-
|
|
30
|
-
const oldVersion = settingsDb.version;
|
|
31
|
-
const newVersion = Database.VERSION;
|
|
32
|
-
|
|
33
|
-
if (semver.eq(oldVersion, newVersion)) {
|
|
34
|
-
this.logger.log('Database is up to date. Version:', newVersion);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (semver.gt(oldVersion, newVersion)) {
|
|
39
|
-
this.logger.log(`Database version ${oldVersion} is greater than the current version ${newVersion}, skipping migration.`);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
this.logger.attention(`Database migration from ${oldVersion} to ${newVersion}`);
|
|
44
|
-
|
|
45
|
-
const migrations = this.getMigrations();
|
|
46
|
-
for (const migration of migrations) {
|
|
47
|
-
if (semver.gt(migration.version, oldVersion) && semver.lte(migration.version, newVersion)) {
|
|
48
|
-
this.logger.trace(`Applying migration to version ${migration.version}`);
|
|
49
|
-
await migration.up();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
settingsDb.version = newVersion;
|
|
54
|
-
await this.settingsDB.put('settings', settingsDb);
|
|
55
|
-
|
|
56
|
-
this.logger.log('Database migration completed');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private getMigrations(): { version: string; up: () => Promise<void> }[] {
|
|
60
|
-
return [];
|
|
61
|
-
}
|
|
62
|
-
}
|