@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,470 +0,0 @@
|
|
|
1
|
-
import { getNpmPath } from '@camera.ui/common/node';
|
|
2
|
-
import { cyan, green, red, type AnsicolorMethods } from 'ansicolor';
|
|
3
|
-
import { ensureDir, move, pathExists, readJson, remove } from 'fs-extra/esm';
|
|
4
|
-
import { spawn } from 'node:child_process';
|
|
5
|
-
import { createHash } from 'node:crypto';
|
|
6
|
-
import { platform, tmpdir, userInfo } from 'node:os';
|
|
7
|
-
import { basename, dirname, join } from 'node:path';
|
|
8
|
-
import { extract } from 'tar';
|
|
9
|
-
import { container, delay, registry } from 'tsyringe';
|
|
10
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
11
|
-
|
|
12
|
-
import { PluginManager } from '../../plugins/index.js';
|
|
13
|
-
import { Plugin } from '../../plugins/plugin.js';
|
|
14
|
-
import { Database } from '../database/index.js';
|
|
15
|
-
import { CamerasService } from './cameras.service.js';
|
|
16
|
-
|
|
17
|
-
import type { Server } from 'socket.io';
|
|
18
|
-
import type { PluginWorker } from '../../plugins/worker.js';
|
|
19
|
-
import type { ConfigService } from '../../services/config/index.js';
|
|
20
|
-
import type { LoggerService } from '../../services/logger/index.js';
|
|
21
|
-
import type { DBPlugin } from '../database/types.js';
|
|
22
|
-
import type { PluginsProgress } from '../types/index.js';
|
|
23
|
-
import type { SocketService } from '../websocket/index.js';
|
|
24
|
-
|
|
25
|
-
@registry([
|
|
26
|
-
{
|
|
27
|
-
token: 'dbs',
|
|
28
|
-
useValue: delay(() => Database),
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
token: 'pluginManager',
|
|
32
|
-
useValue: delay(() => PluginManager),
|
|
33
|
-
},
|
|
34
|
-
])
|
|
35
|
-
export class PluginsService {
|
|
36
|
-
private dbs: Database;
|
|
37
|
-
private io: Server;
|
|
38
|
-
private logger: LoggerService;
|
|
39
|
-
private pluginManager: PluginManager;
|
|
40
|
-
private configService: ConfigService;
|
|
41
|
-
private socketService: SocketService;
|
|
42
|
-
|
|
43
|
-
private managingPluginsMap = new Map<string, PluginsProgress>();
|
|
44
|
-
|
|
45
|
-
constructor() {
|
|
46
|
-
this.dbs = container.resolve<Database>('dbs');
|
|
47
|
-
this.logger = container.resolve<LoggerService>('logger');
|
|
48
|
-
this.pluginManager = container.resolve<PluginManager>('pluginManager');
|
|
49
|
-
this.configService = container.resolve<ConfigService>('configService');
|
|
50
|
-
this.socketService = container.resolve<SocketService>('socketService');
|
|
51
|
-
|
|
52
|
-
this.io = this.socketService.io;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public listPlugins(): Plugin[] {
|
|
56
|
-
return Array.from(this.pluginManager.plugins).map(([, plugin]) => plugin);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public listPluginProcesses(): PluginWorker[] {
|
|
60
|
-
return Array.from(this.pluginManager.plugins).map(([, plugin]) => plugin.worker);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public listPluginsIdentifier(): string[] {
|
|
64
|
-
return Array.from(this.pluginManager.pluginIdentifiers);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// installed plugins
|
|
68
|
-
public getPluginByName(pluginName: string): Plugin | undefined {
|
|
69
|
-
const installedPlugins = this.listPlugins();
|
|
70
|
-
const plugin = installedPlugins.find((plugin) => plugin.pluginName === pluginName);
|
|
71
|
-
return plugin;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public getPluginById(id: string): Plugin | undefined {
|
|
75
|
-
const installedPlugins = this.listPlugins();
|
|
76
|
-
const plugin = installedPlugins.find((plugin) => plugin.id === id);
|
|
77
|
-
return plugin;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public getPluginProcessByName(pluginName: string): PluginWorker | undefined {
|
|
81
|
-
const installedPluginsProcesses = this.listPluginProcesses();
|
|
82
|
-
const plugin = installedPluginsProcesses.find((pluginProcess) => pluginProcess.plugin.pluginName === pluginName);
|
|
83
|
-
return plugin;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public getPluginProcessById(id: string): PluginWorker | undefined {
|
|
87
|
-
const installedPluginsProcesses = this.listPluginProcesses();
|
|
88
|
-
const plugin = installedPluginsProcesses.find((pluginProcess) => pluginProcess.plugin.id === id);
|
|
89
|
-
return plugin;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// db plugins
|
|
93
|
-
public listPluginDb(): DBPlugin[] {
|
|
94
|
-
return this.dbs.pluginsDB.get('plugins') ?? [];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public getPluginDbByName(pluginName: string): DBPlugin | undefined {
|
|
98
|
-
const plugins = this.dbs.pluginsDB.get('plugins') ?? [];
|
|
99
|
-
return plugins.find((pluginObj) => pluginObj.pluginName === pluginName);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public getPluginDbById(id: string): DBPlugin | undefined {
|
|
103
|
-
const plugins = this.dbs.pluginsDB.get('plugins') ?? [];
|
|
104
|
-
return plugins.find((pluginObj) => pluginObj._id === id);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public async insertPluginDb(pluginName: string, oldId?: string): Promise<DBPlugin> {
|
|
108
|
-
const plugins = this.dbs.pluginsDB.get('plugins') ?? [];
|
|
109
|
-
const pluginExist = plugins.find((pluginObj) => pluginObj.pluginName === pluginName);
|
|
110
|
-
|
|
111
|
-
if (pluginExist) {
|
|
112
|
-
return pluginExist;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const pluginData: DBPlugin = {
|
|
116
|
-
_id: oldId ?? uuidv4(),
|
|
117
|
-
pluginName,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
plugins.push(pluginData);
|
|
121
|
-
await this.dbs.pluginsDB.put('plugins', plugins);
|
|
122
|
-
|
|
123
|
-
return pluginData;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public async removePluginDbByName(pluginName: string): Promise<void> {
|
|
127
|
-
const camerasService = new CamerasService();
|
|
128
|
-
await camerasService.removeByPluginName(pluginName);
|
|
129
|
-
|
|
130
|
-
let plugins = this.dbs.pluginsDB.get('plugins') ?? [];
|
|
131
|
-
plugins = plugins.filter((pluginObj) => pluginObj.pluginName !== pluginName);
|
|
132
|
-
|
|
133
|
-
await this.dbs.pluginsDB.put('plugins', plugins);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
public async removePluginDbById(id: string): Promise<void> {
|
|
137
|
-
const camerasService = new CamerasService();
|
|
138
|
-
await camerasService.removeByPluginId(id);
|
|
139
|
-
|
|
140
|
-
let plugins = this.dbs.pluginsDB.get('plugins') ?? [];
|
|
141
|
-
plugins = plugins.filter((pluginObj) => pluginObj._id !== id);
|
|
142
|
-
|
|
143
|
-
await this.dbs.pluginsDB.put('plugins', plugins);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public async removeAllPluginsDb(): Promise<void> {
|
|
147
|
-
const plugins = this.dbs.pluginsDB.get('plugins') ?? [];
|
|
148
|
-
|
|
149
|
-
const camerasService = new CamerasService();
|
|
150
|
-
|
|
151
|
-
for (const plugin of plugins) {
|
|
152
|
-
await camerasService.removeByPluginName(plugin.pluginName);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
await this.dbs.pluginsDB.put('plugins', []);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
public async removeOrphanPluginsDb(): Promise<void> {
|
|
159
|
-
let plugins = this.dbs.pluginsDB.get('plugins') ?? [];
|
|
160
|
-
const orphanedPlugins: string[] = [];
|
|
161
|
-
|
|
162
|
-
plugins.forEach((pluginObj) => {
|
|
163
|
-
const pluginExist = this.getPluginByName(pluginObj.pluginName);
|
|
164
|
-
const pluginIdentifierExist = this.listPluginsIdentifier().includes(pluginObj.pluginName);
|
|
165
|
-
|
|
166
|
-
if (!pluginExist && !pluginIdentifierExist) {
|
|
167
|
-
orphanedPlugins.push(pluginObj.pluginName);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
await Promise.all(orphanedPlugins.map((pluginName) => this.removePluginDbByName(pluginName)));
|
|
172
|
-
|
|
173
|
-
plugins = plugins.filter((pluginObj) => !orphanedPlugins.includes(pluginObj.pluginName));
|
|
174
|
-
|
|
175
|
-
await this.dbs.pluginsDB.put('plugins', plugins);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
public async handleDisabledPlugins(): Promise<void> {
|
|
179
|
-
const camerasService = new CamerasService();
|
|
180
|
-
const plugins = this.listPlugins();
|
|
181
|
-
const disabledPlugins: string[] = plugins.filter((plugin) => plugin.disabled).map((plugin) => plugin.pluginName);
|
|
182
|
-
|
|
183
|
-
for (const pluginName of disabledPlugins) {
|
|
184
|
-
await camerasService.removeByPluginName(pluginName);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
public async manage(pluginName: string, action: 'install' | 'update' | 'uninstall', version?: string, pluginId?: string): Promise<string> {
|
|
189
|
-
const targetDir = join(this.configService.PLUGINS_INSTALL_PATH, pluginName);
|
|
190
|
-
|
|
191
|
-
this.emitProgress(pluginName, `USER: ${userInfo().username}\r\n`, cyan);
|
|
192
|
-
this.emitProgress(pluginName, `DIR: ${targetDir}\r\n`, cyan);
|
|
193
|
-
this.emitProgress(pluginName, `ACTION: ${action}\r\r\n\n`, cyan);
|
|
194
|
-
|
|
195
|
-
const existingAction = this.managingPluginsMap.get(pluginName);
|
|
196
|
-
if (existingAction) {
|
|
197
|
-
this.emitProgress(pluginName, `\r\n\r\nError: Cannot ${action} plugin ${pluginName} while ${existingAction.action} is in progress.\r\n\r\n'`, red);
|
|
198
|
-
throw new Error(`Cannot ${action} plugin ${pluginName} while ${existingAction.action} is in progress.`);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
this.managingPluginsMap.set(pluginName, { pluginName, action, version: version ?? 'latest' });
|
|
202
|
-
|
|
203
|
-
switch (action) {
|
|
204
|
-
case 'install':
|
|
205
|
-
await this.installPlugin(pluginName, version ?? 'latest', targetDir);
|
|
206
|
-
break;
|
|
207
|
-
case 'update':
|
|
208
|
-
await this.updatePlugin(pluginName, version ?? 'latest', targetDir);
|
|
209
|
-
break;
|
|
210
|
-
case 'uninstall':
|
|
211
|
-
await this.uninstallPlugin(pluginName, targetDir);
|
|
212
|
-
|
|
213
|
-
if (pluginId) {
|
|
214
|
-
const camerasService = new CamerasService();
|
|
215
|
-
await camerasService.removeByPluginId(pluginId);
|
|
216
|
-
}
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
this.managingPluginsMap.delete(pluginName);
|
|
221
|
-
|
|
222
|
-
return targetDir;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
public installingPlugins(): PluginsProgress[] {
|
|
226
|
-
const pluginsInProgress: PluginsProgress[] = [];
|
|
227
|
-
for (const [, progressInfo] of this.managingPluginsMap) {
|
|
228
|
-
pluginsInProgress.push(progressInfo);
|
|
229
|
-
}
|
|
230
|
-
return pluginsInProgress;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
private async installPlugin(pluginName: string, version: string, targetDir: string, update?: boolean): Promise<void> {
|
|
234
|
-
const backupTempDir = join(tmpdir(), `${pluginName}_backup`);
|
|
235
|
-
|
|
236
|
-
try {
|
|
237
|
-
const npmRegistry = 'https://registry.npmjs.org';
|
|
238
|
-
const packageUrl = `${npmRegistry}/${pluginName}/${version}`;
|
|
239
|
-
|
|
240
|
-
this.emitProgress(pluginName, '> Fetching package information...');
|
|
241
|
-
|
|
242
|
-
const response = await fetch(packageUrl);
|
|
243
|
-
if (!response.ok) {
|
|
244
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const packageInfo = await response.json();
|
|
248
|
-
const tarballUrl = packageInfo.dist.tarball;
|
|
249
|
-
const expectedShasum = packageInfo.dist.shasum;
|
|
250
|
-
|
|
251
|
-
this.emitProgress(pluginName, ' Done\r\n\r\n', green);
|
|
252
|
-
|
|
253
|
-
const tarballData = await this.downloadWithProgress(tarballUrl, pluginName, version);
|
|
254
|
-
this.emitProgress(pluginName, ' - Done\r\n\r\n', green);
|
|
255
|
-
|
|
256
|
-
this.emitProgress(pluginName, '> Verifying package integrity...');
|
|
257
|
-
const computedShasum = createHash('sha1').update(Buffer.from(tarballData)).digest('hex');
|
|
258
|
-
if (computedShasum !== expectedShasum) {
|
|
259
|
-
throw new Error(`SHA checksum mismatch. Expected: ${expectedShasum}, Got: ${computedShasum}`);
|
|
260
|
-
}
|
|
261
|
-
this.emitProgress(pluginName, ' Done\r\n\r\n', green);
|
|
262
|
-
|
|
263
|
-
if (await pathExists(targetDir)) {
|
|
264
|
-
this.emitProgress(pluginName, '> Backing up existing installation...');
|
|
265
|
-
await move(targetDir, backupTempDir);
|
|
266
|
-
this.emitProgress(pluginName, ' Done\r\n\r\n', green);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
await ensureDir(targetDir);
|
|
270
|
-
|
|
271
|
-
this.emitProgress(pluginName, '> Extracting package...');
|
|
272
|
-
|
|
273
|
-
await new Promise<void>((resolve, reject) => {
|
|
274
|
-
const extractStream = extract({
|
|
275
|
-
cwd: targetDir,
|
|
276
|
-
strip: 1,
|
|
277
|
-
});
|
|
278
|
-
extractStream.on('error', reject);
|
|
279
|
-
extractStream.on('end', () => {
|
|
280
|
-
this.emitProgress(pluginName, ' Done\r\n\r\n', green);
|
|
281
|
-
resolve();
|
|
282
|
-
});
|
|
283
|
-
extractStream.write(Buffer.from(tarballData));
|
|
284
|
-
extractStream.end();
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
await this.installProductionDependencies(targetDir, pluginName);
|
|
288
|
-
|
|
289
|
-
await this.extrackBundeledPlugin(targetDir, pluginName);
|
|
290
|
-
|
|
291
|
-
this.emitProgress(pluginName, '\r\n> Cleaning up...');
|
|
292
|
-
await remove(backupTempDir);
|
|
293
|
-
this.emitProgress(pluginName, ' Done\r\n\r\n', green);
|
|
294
|
-
|
|
295
|
-
this.emitProgress(pluginName, `Plugin ${pluginName}@${version} has been successfully ${update ? 'updated' : 'installed'}.\r\n\r\n`, green);
|
|
296
|
-
} catch (error) {
|
|
297
|
-
this.emitProgress(pluginName, `\r\nError during ${update ? 'update' : 'installation'} of ${pluginName}@${version}.\r\n\r\n`, red);
|
|
298
|
-
|
|
299
|
-
try {
|
|
300
|
-
this.emitProgress(pluginName, '> Restoring previous version...');
|
|
301
|
-
await remove(targetDir);
|
|
302
|
-
await move(backupTempDir, targetDir);
|
|
303
|
-
this.emitProgress(pluginName, ' Done\r\n\r\n', green);
|
|
304
|
-
} catch (error: any) {
|
|
305
|
-
this.emitProgress(pluginName, `\r\n\r\nError: ${error.message}\r\n`, red);
|
|
306
|
-
this.emitProgress(pluginName, 'Failed to restore previous version.\r\n\r\n', red);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
throw error;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
private async updatePlugin(pluginName: string, version: string, targetDir: string): Promise<void> {
|
|
314
|
-
try {
|
|
315
|
-
this.emitProgress(pluginName, '> Preparing update...');
|
|
316
|
-
|
|
317
|
-
const packageJsonPath = join(targetDir, 'package.json');
|
|
318
|
-
const packageJson = await readJson(packageJsonPath);
|
|
319
|
-
const currentVersion = packageJson.version;
|
|
320
|
-
|
|
321
|
-
if (currentVersion === version) {
|
|
322
|
-
this.emitProgress(pluginName, `\r\n\r\nPlugin ${pluginName} is already up to date.\r\n\r\n`, green);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
this.emitProgress(pluginName, ' Done\r\n\r\n', green);
|
|
327
|
-
|
|
328
|
-
await this.installPlugin(pluginName, version, targetDir, true);
|
|
329
|
-
} catch (error) {
|
|
330
|
-
this.emitProgress(pluginName, `\r\nError during update of ${pluginName}@${version}.\r\n\r\n`, red);
|
|
331
|
-
throw error;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
private async uninstallPlugin(pluginName: string, targetDir: string): Promise<void> {
|
|
336
|
-
try {
|
|
337
|
-
this.emitProgress(pluginName, '> Removing plugin...');
|
|
338
|
-
|
|
339
|
-
await remove(targetDir);
|
|
340
|
-
|
|
341
|
-
this.emitProgress(pluginName, ' Done\r\n\r\n', green);
|
|
342
|
-
this.emitProgress(pluginName, `Plugin ${pluginName} has been successfully uninstalled.\r\n`, green);
|
|
343
|
-
} catch (error) {
|
|
344
|
-
this.emitProgress(pluginName, ' Error\r\n\r\n', red);
|
|
345
|
-
this.emitProgress(pluginName, `\r\nError during uninstallation of ${pluginName}.\r\n\r\n`, red);
|
|
346
|
-
throw error;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
private async downloadWithProgress(url: string, pluginName: string, version: string): Promise<ArrayBuffer> {
|
|
351
|
-
const response = await fetch(url);
|
|
352
|
-
|
|
353
|
-
if (!response.ok) {
|
|
354
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
const contentLength = Number(response.headers.get('Content-Length'));
|
|
358
|
-
let receivedLength = 0;
|
|
359
|
-
const chunks: Uint8Array[] = [];
|
|
360
|
-
|
|
361
|
-
const reader = response.body!.getReader();
|
|
362
|
-
|
|
363
|
-
this.emitProgress(pluginName, `> Downloading ${pluginName}@${version}...\r\n`);
|
|
364
|
-
|
|
365
|
-
while (true) {
|
|
366
|
-
const { done, value } = await reader.read();
|
|
367
|
-
|
|
368
|
-
if (done) {
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
chunks.push(value);
|
|
373
|
-
receivedLength += value.length;
|
|
374
|
-
|
|
375
|
-
const percentComplete = Math.round((receivedLength / contentLength) * 100);
|
|
376
|
-
const progressBar = this.getProgressBar(percentComplete);
|
|
377
|
-
this.emitProgress(pluginName, `\r${progressBar} ${percentComplete}%`, cyan);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
return await new Blob(chunks).arrayBuffer();
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
private getProgressBar(percent: number): string {
|
|
384
|
-
const width = 50;
|
|
385
|
-
const complete = Math.round(width * (percent / 100));
|
|
386
|
-
const incomplete = width - complete;
|
|
387
|
-
return `[${'='.repeat(complete)}${'-'.repeat(incomplete)}]`;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
private async installProductionDependencies(packageDir: string, pluginName: string): Promise<void> {
|
|
391
|
-
return new Promise((resolve, reject) => {
|
|
392
|
-
this.emitProgress(pluginName, '> Installing dependencies...\r\n\r\n');
|
|
393
|
-
|
|
394
|
-
const npmCmd = getNpmPath()[0];
|
|
395
|
-
const args = ['install', '--omit=dev', '--include=prod', '--loglevel', 'info'];
|
|
396
|
-
|
|
397
|
-
const env = { ...process.env };
|
|
398
|
-
Object.assign(env, {
|
|
399
|
-
NODE_ENV: 'production',
|
|
400
|
-
npm_config_unsafe_perm: 'true',
|
|
401
|
-
npm_config_update_notifier: 'false',
|
|
402
|
-
npm_config_prefer_online: 'true',
|
|
403
|
-
npm_config_loglevel: 'info',
|
|
404
|
-
npm_config_prefix: packageDir,
|
|
405
|
-
npm_config_color: 'always',
|
|
406
|
-
FORCE_COLOR: '1',
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
if (platform() !== 'win32' && basename(packageDir) === 'lib') {
|
|
410
|
-
env.npm_config_prefix = dirname(packageDir);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
this.emitProgress(pluginName, `Running Command: ${npmCmd} ${args.join(' ')}\r\n`);
|
|
414
|
-
|
|
415
|
-
const childProcess = spawn(npmCmd, args, {
|
|
416
|
-
cwd: packageDir,
|
|
417
|
-
env,
|
|
418
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
childProcess.stdout.on('data', (data) => {
|
|
422
|
-
this.emitProgress(pluginName, data.toString().replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '\r\n'));
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
childProcess.stderr.on('data', (data) => {
|
|
426
|
-
this.emitProgress(pluginName, data.toString().replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n/g, '\r\n'));
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
const timeoutTimer = setTimeout(() => {
|
|
430
|
-
childProcess.kill('SIGTERM');
|
|
431
|
-
reject(new Error('Operation timed out after 5 minutes'));
|
|
432
|
-
}, 300000);
|
|
433
|
-
|
|
434
|
-
childProcess.on('close', (code) => {
|
|
435
|
-
clearTimeout(timeoutTimer);
|
|
436
|
-
|
|
437
|
-
if (code === 0) {
|
|
438
|
-
resolve();
|
|
439
|
-
} else {
|
|
440
|
-
reject(new Error(`Operation failed with exit code ${code}. Please review log for details.`));
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
childProcess.on('error', (err) => {
|
|
445
|
-
clearTimeout(timeoutTimer);
|
|
446
|
-
reject(new Error(`Failed to start process: ${err.message}`));
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
private async extrackBundeledPlugin(packageDir: string, pluginName: string): Promise<void> {
|
|
452
|
-
this.emitProgress(pluginName, '\r\n> Checking for bundled plugin...');
|
|
453
|
-
|
|
454
|
-
const bundlePath = await PluginManager.checkBundeledPlugin(packageDir);
|
|
455
|
-
if (!bundlePath) {
|
|
456
|
-
this.emitProgress(pluginName, '\r\n> Plugin is not bundled, skipping extraction...');
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
this.emitProgress(pluginName, '\r\n> Extracting bundled plugin...');
|
|
461
|
-
|
|
462
|
-
await PluginManager.extrackBundeledPlugin(packageDir, bundlePath);
|
|
463
|
-
|
|
464
|
-
this.emitProgress(pluginName, ' Done', green);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
private emitProgress(pluginName: string, message: string, color?: AnsicolorMethods) {
|
|
468
|
-
this.io.of('/logs').emit(`stdout/${pluginName}`, color ? color(message) : message);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { APP_SERVER_NAME, mergeWith } from '@camera.ui/common/utils';
|
|
2
|
-
import { cyan, green, red, yellow } from 'ansicolor';
|
|
3
|
-
import { userInfo } from 'node:os';
|
|
4
|
-
import { satisfies } from 'semver';
|
|
5
|
-
import { container } from 'tsyringe';
|
|
6
|
-
|
|
7
|
-
import { ConfigService } from '../../services/config/index.js';
|
|
8
|
-
|
|
9
|
-
import type { AnsicolorMethods } from 'ansicolor';
|
|
10
|
-
import type { Server } from 'socket.io';
|
|
11
|
-
import type { CameraUi } from '../../main.js';
|
|
12
|
-
import type { Database } from '../database/index.js';
|
|
13
|
-
import type { DBSystem } from '../database/types.js';
|
|
14
|
-
import type { SocketService } from '../websocket/index.js';
|
|
15
|
-
|
|
16
|
-
export class SystemService {
|
|
17
|
-
private dbs: Database;
|
|
18
|
-
private io: Server;
|
|
19
|
-
private socketService: SocketService;
|
|
20
|
-
private cameraui: CameraUi;
|
|
21
|
-
|
|
22
|
-
private installInProgress = false;
|
|
23
|
-
|
|
24
|
-
constructor() {
|
|
25
|
-
this.dbs = container.resolve<Database>('dbs');
|
|
26
|
-
this.socketService = container.resolve<SocketService>('socketService');
|
|
27
|
-
this.cameraui = container.resolve<CameraUi>('cameraui');
|
|
28
|
-
this.io = this.socketService.io;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public info(): DBSystem {
|
|
32
|
-
return this.dbs.systemDB.get('system')!;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public async patch(infoData: Partial<DBSystem> = {}): Promise<DBSystem> {
|
|
36
|
-
const info = this.info();
|
|
37
|
-
|
|
38
|
-
infoData.serverAddresses = infoData.serverAddresses?.filter((address) => address !== '');
|
|
39
|
-
|
|
40
|
-
mergeWith(info, infoData, (source: any, target: any) => {
|
|
41
|
-
if (Array.isArray(source)) {
|
|
42
|
-
return target;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
await this.dbs.systemDB.put('system', info);
|
|
47
|
-
|
|
48
|
-
return info;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public async install(version = 'latest'): Promise<void> {
|
|
52
|
-
this.emitProgress('server', `\r\nUSER: ${userInfo().username}\r\n`, cyan);
|
|
53
|
-
this.emitProgress('server', 'ACTION: update\r\r\n\n', cyan);
|
|
54
|
-
|
|
55
|
-
if (this.installInProgress) {
|
|
56
|
-
this.emitProgress('server', "\r\n\r\nError: Update already in progress.\r\n\r\n'", red);
|
|
57
|
-
throw new Error('Update already in progress.');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this.installInProgress = true;
|
|
61
|
-
|
|
62
|
-
if (!satisfies(process.version, `>=${ConfigService.MIN_NODE_VERSION}`)) {
|
|
63
|
-
this.emitProgress('server', `Node.js v${ConfigService.MIN_NODE_VERSION} higher is required for ${APP_SERVER_NAME}.\r\n`, yellow);
|
|
64
|
-
this.emitProgress('server', `You may experience issues while running on Node.js ${process.version}.\r\n\r\n`, yellow);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
const updateStream = await this.cameraui.requestUpdate(version);
|
|
69
|
-
for await (const output of updateStream) {
|
|
70
|
-
this.emitProgress('server', output.split(/\r?\n/).join('\r\n'));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
this.emitProgress('server', `\r\nServer ${APP_SERVER_NAME}@${version} has been successfully updated.\r\n\r\n`, green);
|
|
74
|
-
this.installInProgress = false;
|
|
75
|
-
} catch (error) {
|
|
76
|
-
this.installInProgress = false;
|
|
77
|
-
this.emitProgress('server', `\r\nError during update of ${APP_SERVER_NAME}@${version}.\r\n\r\n`, red);
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
private emitProgress(pluginName: string, message: string, color?: AnsicolorMethods) {
|
|
83
|
-
this.io.of('/logs').emit(`stdout/${pluginName}`, color ? color(message) : message);
|
|
84
|
-
}
|
|
85
|
-
}
|