@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interface/index.html +44 -44
- package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.CiB2EGly.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.DxMw_rJn.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.RxZ3hn6V.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.C-k73ACm.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.DumNu6GD.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.BuosoqFl.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.A7NJflGG.0.0.50-internal.1.js} +2 -2
- package/dist/interface/js/Cammesh.Dv3C0UiR.0.0.50-internal.1.js +1 -0
- package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.GgjJp7JR.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.BL3L-BFE.0.0.50-internal.1.js} +2 -2
- package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.CxwRmUVF.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.D16kkT6R.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.Bkp__d8n.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.C9HKvo0G.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.QuJjtAtF.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.BLUUbEej.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.DviCIk7w.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/Recordings.Dsp07cHs.0.0.50-internal.1.js +1 -0
- package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.Clx4y9gP.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.cfY4-PYd.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/SettingsAppearance.CBGZAazb.0.0.50-internal.1.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.kxAPXcBy.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.DOaJA4pp.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/SettingsRecordings.BGcwL6tk.0.0.50-internal.1.js +1 -0
- package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.BVU_w1Jm.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.P0vy90vA.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.DaP5m7eo.0.0.50-internal.1.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.MmrWYW3K.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0aqA_3x.0.0.50-internal.1.js} +2 -2
- package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.C9wgzklI.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.BeH6lJ5t.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.BQHSWV_g.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.DDKMxauw.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.dWz9rJqH.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.D-iZIS1n.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.BwxOddB_.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.Dz96RC_N.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.CmcM8OM6.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BgLcBzlw.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.6bOgRV7D.0.0.50-internal.1.js} +3 -3
- package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.CTgfs-3p.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CMhnq8jS.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CuC5ZfNs.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.DmwjJ4xV.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.DGZO3j1c.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.CEGHlD-T.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.D0keXzBc.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.CiDbFOB0.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.BPcXPAHG.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.DSGzrW_l.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.BKlEObmx.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.BDFILs86.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.DcxsxHCS.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.BGRg3oQ8.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.B9yk2de7.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.DXDZITpf.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.BDYaTfbi.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.CFEDA008.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.zqTafMgD.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.BxM3dbYs.0.0.50-internal.1.js} +1 -1
- package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.B6SY9IIj.0.0.50-internal.1.js} +1 -1
- package/dist/interface/sw.js +1 -1
- package/dist/server/package.json +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/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.1.css} +0 -0
- /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.1.png} +0 -0
- /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.1.png} +0 -0
- /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.1.png} +0 -0
- /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.1.css} +0 -0
- /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.DIUBesyz.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.1.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.1.js} +0 -0
- /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.1.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.1.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.1.js} +0 -0
- /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.1.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.1.js} +0 -0
- /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.1.js} +0 -0
- /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.1.js} +0 -0
package/src/api/utils/cert.ts
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import forge from 'node-forge';
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { isIPv4, isIPv6 } from 'node:net';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { container } from 'tsyringe';
|
|
6
|
-
|
|
7
|
-
import { DEFAULTS, HOST_CERT_FILENAME, HOST_KEY_FILENAME, OLD_ROOT_CERT_FILENAME, OLD_ROOT_KEY_FILENAME, ROOT_CERT_FILENAME, ROOT_KEY_FILENAME } from './constants.js';
|
|
8
|
-
|
|
9
|
-
import type { ConfigService } from '../../services/config/index.js';
|
|
10
|
-
|
|
11
|
-
export interface Certificate {
|
|
12
|
-
cert: string;
|
|
13
|
-
key: string;
|
|
14
|
-
certPath: string;
|
|
15
|
-
keyPath: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface Certificates extends Certificate {
|
|
19
|
-
ca: string;
|
|
20
|
-
caPath: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const makeNumberPositive = (hexString: string): string => {
|
|
24
|
-
let mostSignificativeHexDigitAsInt = Number.parseInt(hexString[0], 16);
|
|
25
|
-
if (mostSignificativeHexDigitAsInt < 8) return hexString;
|
|
26
|
-
mostSignificativeHexDigitAsInt -= 8;
|
|
27
|
-
return mostSignificativeHexDigitAsInt.toString() + hexString.slice(1);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const randomSerialNumber = (): string => {
|
|
31
|
-
return makeNumberPositive(forge.util.bytesToHex(forge.random.getBytesSync(20)));
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const getCertNotBefore = (): Date => {
|
|
35
|
-
const twoDaysAgo = new Date(Date.now() - 2 * 24 * 60 * 60 * 1000);
|
|
36
|
-
return new Date(twoDaysAgo.toISOString().split('T')[0] + 'T00:00:00Z');
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const getCertNotAfter = (notBefore: Date): Date => {
|
|
40
|
-
const ninetyDaysLater = new Date(notBefore.getTime() + 390 * 24 * 60 * 60 * 1000);
|
|
41
|
-
return new Date(ninetyDaysLater.toISOString().split('T')[0] + 'T23:59:59Z');
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const getCANotAfter = (notBefore: Date): Date => {
|
|
45
|
-
const hundredYearsLater = new Date(notBefore);
|
|
46
|
-
hundredYearsLater.setFullYear(hundredYearsLater.getFullYear() + 100);
|
|
47
|
-
return new Date(hundredYearsLater.toISOString().split('T')[0] + 'T23:59:59Z');
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const isCertificateValid = (certPath: string): boolean => {
|
|
51
|
-
const cert = forge.pki.certificateFromPem(readFileSync(certPath, 'utf8'));
|
|
52
|
-
const now = new Date();
|
|
53
|
-
return now >= cert.validity.notBefore && now <= cert.validity.notAfter;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const isLegacyCertificate = (certPath: string): boolean => {
|
|
57
|
-
try {
|
|
58
|
-
const certPem = readFileSync(certPath, 'utf8');
|
|
59
|
-
const cert = forge.pki.certificateFromPem(certPem);
|
|
60
|
-
|
|
61
|
-
const subject = cert.subject.getField('O');
|
|
62
|
-
const ou = cert.subject.getField('OU');
|
|
63
|
-
const cn = cert.subject.getField('CN');
|
|
64
|
-
|
|
65
|
-
return subject && subject.value === 'camera.ui' && ou && ou.value === 'cui' && cn && (cn.value === 'camera.ui root certificate' || cn.value.startsWith('camera.ui'));
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error('Error checking legacy certificate:', error);
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export class CertificateGeneration {
|
|
73
|
-
static createRootCA(customAddresses: string[]): Certificate {
|
|
74
|
-
const configService = container.resolve<ConfigService>('configService');
|
|
75
|
-
const serialNumber = randomSerialNumber();
|
|
76
|
-
|
|
77
|
-
const addresses: any[] = customAddresses.map((address) => ({
|
|
78
|
-
type: isIPv4(address) || isIPv6(address) ? 7 : 2,
|
|
79
|
-
ip: isIPv4(address) || isIPv6(address) ? address : undefined,
|
|
80
|
-
value: !(isIPv4(address) || isIPv6(address)) ? address : undefined,
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
if (!addresses.some((addr) => addr.ip === '127.0.0.1')) {
|
|
84
|
-
addresses.push({ type: 7, ip: '127.0.0.1' });
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const attributes = [
|
|
88
|
-
{ shortName: 'C', value: DEFAULTS.C },
|
|
89
|
-
{ shortName: 'ST', value: DEFAULTS.ST },
|
|
90
|
-
{ shortName: 'L', value: DEFAULTS.L },
|
|
91
|
-
{ shortName: 'CN', value: DEFAULTS.ROOT_CN },
|
|
92
|
-
{ shortName: 'O', value: DEFAULTS.O },
|
|
93
|
-
{ shortName: 'OU', value: DEFAULTS.OU },
|
|
94
|
-
];
|
|
95
|
-
|
|
96
|
-
const extensions = [
|
|
97
|
-
{ name: 'basicConstraints', cA: true, critical: true },
|
|
98
|
-
{
|
|
99
|
-
name: 'keyUsage',
|
|
100
|
-
critical: true,
|
|
101
|
-
keyCertSign: true,
|
|
102
|
-
cRLSign: true,
|
|
103
|
-
digitalSignature: true,
|
|
104
|
-
nonRepudiation: true,
|
|
105
|
-
keyEncipherment: true,
|
|
106
|
-
dataEncipherment: true,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'nsCertType',
|
|
110
|
-
client: true,
|
|
111
|
-
server: true,
|
|
112
|
-
email: true,
|
|
113
|
-
objsign: true,
|
|
114
|
-
sslCA: true,
|
|
115
|
-
emailCA: true,
|
|
116
|
-
objCA: true,
|
|
117
|
-
},
|
|
118
|
-
{ name: 'subjectKeyIdentifier' },
|
|
119
|
-
{ name: 'authorityKeyIdentifier', keyIdentifier: true },
|
|
120
|
-
{ name: 'subjectAltName', altNames: addresses },
|
|
121
|
-
];
|
|
122
|
-
|
|
123
|
-
const { privateKey, publicKey } = forge.pki.rsa.generateKeyPair(2048);
|
|
124
|
-
const cert = forge.pki.createCertificate();
|
|
125
|
-
|
|
126
|
-
cert.publicKey = publicKey;
|
|
127
|
-
cert.serialNumber = serialNumber;
|
|
128
|
-
cert.validity.notBefore = getCertNotBefore();
|
|
129
|
-
cert.validity.notAfter = getCANotAfter(cert.validity.notBefore);
|
|
130
|
-
|
|
131
|
-
cert.setSubject(attributes);
|
|
132
|
-
cert.setIssuer(attributes);
|
|
133
|
-
cert.setExtensions(extensions);
|
|
134
|
-
|
|
135
|
-
cert.sign(privateKey, forge.md.sha256.create());
|
|
136
|
-
|
|
137
|
-
const pemCert = forge.pki.certificateToPem(cert);
|
|
138
|
-
const pemPrivateKey = forge.pki.privateKeyToPem(privateKey);
|
|
139
|
-
|
|
140
|
-
const rootCertFilePath = join(configService.STORAGE_PATH, ROOT_CERT_FILENAME);
|
|
141
|
-
const rootPrivateKeyFilePath = join(configService.STORAGE_PATH, ROOT_KEY_FILENAME);
|
|
142
|
-
|
|
143
|
-
writeFileSync(rootCertFilePath, pemCert);
|
|
144
|
-
writeFileSync(rootPrivateKeyFilePath, pemPrivateKey);
|
|
145
|
-
|
|
146
|
-
return { cert: pemCert, certPath: rootCertFilePath, key: pemPrivateKey, keyPath: rootPrivateKeyFilePath };
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
static createHostCert(customAddresses: string[], rootCAObject: Certificate): Certificate {
|
|
150
|
-
const configService = container.resolve<ConfigService>('configService');
|
|
151
|
-
const addresses: any[] = customAddresses.map((address) => ({
|
|
152
|
-
type: isIPv4(address) || isIPv6(address) ? 7 : 2,
|
|
153
|
-
ip: isIPv4(address) || isIPv6(address) ? address : undefined,
|
|
154
|
-
value: !(isIPv4(address) || isIPv6(address)) ? address : undefined,
|
|
155
|
-
}));
|
|
156
|
-
|
|
157
|
-
if (!addresses.some((addr) => addr.ip === '127.0.0.1')) {
|
|
158
|
-
addresses.push({ type: 7, ip: '127.0.0.1' });
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const keyPairs = forge.pki.rsa.generateKeyPair(2048);
|
|
162
|
-
|
|
163
|
-
const caCert = forge.pki.certificateFromPem(rootCAObject.cert);
|
|
164
|
-
const caKey = forge.pki.privateKeyFromPem(rootCAObject.key);
|
|
165
|
-
|
|
166
|
-
const attributes = [
|
|
167
|
-
{ shortName: 'C', value: DEFAULTS.C },
|
|
168
|
-
{ shortName: 'ST', value: DEFAULTS.ST },
|
|
169
|
-
{ shortName: 'L', value: DEFAULTS.L },
|
|
170
|
-
{ shortName: 'CN', value: DEFAULTS.CN },
|
|
171
|
-
{ shortName: 'O', value: DEFAULTS.O },
|
|
172
|
-
];
|
|
173
|
-
|
|
174
|
-
const extensions = [
|
|
175
|
-
{ name: 'basicConstraints', cA: false },
|
|
176
|
-
{ name: 'nsCertType', server: true },
|
|
177
|
-
{ name: 'subjectKeyIdentifier' },
|
|
178
|
-
{
|
|
179
|
-
name: 'authorityKeyIdentifier',
|
|
180
|
-
authorityCertIssuer: true,
|
|
181
|
-
serialNumber: caCert.serialNumber,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
name: 'keyUsage',
|
|
185
|
-
critical: true,
|
|
186
|
-
digitalSignature: true,
|
|
187
|
-
keyEncipherment: true,
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: 'extKeyUsage',
|
|
191
|
-
critical: true,
|
|
192
|
-
serverAuth: true,
|
|
193
|
-
clientAuth: true,
|
|
194
|
-
},
|
|
195
|
-
{ name: 'subjectAltName', altNames: addresses },
|
|
196
|
-
];
|
|
197
|
-
|
|
198
|
-
const cert = forge.pki.createCertificate();
|
|
199
|
-
|
|
200
|
-
cert.publicKey = keyPairs.publicKey;
|
|
201
|
-
cert.serialNumber = randomSerialNumber();
|
|
202
|
-
cert.validity.notBefore = getCertNotBefore();
|
|
203
|
-
cert.validity.notAfter = getCertNotAfter(cert.validity.notBefore);
|
|
204
|
-
|
|
205
|
-
cert.setSubject(attributes);
|
|
206
|
-
cert.setIssuer(caCert.subject.attributes);
|
|
207
|
-
cert.setExtensions(extensions);
|
|
208
|
-
|
|
209
|
-
cert.sign(caKey, forge.md.sha256.create());
|
|
210
|
-
|
|
211
|
-
const pemCert = forge.pki.certificateToPem(cert);
|
|
212
|
-
const pemPrivateKey = forge.pki.privateKeyToPem(keyPairs.privateKey);
|
|
213
|
-
|
|
214
|
-
const certFilePath = join(configService.STORAGE_PATH, HOST_CERT_FILENAME);
|
|
215
|
-
const privateKeyFilePath = join(configService.STORAGE_PATH, HOST_KEY_FILENAME);
|
|
216
|
-
|
|
217
|
-
writeFileSync(certFilePath, pemCert);
|
|
218
|
-
writeFileSync(privateKeyFilePath, pemPrivateKey);
|
|
219
|
-
|
|
220
|
-
return { cert: pemCert, certPath: certFilePath, key: pemPrivateKey, keyPath: privateKeyFilePath };
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
static generateCert(forceNew?: boolean): Certificates {
|
|
224
|
-
const configService = container.resolve<ConfigService>('configService');
|
|
225
|
-
const sslConfig = configService.config.ssl;
|
|
226
|
-
|
|
227
|
-
const certExists = existsSync(sslConfig.certFile) && existsSync(sslConfig.keyFile) && existsSync(sslConfig.caFile);
|
|
228
|
-
const certIsValid = certExists && isCertificateValid(sslConfig.certFile) && isCertificateValid(sslConfig.caFile);
|
|
229
|
-
const isLegacy =
|
|
230
|
-
(certExists && isLegacyCertificate(sslConfig.certFile)) ||
|
|
231
|
-
sslConfig.certFile.endsWith(OLD_ROOT_CERT_FILENAME) ||
|
|
232
|
-
sslConfig.certFile.endsWith(OLD_ROOT_KEY_FILENAME);
|
|
233
|
-
|
|
234
|
-
if (!certExists || !certIsValid || isLegacy || forceNew) {
|
|
235
|
-
const CA = CertificateGeneration.createRootCA(sslConfig.addresses ?? []);
|
|
236
|
-
const hostCert = CertificateGeneration.createHostCert(sslConfig.addresses ?? [], CA);
|
|
237
|
-
|
|
238
|
-
return {
|
|
239
|
-
...hostCert,
|
|
240
|
-
ca: CA.cert,
|
|
241
|
-
caPath: CA.certPath,
|
|
242
|
-
};
|
|
243
|
-
} else {
|
|
244
|
-
return {
|
|
245
|
-
cert: readFileSync(sslConfig.certFile, 'utf8'),
|
|
246
|
-
certPath: sslConfig.certFile,
|
|
247
|
-
key: readFileSync(sslConfig.keyFile, 'utf8'),
|
|
248
|
-
keyPath: sslConfig.keyFile,
|
|
249
|
-
ca: readFileSync(sslConfig.caFile, 'utf8'),
|
|
250
|
-
caPath: sslConfig.caFile,
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const HOST_CERT_FILENAME = 'camera.ui.cert.pem';
|
|
2
|
-
export const HOST_KEY_FILENAME = 'camera.ui.key.pem';
|
|
3
|
-
export const ROOT_CERT_FILENAME = 'camera.ui.ca.cert.pem';
|
|
4
|
-
export const ROOT_KEY_FILENAME = 'camera.ui.ca.key.pem';
|
|
5
|
-
|
|
6
|
-
export const OLD_ROOT_CERT_FILENAME = 'camera.ui.root.cert.pem';
|
|
7
|
-
export const OLD_ROOT_KEY_FILENAME = 'camera.ui.root.key.pem';
|
|
8
|
-
|
|
9
|
-
export const DEFAULTS = {
|
|
10
|
-
C: 'DE',
|
|
11
|
-
ST: 'Berlin',
|
|
12
|
-
L: 'Berlin',
|
|
13
|
-
O: 'Camera UI',
|
|
14
|
-
OU: 'Camera UI Dev',
|
|
15
|
-
CN: 'localhost',
|
|
16
|
-
ROOT_CN: 'Camera UI Root CA',
|
|
17
|
-
};
|
package/src/api/utils/fetch.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export async function fetchWithTimeout(url: string, options?: RequestInit, timeout = 5000): Promise<Response> {
|
|
2
|
-
const controller = new AbortController();
|
|
3
|
-
const timeoutId = setTimeout(() => {
|
|
4
|
-
controller.abort();
|
|
5
|
-
}, timeout);
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
const response = await fetch(url, {
|
|
9
|
-
...options,
|
|
10
|
-
signal: controller.signal,
|
|
11
|
-
});
|
|
12
|
-
return response;
|
|
13
|
-
} catch (error) {
|
|
14
|
-
if (error instanceof Error && error.name === 'AbortError') {
|
|
15
|
-
throw new Error('Timeout: request took more than 15 seconds');
|
|
16
|
-
}
|
|
17
|
-
throw error;
|
|
18
|
-
} finally {
|
|
19
|
-
clearTimeout(timeoutId);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { move } from 'fs-extra/esm';
|
|
2
|
-
import { lstat, mkdir, readdir } from 'node:fs/promises';
|
|
3
|
-
import { dirname, join } from 'node:path';
|
|
4
|
-
|
|
5
|
-
export interface MoveOptions {
|
|
6
|
-
overwrite?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function moveFiles(source: string, destination: string, options: MoveOptions = { overwrite: true }): Promise<void> {
|
|
10
|
-
try {
|
|
11
|
-
const sourceStat = await lstat(source);
|
|
12
|
-
|
|
13
|
-
await mkdir(dirname(destination), { recursive: true });
|
|
14
|
-
|
|
15
|
-
if (sourceStat.isFile()) {
|
|
16
|
-
await move(source, destination, {
|
|
17
|
-
overwrite: options.overwrite,
|
|
18
|
-
});
|
|
19
|
-
} else if (sourceStat.isDirectory()) {
|
|
20
|
-
const files = await readdir(source);
|
|
21
|
-
|
|
22
|
-
await Promise.all(
|
|
23
|
-
files.map(async (file) => {
|
|
24
|
-
const sourcePath = join(source, file);
|
|
25
|
-
const targetPath = join(destination, file);
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
const stat = await lstat(sourcePath);
|
|
29
|
-
|
|
30
|
-
if (stat.isDirectory() || stat.isFile()) {
|
|
31
|
-
await mkdir(dirname(targetPath), { recursive: true });
|
|
32
|
-
await move(sourcePath, targetPath, {
|
|
33
|
-
overwrite: options.overwrite,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
} catch (error) {
|
|
37
|
-
throw new Error(`Failed to move ${file}: ${error.message}`);
|
|
38
|
-
}
|
|
39
|
-
}),
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
} catch (error) {
|
|
43
|
-
throw new Error(`File operation failed: ${error.message}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
package/src/api/utils/parse.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { JwtTokenDecoded } from '../types/index.js';
|
|
2
|
-
|
|
3
|
-
export function parseJwt(access_token: string): JwtTokenDecoded {
|
|
4
|
-
const base64Url = access_token.split('.')[1];
|
|
5
|
-
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
6
|
-
|
|
7
|
-
const jsonPayload: string = decodeURIComponent(
|
|
8
|
-
atob(base64)
|
|
9
|
-
.split('')
|
|
10
|
-
.map((c) => {
|
|
11
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
12
|
-
})
|
|
13
|
-
.join(''),
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
return JSON.parse(jsonPayload);
|
|
17
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Server } from 'socket.io';
|
|
2
|
-
import { container } from 'tsyringe';
|
|
3
|
-
|
|
4
|
-
import { authorize } from '../middlewares/socketAuth.middleware.js';
|
|
5
|
-
import { AuthService } from '../services/auth.service.js';
|
|
6
|
-
|
|
7
|
-
import { API_EVENT } from '../../api.js';
|
|
8
|
-
import { UsersService } from '../services/users.service.js';
|
|
9
|
-
import { LogsNamespace } from './nsp/logs.js';
|
|
10
|
-
import { MainNamespace } from './nsp/main.js';
|
|
11
|
-
import { MetricsNamespace } from './nsp/metrics.js';
|
|
12
|
-
import { NotificationsNamespace } from './nsp/notifications.js';
|
|
13
|
-
import { PluginsNamespace } from './nsp/plugins.js';
|
|
14
|
-
import { ServerNamespace } from './nsp/server.js';
|
|
15
|
-
import { StatusNamespace } from './nsp/status.js';
|
|
16
|
-
|
|
17
|
-
import type { FastifyInstance } from 'fastify';
|
|
18
|
-
import type { DisconnectReason, ServerOptions, Socket } from 'socket.io';
|
|
19
|
-
import type { CameraUiAPI } from '../../api.js';
|
|
20
|
-
import type { ConfigService } from '../../services/config/index.js';
|
|
21
|
-
import type { LoggerService } from '../../services/logger/index.js';
|
|
22
|
-
import type { JwtTokenDecoded } from '../types/index.js';
|
|
23
|
-
import type { SocketNsp, SocketNspMap } from './types.js';
|
|
24
|
-
|
|
25
|
-
export class SocketService {
|
|
26
|
-
public io: Server;
|
|
27
|
-
|
|
28
|
-
public namespaces = new Map<SocketNsp, SocketNspMap>();
|
|
29
|
-
public adminNsp: SocketNsp[] = ['/logs', '/notifications', '/status', '/metrics', '/plugins', '/server'];
|
|
30
|
-
|
|
31
|
-
private logger: LoggerService;
|
|
32
|
-
private authService!: AuthService;
|
|
33
|
-
private usersService!: UsersService;
|
|
34
|
-
private configService: ConfigService;
|
|
35
|
-
private api: CameraUiAPI;
|
|
36
|
-
|
|
37
|
-
constructor(app: FastifyInstance, opts: Partial<ServerOptions>) {
|
|
38
|
-
container.registerInstance('socketService', this);
|
|
39
|
-
|
|
40
|
-
this.logger = container.resolve<LoggerService>('logger');
|
|
41
|
-
this.configService = container.resolve<ConfigService>('configService');
|
|
42
|
-
this.api = container.resolve<CameraUiAPI>('api');
|
|
43
|
-
|
|
44
|
-
this.io = new Server(app.server, opts);
|
|
45
|
-
|
|
46
|
-
this.registerNamespaces();
|
|
47
|
-
|
|
48
|
-
this.api.setMaxListeners(this.api.getMaxListeners() + 1);
|
|
49
|
-
this.api.once(API_EVENT.SHUTDOWN, () => {
|
|
50
|
-
this.io.close();
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private async registerNamespaces(): Promise<void> {
|
|
55
|
-
this.authService = new AuthService();
|
|
56
|
-
this.usersService = new UsersService();
|
|
57
|
-
|
|
58
|
-
this.namespaces.set('/camera.ui', new MainNamespace(this.io));
|
|
59
|
-
this.namespaces.set('/server', new ServerNamespace(this.io));
|
|
60
|
-
this.namespaces.set('/notifications', new NotificationsNamespace(this.io));
|
|
61
|
-
this.namespaces.set('/metrics', new MetricsNamespace(this.io));
|
|
62
|
-
this.namespaces.set('/logs', new LogsNamespace(this.io));
|
|
63
|
-
this.namespaces.set('/status', new StatusNamespace(this.io));
|
|
64
|
-
this.namespaces.set('/plugins', new PluginsNamespace(this.io));
|
|
65
|
-
|
|
66
|
-
for (const [nsp, contructor] of this.namespaces) {
|
|
67
|
-
contructor.nsp.use(authorize({ secret: this.configService.SECRETS.jwtAccessKey })).on('connection', (socket: Socket) => this.setupConnection(socket, nsp));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
private setupConnection(socket: Socket, nsp: SocketNsp): void {
|
|
72
|
-
const decodedToken = socket.decodedToken as JwtTokenDecoded | undefined;
|
|
73
|
-
const user = this.usersService.findByName(decodedToken?.username ?? '');
|
|
74
|
-
const address = socket.conn.remoteAddress;
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
if (!user) {
|
|
78
|
-
throw new Error('User not found');
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (this.adminNsp.includes(nsp) && user.role !== 'admin' && user.role !== 'master') {
|
|
82
|
-
throw new Error(`Not authorized to connect to ${nsp}`);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const valid = this.authService.checkToken(socket.encodedToken!);
|
|
86
|
-
if (!valid) {
|
|
87
|
-
throw new Error('Unauthenticated');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const device = this.authService.clientDataByToken(socket.encodedToken!)?.device ?? 'unknown';
|
|
91
|
-
|
|
92
|
-
this.logger.trace(`${user.username} | ${address} | ${device} | authenticated and connected to ${nsp}`);
|
|
93
|
-
|
|
94
|
-
const onEnd = (reason: DisconnectReason = 'transport close') => {
|
|
95
|
-
this.logger.trace(`${user.username} | ${address} | ${device} | disconnected from ${nsp} (${reason})`);
|
|
96
|
-
|
|
97
|
-
socket.removeAllListeners('end');
|
|
98
|
-
socket.removeAllListeners('disconnect');
|
|
99
|
-
|
|
100
|
-
socket.disconnect();
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// socket.on('end', onEnd.bind(this));
|
|
104
|
-
socket.on('disconnect', onEnd.bind(this));
|
|
105
|
-
} catch {
|
|
106
|
-
socket.emit('unauthenticated');
|
|
107
|
-
socket.disconnect(true);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|