@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interface/index.html +44 -44
- package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.BAIU_p3r.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.mdCorqzE.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.D0vsSsly.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.we5ZpWr2.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.9AEBJ3H1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.CZcnEH0C.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.DE0LkcGu.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/Cammesh.CVvmkelB.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.CUr4pGoU.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.CaJhu4fF.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.5VUmgryj.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.iYmUxAR5.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.DXPyE5mF.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.BqtlOFnV.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.C_RI-SDQ.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.Ch_v02eN.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.BpXAYgSG.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/Recordings.CIKHJytH.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.BcLoGNEy.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.DMROW8kx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/SettingsAppearance.CUaHpihp.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{SettingsAppearance.vue_vue_type_script_setup_true_lang.CBQ6lL3T.0.0.50-internal.0.js → SettingsAppearance.vue_vue_type_script_setup_true_lang.BuKZ-Uco.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.0QdwFSpv.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/SettingsRecordings.B-aj0U8_.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.Bi1YAJ76.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.CAx66Iir.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.CQcDtGy1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{VersionsHandler.vue_vue_type_script_setup_true_lang.xDishkkS.0.0.50-internal.0.js → VersionsHandler.vue_vue_type_script_setup_true_lang.BhXMzIhV.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0sCXSu5.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.DNqPWa0Q.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.DAXgG3bP.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.Bq3YocRX.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.9rxyNw0z.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.BuEvHAsS.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.DUdE08x8.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.DWU6YI8o.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.BpPyC6E4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.BoR2Rhdd.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BXzPONHs.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.DwcBYfWc.0.0.50-internal.2.js} +3 -3
- package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.BUDVOjPt.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CsG-OBoI.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CqEQao5R.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.D91sslRx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.SdSTPzZO.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.BwroebQ4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.DxM48YSv.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.Cmpbnzo4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.DF2YgZo1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.BUs2ineY.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.DmkT2LKx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.dPzyZDVa.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.y2ZlFveS.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.Y-alCADW.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.sRVFTqDf.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.D5WrXOZa.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.R0uz_abA.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.65mnGy-o.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.B1Qop6Uu.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.CwmyAcir.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.CMPALvRh.0.0.50-internal.2.js} +1 -1
- package/dist/interface/sw.js +1 -1
- package/dist/server/package.json +1 -1
- package/dist/server/src/rpc/server.js +4 -1
- package/dist/server/src/rpc/server.js.map +1 -1
- package/package.json +1 -1
- package/.prettierignore +0 -12
- package/.prettierrc.json +0 -12
- package/artillery.yaml +0 -29
- package/bin/cameraui-server.ts +0 -11
- package/dist/interface/js/Cammesh.D-6dAROQ.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/Recordings.DhxjIW7e.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/SettingsAppearance.DsTjKXk1.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/SettingsRecordings.DgW7M0jj.0.0.50-internal.0.js +0 -1
- package/eslint.config.js +0 -103
- package/localdeps.txt +0 -10
- package/mypy.ini +0 -30
- package/requirements.txt +0 -15
- package/ruff.toml +0 -90
- package/src/__init__.py +0 -0
- package/src/_camera_ui_tools/__init__.py +0 -0
- package/src/_camera_ui_tools/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/api/controllers/api.controller.ts +0 -19
- package/src/api/controllers/auth.controller.ts +0 -294
- package/src/api/controllers/backup.controller.ts +0 -72
- package/src/api/controllers/cameras.controller.ts +0 -1029
- package/src/api/controllers/config.controller.ts +0 -102
- package/src/api/controllers/files.controller.ts +0 -35
- package/src/api/controllers/frameWorkers.controller.ts +0 -109
- package/src/api/controllers/plugins.controller.ts +0 -1206
- package/src/api/controllers/system.controller.ts +0 -273
- package/src/api/controllers/users.controller.ts +0 -648
- package/src/api/database/checks.ts +0 -268
- package/src/api/database/constants.ts +0 -8
- package/src/api/database/index.ts +0 -262
- package/src/api/database/migration.ts +0 -62
- package/src/api/database/selfcheck.ts +0 -492
- package/src/api/database/types.ts +0 -104
- package/src/api/go2rtc/api/application.ts +0 -48
- package/src/api/go2rtc/api/config.ts +0 -61
- package/src/api/go2rtc/api/discover.ts +0 -197
- package/src/api/go2rtc/api/index.ts +0 -49
- package/src/api/go2rtc/api/snapshot.ts +0 -44
- package/src/api/go2rtc/api/streams.ts +0 -168
- package/src/api/go2rtc/index.ts +0 -43
- package/src/api/go2rtc/queue.ts +0 -50
- package/src/api/go2rtc/types.ts +0 -174
- package/src/api/index.ts +0 -286
- package/src/api/middlewares/authPermission.middleware.ts +0 -46
- package/src/api/middlewares/authValidation.middleware.ts +0 -160
- package/src/api/middlewares/pagination.middleware.ts +0 -67
- package/src/api/middlewares/socketAuth.middleware.ts +0 -136
- package/src/api/plugins/header.plugin.ts +0 -15
- package/src/api/plugins/logger.plugin.ts +0 -44
- package/src/api/plugins/proxy.plugin.ts +0 -255
- package/src/api/plugins/socket.plugin.ts +0 -28
- package/src/api/plugins/system.plugin.ts +0 -48
- package/src/api/plugins/useragent.plugin.ts +0 -19
- package/src/api/routes/api.routes.ts +0 -10
- package/src/api/routes/auth.routes.ts +0 -56
- package/src/api/routes/backup.routes.ts +0 -28
- package/src/api/routes/cameras.routes.ts +0 -281
- package/src/api/routes/config.routes.ts +0 -66
- package/src/api/routes/files.routes.ts +0 -15
- package/src/api/routes/frameWorkers.routes.ts +0 -39
- package/src/api/routes/index.ts +0 -37
- package/src/api/routes/plugins.routes.ts +0 -420
- package/src/api/routes/system.routes.ts +0 -101
- package/src/api/routes/users.routes.ts +0 -167
- package/src/api/schemas/backup.schema.ts +0 -112
- package/src/api/schemas/cameras.schema.ts +0 -479
- package/src/api/schemas/config.schema.ts +0 -38
- package/src/api/schemas/go2rtc.schema.ts +0 -189
- package/src/api/schemas/plugins.schema.ts +0 -126
- package/src/api/schemas/storage.schema.ts +0 -11
- package/src/api/schemas/system.schema.ts +0 -45
- package/src/api/schemas/users.schema.ts +0 -185
- package/src/api/services/auth.service.ts +0 -210
- package/src/api/services/backup.service.ts +0 -144
- package/src/api/services/cameras.service.ts +0 -671
- package/src/api/services/plugins.service.ts +0 -470
- package/src/api/services/system.service.ts +0 -85
- package/src/api/services/users.service.ts +0 -276
- package/src/api/types/index.ts +0 -675
- package/src/api/utils/cert.ts +0 -254
- package/src/api/utils/constants.ts +0 -17
- package/src/api/utils/fetch.ts +0 -21
- package/src/api/utils/moveFiles.ts +0 -45
- package/src/api/utils/parse.ts +0 -17
- package/src/api/websocket/index.ts +0 -110
- package/src/api/websocket/nsp/logs.ts +0 -240
- package/src/api/websocket/nsp/main.ts +0 -27
- package/src/api/websocket/nsp/metrics.ts +0 -301
- package/src/api/websocket/nsp/notifications.ts +0 -43
- package/src/api/websocket/nsp/plugins.ts +0 -37
- package/src/api/websocket/nsp/server.ts +0 -220
- package/src/api/websocket/nsp/status.ts +0 -77
- package/src/api/websocket/types.ts +0 -55
- package/src/api.ts +0 -163
- package/src/camera/classes.ts +0 -32
- package/src/camera/controller.ts +0 -579
- package/src/camera/device.ts +0 -422
- package/src/camera/frameWorker.ts +0 -403
- package/src/camera/index.ts +0 -679
- package/src/camera/interfaces.ts +0 -95
- package/src/camera/iou.ts +0 -153
- package/src/camera/polygon.ts +0 -226
- package/src/camera/python/__init__.py +0 -0
- package/src/camera/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/classes.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/delegate_controller.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/interfaces.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/iou.cpython-310.pyc +0 -0
- package/src/camera/python/__pycache__/iou.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/iou2.cpython-310.pyc +0 -0
- package/src/camera/python/__pycache__/polygon.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/video_frame.cpython-311.pyc +0 -0
- package/src/camera/python/classes.py +0 -41
- package/src/camera/python/interfaces.py +0 -130
- package/src/camera/python/iou.py +0 -158
- package/src/camera/python/polygon.py +0 -230
- package/src/camera/python/test/__pycache__/polygon.cpython-310.pyc +0 -0
- package/src/camera/python/test/iou_test.py +0 -799
- package/src/camera/python/test/polygon.py +0 -238
- package/src/camera/python/test/polygon_test.py +0 -256
- package/src/camera/python/test/polygon_test2.py +0 -484
- package/src/camera/python/typings.py +0 -50
- package/src/camera/python/video_frame.py +0 -143
- package/src/camera/session.ts +0 -192
- package/src/camera/streaming/fmp4-session.ts +0 -390
- package/src/camera/streaming/peer-connection.ts +0 -273
- package/src/camera/streaming/rtsp-session.ts +0 -331
- package/src/camera/streaming/webrtc-connection.ts +0 -260
- package/src/camera/streaming/werift-session.ts +0 -317
- package/src/camera/test/iou_test.ts +0 -761
- package/src/camera/test/polygon.test.ts +0 -611
- package/src/camera/test/polygon_test.ts +0 -210
- package/src/camera/types.ts +0 -48
- package/src/camera/utils.ts +0 -489
- package/src/camera/videoFrame.ts +0 -123
- package/src/cloud/index.ts +0 -61
- package/src/cloud/remote/cloudflare.ts +0 -18
- package/src/cloud/remote/upnp.ts +0 -18
- package/src/cloud/remote/utils.ts +0 -24
- package/src/cloud/types.ts +0 -16
- package/src/decoder/child.ts +0 -883
- package/src/decoder/imageUtils.ts +0 -275
- package/src/decoder/manager.ts +0 -251
- package/src/decoder/python/__init__.py +0 -0
- package/src/decoder/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/image_utils.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/utils.cpython-311.pyc +0 -0
- package/src/decoder/python/child.py +0 -903
- package/src/decoder/python/image_utils.py +0 -196
- package/src/decoder/python/pool.py +0 -45
- package/src/decoder/python/test/group.py +0 -62
- package/src/decoder/python/test/motion.mp4 +0 -0
- package/src/decoder/python/test/motion2.mp4 +0 -0
- package/src/decoder/python/test/opencl.cl +0 -70
- package/src/decoder/python/test/opencl2.cl +0 -130
- package/src/decoder/python/test/test.py +0 -427
- package/src/decoder/python/test/test1.jpg +0 -0
- package/src/decoder/python/test/test1_resized.jpg +0 -0
- package/src/decoder/python/test/test2.jpg +0 -0
- package/src/decoder/python/test/test2.py +0 -451
- package/src/decoder/python/test/test2_resized.jpg +0 -0
- package/src/decoder/python/test/test3.jpg +0 -0
- package/src/decoder/python/test/utils.py +0 -50
- package/src/decoder/python/typings.py +0 -57
- package/src/decoder/python/utils.py +0 -70
- package/src/decoder/test/child.ts +0 -117
- package/src/decoder/test/ffmpeg.ts +0 -371
- package/src/decoder/test/test.ts +0 -182
- package/src/decoder/types.ts +0 -27
- package/src/decoder/utils.ts +0 -64
- package/src/decoder/wasm/asconfig.json +0 -28
- package/src/decoder/wasm/assembly/console.ts +0 -1
- package/src/decoder/wasm/assembly/index.ts +0 -890
- package/src/decoder/wasm/build/decoder.d.ts +0 -43
- package/src/decoder/wasm/build/decoder.js +0 -108
- package/src/decoder/wasm/build/decoder.wasm +0 -0
- package/src/decoder/wasm/tsconfig.json +0 -5
- package/src/decoder/worker.ts +0 -113
- package/src/go2rtc/index.ts +0 -324
- package/src/go2rtc/types.ts +0 -88
- package/src/main.ts +0 -267
- package/src/manager/coreManager.ts +0 -78
- package/src/manager/deviceManager.ts +0 -132
- package/src/manager/types.ts +0 -17
- package/src/plugins/index.ts +0 -443
- package/src/plugins/plugin.ts +0 -177
- package/src/plugins/runtime/base.ts +0 -282
- package/src/plugins/runtime/index.ts +0 -15
- package/src/plugins/runtime/node/child.ts +0 -193
- package/src/plugins/runtime/node/index.ts +0 -67
- package/src/plugins/runtime/node/plugin.ts +0 -122
- package/src/plugins/runtime/node/pluginApi.ts +0 -27
- package/src/plugins/runtime/node/proxy/cameraDevice.ts +0 -299
- package/src/plugins/runtime/node/proxy/coreManager.ts +0 -128
- package/src/plugins/runtime/node/proxy/deviceManager.ts +0 -187
- package/src/plugins/runtime/node/storage.ts +0 -312
- package/src/plugins/runtime/node/storageController.ts +0 -91
- package/src/plugins/runtime/python/__init__.py +0 -0
- package/src/plugins/runtime/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/camera_storage.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/config_service.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/constants.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/ipc.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/logger.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/message_queue.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/namespaces.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin_api.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin_logger.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/proxy_utils.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/schema.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/storage.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/storage_controller.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/child.py +0 -248
- package/src/plugins/runtime/python/index.ts +0 -73
- package/src/plugins/runtime/python/namespaces.py +0 -101
- package/src/plugins/runtime/python/plugin.py +0 -155
- package/src/plugins/runtime/python/plugin_api.py +0 -29
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/core_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/camera_device.py +0 -1732
- package/src/plugins/runtime/python/proxy/core_manager.py +0 -126
- package/src/plugins/runtime/python/proxy/device_manager.py +0 -197
- package/src/plugins/runtime/python/schema.py +0 -99
- package/src/plugins/runtime/python/storage.py +0 -353
- package/src/plugins/runtime/python/storage_controller.py +0 -102
- package/src/plugins/runtime/python/typings.py +0 -195
- package/src/plugins/schema.ts +0 -472
- package/src/plugins/types.ts +0 -60
- package/src/plugins/worker.ts +0 -250
- package/src/rpc/index.ts +0 -149
- package/src/rpc/namespaces.ts +0 -79
- package/src/rpc/server.ts +0 -422
- package/src/rpc/types.ts +0 -119
- package/src/rpc/utils.ts +0 -16
- package/src/services/config/constants.ts +0 -47
- package/src/services/config/defaults.ts +0 -57
- package/src/services/config/index.ts +0 -744
- package/src/services/config/types.ts +0 -211
- package/src/services/logger/index.ts +0 -96
- package/src/types.ts +0 -47
- package/src/utils/path.ts +0 -16
- package/src/utils/pythonInstaller.ts +0 -597
- package/tsconfig.json +0 -37
- package/types/fastify.d.ts +0 -14
- package/updates.config.js +0 -3
- /package/dist/interface/assets/{@xterm.DYP7pi_n.0.0.50-internal.0.css → @xterm.DYP7pi_n.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.C-5Lxnx_.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{engine.io-parser.BiEtp6m2.0.0.50-internal.0.js → engine.io-parser.BiEtp6m2.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{ev-emitter.X5f1qa-c.0.0.50-internal.0.js → ev-emitter.X5f1qa-c.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{get-size.D1dS-IaP.0.0.50-internal.0.js → get-size.D1dS-IaP.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.2.js} +0 -0
package/src/plugins/index.ts
DELETED
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
|
|
3
|
-
import AdmZip from 'adm-zip';
|
|
4
|
-
import { pathExists, readJson, remove } from 'fs-extra/esm';
|
|
5
|
-
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
6
|
-
import { dirname, join, resolve } from 'node:path';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import semver from 'semver';
|
|
9
|
-
import { container } from 'tsyringe';
|
|
10
|
-
import { DEFAULT_PY_VERSION, PythonInstaller } from '../utils/pythonInstaller.js';
|
|
11
|
-
|
|
12
|
-
import { API_EVENT } from '../api.js';
|
|
13
|
-
import { PluginsService } from '../api/services/plugins.service.js';
|
|
14
|
-
import { Plugin } from './plugin.js';
|
|
15
|
-
import { CAMERA_EXTENSIONS, PLUGIN_IDENTIFIER_PATTERN } from './types.js';
|
|
16
|
-
|
|
17
|
-
import type { CameraUiAPI } from '../api.js';
|
|
18
|
-
import type { BackupInfo, IPackageJson } from '../api/types/index.js';
|
|
19
|
-
import type { ConfigService } from '../services/config/index.js';
|
|
20
|
-
import type { LoggerService } from '../services/logger/index.js';
|
|
21
|
-
import type { PluginContract } from './types.js';
|
|
22
|
-
|
|
23
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
24
|
-
const __dirname = dirname(__filename);
|
|
25
|
-
|
|
26
|
-
export class PluginManager {
|
|
27
|
-
private logger: LoggerService;
|
|
28
|
-
private api: CameraUiAPI;
|
|
29
|
-
private configService: ConfigService;
|
|
30
|
-
|
|
31
|
-
public installedPythonVersions = new Set<string>();
|
|
32
|
-
public searchPaths = new Set<string>();
|
|
33
|
-
|
|
34
|
-
public plugins = new Map<string, Plugin>();
|
|
35
|
-
public pluginIdentifiers = new Set<string>();
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
container.registerInstance('pluginManager', this);
|
|
39
|
-
|
|
40
|
-
this.api = container.resolve<CameraUiAPI>('api');
|
|
41
|
-
this.logger = container.resolve<LoggerService>('logger');
|
|
42
|
-
this.configService = container.resolve<ConfigService>('configService');
|
|
43
|
-
|
|
44
|
-
this.api.setMaxListeners(this.api.getMaxListeners() + 1);
|
|
45
|
-
this.api.once(API_EVENT.SHUTDOWN, () => {
|
|
46
|
-
this.plugins.forEach((plugin) => plugin.worker.teardown());
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public static isQualifiedPluginIdentifier(pluginName: string): boolean {
|
|
51
|
-
const normalizedName = pluginName.replace(/\\/g, '/');
|
|
52
|
-
return PLUGIN_IDENTIFIER_PATTERN.test(normalizedName);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public static isQualifiedPluginContract(contract?: Partial<PluginContract>): boolean {
|
|
56
|
-
if (contract) {
|
|
57
|
-
if (!contract.extensions || !Array.isArray(contract.extensions) || contract.extensions.length === 0) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (contract.extensions.some((extension) => !CAMERA_EXTENSIONS.includes(extension))) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public static extractPluginScope(pluginName: string): string | undefined {
|
|
72
|
-
return pluginName.match(PLUGIN_IDENTIFIER_PATTERN)![2];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public static extractPluginName(pluginName: string): string {
|
|
76
|
-
return pluginName.match(PLUGIN_IDENTIFIER_PATTERN)![3];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public static transformDisplaName(pluginName: string): string {
|
|
80
|
-
const extractedPkgName = this.extractPluginName(pluginName).replace('camera-ui-', '').replaceAll('-', ' ');
|
|
81
|
-
|
|
82
|
-
return extractedPkgName
|
|
83
|
-
.toLowerCase()
|
|
84
|
-
.split(' ')
|
|
85
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
86
|
-
.join(' ');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public static loadPackageJSON(installPath: string): IPackageJson {
|
|
90
|
-
const packageJsonPath = join(installPath, 'package.json');
|
|
91
|
-
let packageJson;
|
|
92
|
-
|
|
93
|
-
if (!existsSync(packageJsonPath)) {
|
|
94
|
-
throw new Error(`Plugin ${installPath} does not contain a package.json.`);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
try {
|
|
98
|
-
packageJson = JSON.parse(readFileSync(packageJsonPath, { encoding: 'utf8' }));
|
|
99
|
-
} catch (error: any) {
|
|
100
|
-
throw new Error(`Plugin ${installPath} contains an invalid package.json. Error: ${error}`);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (!PluginManager.isQualifiedPluginIdentifier(packageJson.name)) {
|
|
104
|
-
throw new Error(`Plugin "${packageJson.name}" does not have a package name that begins with 'camera-ui-' or '@scope/camera-ui-.`);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (!PluginManager.isQualifiedPluginContract(packageJson['camera.ui'])) {
|
|
108
|
-
throw new Error(`Plugin "${packageJson.name}" does not contain a valid contract.`);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// verify that it's tagged with the correct keyword
|
|
112
|
-
if (!packageJson.keywords?.includes('camera-ui-plugin')) {
|
|
113
|
-
throw new Error(`Plugin "${packageJson.name}" does not contain the keyword 'camera-ui-plugin'.`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return packageJson;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
public static parseContract(pjson: IPackageJson): PluginContract {
|
|
120
|
-
const contract = pjson['camera.ui'];
|
|
121
|
-
|
|
122
|
-
if (contract?.pythonVersion) {
|
|
123
|
-
const validPythonVersions = PythonInstaller.versions;
|
|
124
|
-
const minValidPythonVersion = validPythonVersions[validPythonVersions.length - 1];
|
|
125
|
-
const maxValidPythonVersion = validPythonVersions[0];
|
|
126
|
-
const pluginPythonVersion = semver.clean(contract.pythonVersion);
|
|
127
|
-
|
|
128
|
-
if (!pluginPythonVersion || !semver.satisfies(pluginPythonVersion, `>=${minValidPythonVersion} <=${maxValidPythonVersion}`)) {
|
|
129
|
-
contract.pythonVersion = DEFAULT_PY_VERSION;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (contract?.dependencies) {
|
|
134
|
-
const invalidDependencies = contract.dependencies.filter((dep) => !PluginManager.isQualifiedPluginIdentifier(dep));
|
|
135
|
-
if (invalidDependencies.length) {
|
|
136
|
-
contract.dependencies = contract.dependencies.filter((dep) => PluginManager.isQualifiedPluginIdentifier(dep));
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const extensions = contract?.extensions ?? [];
|
|
141
|
-
const dependencies = contract?.dependencies ? Array.from(new Set(contract.dependencies)) : [];
|
|
142
|
-
const pythonVersion = contract?.pythonVersion;
|
|
143
|
-
const bundled = contract?.bundled ?? false;
|
|
144
|
-
|
|
145
|
-
return {
|
|
146
|
-
extensions,
|
|
147
|
-
dependencies,
|
|
148
|
-
pythonVersion,
|
|
149
|
-
bundled,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
public static async checkBundeledPlugin(packageDir: string): Promise<string | undefined> {
|
|
154
|
-
const bundleRootPath = join(packageDir, 'bundle.zip');
|
|
155
|
-
const bundlePath = join(packageDir, 'bundle', 'bundle.zip');
|
|
156
|
-
|
|
157
|
-
if (await pathExists(bundleRootPath)) {
|
|
158
|
-
return bundleRootPath;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (await pathExists(bundlePath)) {
|
|
162
|
-
return bundlePath;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
public static async extrackBundeledPlugin(packageDir: string, bundlePath?: string): Promise<void> {
|
|
167
|
-
bundlePath = bundlePath ?? (await this.checkBundeledPlugin(packageDir));
|
|
168
|
-
if (!bundlePath) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const bundleDir = dirname(bundlePath);
|
|
173
|
-
const zip = new AdmZip(bundlePath);
|
|
174
|
-
zip.extractAllTo(bundleDir, true);
|
|
175
|
-
|
|
176
|
-
await remove(bundlePath);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
public async initializeInstalledPlugins(): Promise<void> {
|
|
180
|
-
if (this.plugins.size === 0) {
|
|
181
|
-
this.logger.warn('No plugins found. See the README for information on installing plugins.');
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
await Promise.all(Array.from(this.plugins).map(([, plugin]) => this.initializeInstalledPlugin(plugin)));
|
|
186
|
-
// for (const [, plugin] of this.plugins) {
|
|
187
|
-
// await this.initializeInstalledPlugin(plugin);
|
|
188
|
-
// }
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
public async initializeInstalledPlugin(plugin: Plugin): Promise<void> {
|
|
192
|
-
if (plugin.disabled) {
|
|
193
|
-
this.logger.warn(`Disabled plugin: ${plugin.displayName} (${plugin.pluginName}@${plugin.info.installedVersion})`);
|
|
194
|
-
} else {
|
|
195
|
-
this.logger.log(`Initializing plugin: ${plugin.displayName} (${plugin.pluginName}@${plugin.info.installedVersion})`);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
try {
|
|
199
|
-
await this.startPluginChild(plugin.pluginName);
|
|
200
|
-
} catch (error: any) {
|
|
201
|
-
this.logger.error(`Error loading plugin: ${plugin.pluginName}:`, error);
|
|
202
|
-
this.plugins.delete(plugin.pluginName);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
public async loadPlugin(absolutePath: string, oldId?: string): Promise<Plugin> {
|
|
207
|
-
const pluginsService = new PluginsService();
|
|
208
|
-
|
|
209
|
-
const packageJson = PluginManager.loadPackageJSON(absolutePath);
|
|
210
|
-
const pluginName = packageJson.name;
|
|
211
|
-
const scope = PluginManager.extractPluginScope(pluginName);
|
|
212
|
-
const alreadyInstalled = this.plugins.get(pluginName);
|
|
213
|
-
|
|
214
|
-
if (alreadyInstalled) {
|
|
215
|
-
throw new Error(`Warning: skipping plugin found at '${absolutePath}' since we already loaded the same plugin from '${alreadyInstalled.installPath}'.`);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
const dbPlugin = await pluginsService.insertPluginDb(pluginName, oldId);
|
|
219
|
-
const plugin = new Plugin(pluginName, absolutePath, packageJson, dbPlugin._id, scope);
|
|
220
|
-
|
|
221
|
-
const bundlePath = await PluginManager.checkBundeledPlugin(plugin.installPath);
|
|
222
|
-
if (bundlePath) {
|
|
223
|
-
this.logger.debug(`Extracting bundled plugin: ${pluginName}`);
|
|
224
|
-
await PluginManager.extrackBundeledPlugin(plugin.installPath, bundlePath);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
this.plugins.set(pluginName, plugin);
|
|
228
|
-
|
|
229
|
-
return plugin;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
public async removePlugin(plugin: Plugin, removeStorage?: boolean): Promise<void> {
|
|
233
|
-
await plugin.worker.cleanup();
|
|
234
|
-
|
|
235
|
-
const pluginsService = new PluginsService();
|
|
236
|
-
await pluginsService.removePluginDbById(plugin.id);
|
|
237
|
-
|
|
238
|
-
if (removeStorage) {
|
|
239
|
-
await remove(plugin.storagePath);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
this.plugins.delete(plugin.pluginName);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
public async startPluginChild(pluginName: string): Promise<void> {
|
|
246
|
-
try {
|
|
247
|
-
const plugin = this.plugins.get(pluginName);
|
|
248
|
-
|
|
249
|
-
if (!plugin || plugin.disabled || plugin.worker?.isRunning()) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
await plugin.load();
|
|
254
|
-
|
|
255
|
-
for (const depName of plugin.contract.dependencies ?? []) {
|
|
256
|
-
if (!PluginManager.isQualifiedPluginIdentifier(depName)) {
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const depPlugin = this.plugins.get(depName);
|
|
261
|
-
|
|
262
|
-
if (!depPlugin) {
|
|
263
|
-
this.logger.attention(`Plugin ${pluginName} requires ${depName} which is not installed!`);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (depPlugin?.disabled) {
|
|
267
|
-
this.logger.attention(`Reactivation and start of dependency ${depPlugin.displayName} for ${plugin.displayName}`);
|
|
268
|
-
depPlugin.disabled = false;
|
|
269
|
-
this.startPluginChild(depName);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
await plugin.worker.start();
|
|
274
|
-
} catch (error: any) {
|
|
275
|
-
if (error.message === 'NOT_COMPATIBLE') {
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
this.logger.error(`Error starting plugin ${pluginName}:`, error);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
public async stopPluginChild(pluginName: string): Promise<void> {
|
|
284
|
-
const plugin = this.plugins.get(pluginName);
|
|
285
|
-
await plugin?.worker.teardown();
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
public async initializePlugins(): Promise<void> {
|
|
289
|
-
await this.loadInstalledPlugins();
|
|
290
|
-
await this.removeOrphanedPlugins();
|
|
291
|
-
|
|
292
|
-
for (const [, plugin] of this.plugins) {
|
|
293
|
-
if (this.configService.config.plugins.disabledPlugins.includes(plugin.pluginName)) {
|
|
294
|
-
plugin.disabled = true;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
await this.handleDisabledPlugins();
|
|
299
|
-
await this.restorePlugins();
|
|
300
|
-
await this.installRequiredPythonEnvs();
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
private async installRequiredPythonEnvs(): Promise<void> {
|
|
304
|
-
this.installedPythonVersions.clear();
|
|
305
|
-
|
|
306
|
-
const pythonVersionsToInstall = new Set<string>();
|
|
307
|
-
pythonVersionsToInstall.add(DEFAULT_PY_VERSION);
|
|
308
|
-
|
|
309
|
-
for (const [, plugin] of this.plugins) {
|
|
310
|
-
if (plugin.isPython && !plugin.disabled) {
|
|
311
|
-
pythonVersionsToInstall.add(plugin.contract.pythonVersion ?? DEFAULT_PY_VERSION);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (pythonVersionsToInstall.size > 0) {
|
|
316
|
-
const promises: Promise<any>[] = [];
|
|
317
|
-
|
|
318
|
-
for (const version of pythonVersionsToInstall) {
|
|
319
|
-
const requirementsPath = resolve(join(__dirname, '..', '..', 'requirements.txt')).replace('app.asar', 'app.asar.unpacked');
|
|
320
|
-
const py = new PythonInstaller(this.configService.HOME_PATH, this.logger, undefined, version);
|
|
321
|
-
|
|
322
|
-
promises.push(
|
|
323
|
-
py
|
|
324
|
-
.install('server', requirementsPath)
|
|
325
|
-
.then(() => this.installedPythonVersions.add(version))
|
|
326
|
-
.catch((error) => this.logger.error(`Error installing Python ${version}:`, error)),
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const { logger } = new PythonInstaller(this.configService.HOME_PATH, this.logger, undefined, DEFAULT_PY_VERSION);
|
|
331
|
-
|
|
332
|
-
if (promises.length > 0) {
|
|
333
|
-
logger.log(`Installing required Python versions: ${Array.from(pythonVersionsToInstall).join(', ')} ...`);
|
|
334
|
-
await Promise.all(promises);
|
|
335
|
-
logger.log('Python installation complete.');
|
|
336
|
-
} else if (pythonVersionsToInstall.size > 0) {
|
|
337
|
-
logger.log(`Required Python versions already installed: ${Array.from(pythonVersionsToInstall).join(', ')}`);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
private async loadInstalledPlugins(): Promise<void> {
|
|
343
|
-
const searchPath = this.configService.PLUGINS_INSTALL_PATH;
|
|
344
|
-
|
|
345
|
-
const relativeinstallPaths = readdirSync(searchPath).filter((relativePath) => {
|
|
346
|
-
try {
|
|
347
|
-
return statSync(join(searchPath, relativePath)).isDirectory();
|
|
348
|
-
} catch (error: any) {
|
|
349
|
-
this.logger.debug(`Ignoring path ${resolve(searchPath, relativePath)}`, error);
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
// expand out @scoped plugins
|
|
355
|
-
for (const scopeDirectory of [...relativeinstallPaths].filter((path) => path.startsWith('@'))) {
|
|
356
|
-
const index = relativeinstallPaths.indexOf(scopeDirectory);
|
|
357
|
-
relativeinstallPaths.splice(index, 1);
|
|
358
|
-
const absolutePath = resolve(searchPath, scopeDirectory);
|
|
359
|
-
|
|
360
|
-
for (const name of readdirSync(absolutePath)
|
|
361
|
-
.filter((name) => PluginManager.isQualifiedPluginIdentifier(name))
|
|
362
|
-
.filter((name) => {
|
|
363
|
-
try {
|
|
364
|
-
return statSync(join(absolutePath, name)).isDirectory();
|
|
365
|
-
} catch (error: any) {
|
|
366
|
-
this.logger.debug(`Ignoring path ${resolve(absolutePath, name)} - ${error.message}`);
|
|
367
|
-
return false;
|
|
368
|
-
}
|
|
369
|
-
}))
|
|
370
|
-
relativeinstallPaths.push(join(scopeDirectory, name));
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
relativeinstallPaths.forEach((pluginIdentifier) => {
|
|
374
|
-
if (PluginManager.isQualifiedPluginIdentifier(pluginIdentifier)) {
|
|
375
|
-
this.pluginIdentifiers.add(pluginIdentifier);
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
for (const pluginIdentifier of this.pluginIdentifiers) {
|
|
380
|
-
try {
|
|
381
|
-
const absolutePath = join(searchPath, pluginIdentifier);
|
|
382
|
-
await this.loadPlugin(absolutePath);
|
|
383
|
-
} catch (error: any) {
|
|
384
|
-
this.logger.warn(error.message);
|
|
385
|
-
continue;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
private async restorePlugins(): Promise<void> {
|
|
391
|
-
try {
|
|
392
|
-
const backupInfo: BackupInfo = await readJson(this.configService.BACKUP_INFO_FILE);
|
|
393
|
-
const notInstalledPlugins = backupInfo.plugins.filter((plugin) => !this.plugins.has(plugin.name));
|
|
394
|
-
|
|
395
|
-
const restorePromises: Promise<void>[] = [];
|
|
396
|
-
|
|
397
|
-
if (notInstalledPlugins.length > 0) {
|
|
398
|
-
this.logger.log('Restoring missing plugins...');
|
|
399
|
-
|
|
400
|
-
const restore = async () => {
|
|
401
|
-
const pluginsService = new PluginsService();
|
|
402
|
-
|
|
403
|
-
for (const pluginInfo of notInstalledPlugins) {
|
|
404
|
-
try {
|
|
405
|
-
this.logger.log(`Installing plugin: ${pluginInfo.name}@${pluginInfo.version}`);
|
|
406
|
-
|
|
407
|
-
const installPath = await pluginsService.manage(pluginInfo.name, 'install', pluginInfo.version);
|
|
408
|
-
const plugin = await this.loadPlugin(installPath, pluginInfo.id);
|
|
409
|
-
|
|
410
|
-
if (this.configService.config.plugins.disabledPlugins.includes(plugin.pluginName)) {
|
|
411
|
-
plugin.disabled = true;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
this.logger.log(`Plugin installed: ${plugin.pluginName}.${plugin.displayName} (${plugin.info.installedVersion})`);
|
|
415
|
-
} catch (error: any) {
|
|
416
|
-
this.logger.error(`Error restoring plugin ${pluginInfo.name}:`, error);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
restorePromises.push(restore());
|
|
422
|
-
|
|
423
|
-
await Promise.all(restorePromises);
|
|
424
|
-
|
|
425
|
-
this.logger.log('Plugins restored');
|
|
426
|
-
|
|
427
|
-
await remove(this.configService.BACKUP_INFO_FILE);
|
|
428
|
-
}
|
|
429
|
-
} catch {
|
|
430
|
-
//
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
private async removeOrphanedPlugins(): Promise<void> {
|
|
435
|
-
const pluginsService = new PluginsService();
|
|
436
|
-
await pluginsService.removeOrphanPluginsDb();
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
private async handleDisabledPlugins(): Promise<void> {
|
|
440
|
-
const pluginsService = new PluginsService();
|
|
441
|
-
await pluginsService.handleDisabledPlugins();
|
|
442
|
-
}
|
|
443
|
-
}
|
package/src/plugins/plugin.ts
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { lstatSync } from 'node:fs';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import semver from 'semver';
|
|
4
|
-
import { container } from 'tsyringe';
|
|
5
|
-
|
|
6
|
-
import { ConfigService } from '../services/config/index.js';
|
|
7
|
-
import { PluginManager } from './index.js';
|
|
8
|
-
import { PluginWorker } from './worker.js';
|
|
9
|
-
|
|
10
|
-
import type { CameraExtension } from '@camera.ui/types';
|
|
11
|
-
import type { CameraUiPlugin, IPackageJson } from '../api/types/index.js';
|
|
12
|
-
import type { LoggerService } from '../services/logger/index.js';
|
|
13
|
-
import type { Context, PluginContract } from './types.js';
|
|
14
|
-
|
|
15
|
-
export class Plugin {
|
|
16
|
-
private logger: LoggerService;
|
|
17
|
-
private configService: ConfigService;
|
|
18
|
-
|
|
19
|
-
private _disabled = false;
|
|
20
|
-
private _info: CameraUiPlugin;
|
|
21
|
-
private _contract: PluginContract;
|
|
22
|
-
private loadContext: Context;
|
|
23
|
-
|
|
24
|
-
readonly id: string;
|
|
25
|
-
readonly main: string;
|
|
26
|
-
readonly pluginName: string;
|
|
27
|
-
readonly displayName: string;
|
|
28
|
-
readonly scope?: string;
|
|
29
|
-
readonly isPython: boolean;
|
|
30
|
-
readonly isSymLink: boolean;
|
|
31
|
-
readonly installPath: string;
|
|
32
|
-
readonly mainPath: string;
|
|
33
|
-
readonly storagePath: string;
|
|
34
|
-
readonly logPath: string;
|
|
35
|
-
readonly worker: PluginWorker;
|
|
36
|
-
|
|
37
|
-
public get contract(): PluginContract {
|
|
38
|
-
return this._contract;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public get info(): CameraUiPlugin {
|
|
42
|
-
this._info.disabled = this.disabled;
|
|
43
|
-
return this._info;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public set info(value: CameraUiPlugin) {
|
|
47
|
-
this._info = value;
|
|
48
|
-
this._info.disabled = this.disabled;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public get disabled(): boolean {
|
|
52
|
-
return this._disabled;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public set disabled(disabled: boolean) {
|
|
56
|
-
this._disabled = disabled;
|
|
57
|
-
this._info.disabled = disabled;
|
|
58
|
-
|
|
59
|
-
if (disabled) {
|
|
60
|
-
this.worker.disable();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public get type(): CameraExtension[] {
|
|
65
|
-
return [...this.contract.extensions];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
constructor(pluginName: string, installPath: string, packageJSON: IPackageJson, pluginId: string, scope?: string) {
|
|
69
|
-
this.logger = container.resolve<LoggerService>('logger');
|
|
70
|
-
this.configService = container.resolve<ConfigService>('configService');
|
|
71
|
-
|
|
72
|
-
this.scope = scope;
|
|
73
|
-
this.installPath = join(installPath);
|
|
74
|
-
this.id = pluginId;
|
|
75
|
-
this.pluginName = pluginName;
|
|
76
|
-
this.storagePath = join(this.configService.PLUGINS_STORAGE_PATH, this.pluginName);
|
|
77
|
-
this.logPath = join(this.configService.LOGS_PATH, `plugin-${this.id}.log`);
|
|
78
|
-
|
|
79
|
-
this.main = this.getMainFile(packageJSON);
|
|
80
|
-
this.mainPath = join(this.installPath, dirname(this.main));
|
|
81
|
-
this.isPython = this.main.endsWith('.py');
|
|
82
|
-
this.isSymLink = lstatSync(this.installPath).isSymbolicLink();
|
|
83
|
-
|
|
84
|
-
this._info = this.parsePackageJson(packageJSON, installPath);
|
|
85
|
-
this._contract = PluginManager.parseContract(packageJSON);
|
|
86
|
-
|
|
87
|
-
this.displayName = this.info.displayName;
|
|
88
|
-
|
|
89
|
-
this.loadContext = {
|
|
90
|
-
engines: packageJSON.engines,
|
|
91
|
-
dependencies: packageJSON.dependencies,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
this.worker = new PluginWorker(this);
|
|
95
|
-
|
|
96
|
-
this.disabled = this.configService.config.plugins.disabledPlugins.includes(pluginName);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public async load(): Promise<void> {
|
|
100
|
-
if (!this.loadContext.engines?.['camera.ui']) {
|
|
101
|
-
throw new Error(`Plugin ${this.installPath} does not contain the 'camera.ui' package in 'engines'.`);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const serverVersion = semver.clean(ConfigService.VERSION);
|
|
105
|
-
const versionRequired = semver.clean(this.loadContext.engines['camera.ui']);
|
|
106
|
-
const processVersion = semver.clean(process.version.replace('v', ''));
|
|
107
|
-
const nodeVersionRequired = semver.clean(this.loadContext.engines.node);
|
|
108
|
-
|
|
109
|
-
if (serverVersion && versionRequired && !semver.gte(serverVersion, versionRequired)) {
|
|
110
|
-
this.logger.warn(`The plugin "${this.pluginName}" requires a camera.ui version of ${versionRequired} which does \
|
|
111
|
-
not satisfy the current camera.ui version of ${ConfigService.VERSION}. Please update camera.ui to the required version.`);
|
|
112
|
-
throw new Error('NOT_COMPATIBLE');
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (processVersion && nodeVersionRequired && !semver.gte(processVersion, nodeVersionRequired)) {
|
|
116
|
-
this.logger.warn(`The plugin "${this.pluginName}" requires Node.js version of ${nodeVersionRequired} which does \
|
|
117
|
-
not satisfy the current Node.js version of ${process.version}. You may need to upgrade your installation of Node.js`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public reparsePackageJson(): void {
|
|
122
|
-
const pjson = PluginManager.loadPackageJSON(this.installPath);
|
|
123
|
-
this._info = this.parsePackageJson(pjson, this.installPath);
|
|
124
|
-
this._contract = PluginManager.parseContract(pjson);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
private parsePackageJson(pjson: IPackageJson, installPath: string): CameraUiPlugin {
|
|
128
|
-
const pluginPackageJson: CameraUiPlugin = {
|
|
129
|
-
id: this.id,
|
|
130
|
-
disabled: this.configService.config.plugins.disabledPlugins.includes(this.pluginName),
|
|
131
|
-
private: pjson.private ?? false,
|
|
132
|
-
pluginName: pjson.name,
|
|
133
|
-
displayName: pjson.displayName ?? PluginManager.transformDisplaName(pjson.name),
|
|
134
|
-
author: pjson.author ? (typeof pjson.author === 'string' ? pjson.author : pjson.author.name) : undefined,
|
|
135
|
-
description: pjson.description ? pjson.description.replace(/(?:https?|ftp):\/\/[\n\S]+/g, '').trim() : pjson.name,
|
|
136
|
-
installedVersion: pjson.version,
|
|
137
|
-
latestVersion: pjson.version,
|
|
138
|
-
globalInstall: false,
|
|
139
|
-
publicPackage: pjson.private ?? false,
|
|
140
|
-
engines: pjson.engines,
|
|
141
|
-
installPath,
|
|
142
|
-
links: {
|
|
143
|
-
npm: `https://www.npmjs.com/package/${this.pluginName}`,
|
|
144
|
-
homepage: pjson.homepage,
|
|
145
|
-
},
|
|
146
|
-
isPython: this.isPython,
|
|
147
|
-
isNode: !this.isPython,
|
|
148
|
-
'camera.ui': PluginManager.parseContract(pjson),
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
return pluginPackageJson;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private getMainFile(packageJSON: IPackageJson): string {
|
|
155
|
-
let main: string | undefined;
|
|
156
|
-
|
|
157
|
-
if (packageJSON.exports) {
|
|
158
|
-
if (typeof packageJSON.exports === 'string') {
|
|
159
|
-
main = packageJSON.exports;
|
|
160
|
-
} else {
|
|
161
|
-
const exports = packageJSON.exports.import ?? packageJSON.exports.require ?? packageJSON.exports.node ?? packageJSON.exports.default ?? packageJSON.exports['.'];
|
|
162
|
-
|
|
163
|
-
if (typeof exports !== 'string') {
|
|
164
|
-
if (exports.import) {
|
|
165
|
-
main = exports.import;
|
|
166
|
-
} else {
|
|
167
|
-
main = exports.require ?? exports.node ?? exports.default;
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
main = exports;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return main ?? packageJSON.main ?? './index.js';
|
|
176
|
-
}
|
|
177
|
-
}
|