camera.ui3 0.0.30-alpha.0
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/@babel.l0sNRNKZ.0.0.30-alpha.0.js +1 -0
- package/dist/interface/@intlify.YW_pt133.0.0.30-alpha.0.js +15 -0
- package/dist/interface/@mdi.DnMbZhUH.0.0.30-alpha.0.js +1 -0
- package/dist/interface/@popperjs.BQBsAJpH.0.0.30-alpha.0.js +1 -0
- package/dist/interface/@react-dnd.CcwRs9xb.0.0.30-alpha.0.js +1 -0
- package/dist/interface/@socket.io.Dkula2eQ.0.0.30-alpha.0.js +1 -0
- package/dist/interface/@tanstack.DYQ7Jj8U.0.0.30-alpha.0.js +1 -0
- package/dist/interface/@vee-validate.0Cv0x9aN.0.0.30-alpha.0.js +5 -0
- package/dist/interface/@vue.CvjRlaU6.0.0.30-alpha.0.js +17 -0
- package/dist/interface/@vueform.Du_niMHk.0.0.30-alpha.0.js +1 -0
- package/dist/interface/@vueuse.Dv9U068T.0.0.30-alpha.0.js +1 -0
- package/dist/interface/@xterm.CnserxUX.0.0.30-alpha.0.js +66 -0
- package/dist/interface/Account.Dm2FouAU.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Adminpanel.B2Aiobnt.0.0.30-alpha.0.js +2 -0
- package/dist/interface/Appearance.EfH0tMdM.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Backup.D8SRclhB.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Camera.D-cOf4sS.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Cameras.oolxbmXU.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Camview.BHw8Pe3v.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Config.DmPTI5iz.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Console.Dq4khHFF.0.0.30-alpha.0.js +4 -0
- package/dist/interface/FirstSteps.Bo467abx.0.0.30-alpha.0.js +1 -0
- package/dist/interface/NewCamera.Kn9biZIb.0.0.30-alpha.0.js +448 -0
- package/dist/interface/Plugin.BLTVcTt1.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Plugins.Cp8mK__o.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Recordings.B_JIFk_G.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Recordings.gMbvwmk_.0.0.30-alpha.0.js +1 -0
- package/dist/interface/Settings.EhHJjGrl.0.0.30-alpha.0.js +1 -0
- package/dist/interface/System.VodoK0U6.0.0.30-alpha.0.js +4 -0
- package/dist/interface/User.DpcN7DEC.0.0.30-alpha.0.js +1 -0
- package/dist/interface/VConfigEditor.vue_vue_type_script_setup_true_lang.Br68bfQJ.0.0.30-alpha.0.js +2 -0
- package/dist/interface/VConsole.BT0UxZb1.0.0.30-alpha.0.js +1 -0
- package/dist/interface/VPlayer.DYua3Eh_.0.0.30-alpha.0.js +1 -0
- package/dist/interface/VPluginCard.Bz3GmzAE.0.0.30-alpha.0.js +4 -0
- package/dist/interface/ace-builds.SRW0xGs1.0.0.30-alpha.0.js +970 -0
- package/dist/interface/apexcharts.BV8prH5x.0.0.30-alpha.0.js +795 -0
- package/dist/interface/assets/@vueform.0.0.30-alpha.0.h7tNX9p6.css +1 -0
- package/dist/interface/assets/@xterm.0.0.30-alpha.0.CGrrDQr5.css +32 -0
- package/dist/interface/assets/Account.0.0.30-alpha.0.Ce3OmKrC.css +1 -0
- package/dist/interface/assets/Adminpanel.0.0.30-alpha.0.CXsTAXPL.css +1 -0
- package/dist/interface/assets/Backup.0.0.30-alpha.0.BIwaSlv3.css +1 -0
- package/dist/interface/assets/Camera.0.0.30-alpha.0.BDtUJ-lA.css +1 -0
- package/dist/interface/assets/Cameras.0.0.30-alpha.0.Djx0F2MM.css +1 -0
- package/dist/interface/assets/Camview.0.0.30-alpha.0.Ce_V-Nxj.css +1 -0
- package/dist/interface/assets/Config.0.0.30-alpha.0.k4QpWumg.css +1 -0
- package/dist/interface/assets/Console.0.0.30-alpha.0.DWrfRWs9.css +1 -0
- package/dist/interface/assets/FirstSteps.0.0.30-alpha.0.B3-pv8-a.css +1 -0
- package/dist/interface/assets/NewCamera.0.0.30-alpha.0.DJ3tUBT_.css +1 -0
- package/dist/interface/assets/Plugin.0.0.30-alpha.0.BtRA6zDt.css +1 -0
- package/dist/interface/assets/Plugins.0.0.30-alpha.0.Cwu0aGUO.css +1 -0
- package/dist/interface/assets/Settings.0.0.30-alpha.0.DC_-E3CR.css +1 -0
- package/dist/interface/assets/User.0.0.30-alpha.0.DPDcJbx8.css +1 -0
- package/dist/interface/assets/VConsole.0.0.30-alpha.0.BZT1WyS-.css +1 -0
- package/dist/interface/assets/VPlayer.0.0.30-alpha.0.CZXlTn4I.css +1 -0
- package/dist/interface/assets/VPluginCard.0.0.30-alpha.0.CIL48ca_.css +1 -0
- package/dist/interface/assets/highlight.0.0.30-alpha.0.DgoK_Xib.css +1 -0
- package/dist/interface/assets/logo-256.0.0.30-alpha.0.BCQk9H1-.png +0 -0
- package/dist/interface/assets/logo-512.0.0.30-alpha.0.DLKVOU2S.png +0 -0
- package/dist/interface/assets/logo.0.0.30-alpha.0.DmEiRk0z.png +0 -0
- package/dist/interface/assets/main.0.0.30-alpha.0.BOf8IWhK.css +1 -0
- package/dist/interface/assets/mode-json.0.0.30-alpha.0.Br7xisR1.js +275 -0
- package/dist/interface/assets/mode-yaml.0.0.30-alpha.0.CIYL8U3d.js +395 -0
- package/dist/interface/assets/v-calendar.0.0.30-alpha.0.CtSuDYZU.css +1 -0
- package/dist/interface/assets/vue3-toastify.0.0.30-alpha.0.DTY1DMRs.css +1 -0
- package/dist/interface/assets/vuetify.0.0.30-alpha.0.Cd1awv3t.css +5 -0
- package/dist/interface/axios.C-n2IhIP.0.0.30-alpha.0.js +6 -0
- package/dist/interface/browserconfig.xml +11 -0
- package/dist/interface/compare-versions.DqEOhma6.0.0.30-alpha.0.js +1 -0
- package/dist/interface/dijkstrajs.D_NXgYpA.0.0.30-alpha.0.js +1 -0
- package/dist/interface/dnd-core.BdsXoke-.0.0.30-alpha.0.js +1 -0
- package/dist/interface/draggabilly.D9j4BYFu.0.0.30-alpha.0.js +6 -0
- package/dist/interface/engine.io-client.di4Pt8W8.0.0.30-alpha.0.js +1 -0
- package/dist/interface/engine.io-parser.BiEtp6m2.0.0.30-alpha.0.js +1 -0
- package/dist/interface/entities.C20TfXL6.0.0.30-alpha.0.js +1 -0
- package/dist/interface/ev-emitter.Dxl4QoSg.0.0.30-alpha.0.js +1 -0
- package/dist/interface/fast-deep-equal.BUna8KlC.0.0.30-alpha.0.js +1 -0
- package/dist/interface/fonts/Inter/Inter-Regular.ttf +0 -0
- package/dist/interface/get-size.D1dS-IaP.0.0.30-alpha.0.js +5 -0
- package/dist/interface/highlight.js.CMosnU3p.0.0.30-alpha.0.js +2 -0
- package/dist/interface/index.html +376 -0
- package/dist/interface/linkify-it.B9RFwlcp.0.0.30-alpha.0.js +1 -0
- package/dist/interface/main.19pRAqPU.0.0.30-alpha.0.js +4 -0
- package/dist/interface/manifest.webmanifest +1 -0
- package/dist/interface/markdown-it.DAiultxC.0.0.30-alpha.0.js +15 -0
- package/dist/interface/mdurl.k9Sl0PQj.0.0.30-alpha.0.js +2 -0
- package/dist/interface/nprogress.C2KbBHcZ.0.0.30-alpha.0.js +2 -0
- package/dist/interface/pinia.DRjp4GU7.0.0.30-alpha.0.js +5 -0
- package/dist/interface/plugins.Ur_7V4x8.0.0.30-alpha.0.js +1 -0
- package/dist/interface/punycode.js.Dj65hjkv.0.0.30-alpha.0.js +1 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-1136x640.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-1334x750.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-1792x828.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2048x1536.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2160x1620.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2208x1242.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2224x1668.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2388x1668.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2436x1125.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2532x1170.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2556x1179.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2688x1242.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2732x2048.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2778x1284.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-dark-2796x1290.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-1136x640.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-1334x750.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-1792x828.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2048x1536.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2160x1620.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2208x1242.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2224x1668.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2388x1668.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2436x1125.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2532x1170.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2556x1179.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2688x1242.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2732x2048.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2778x1284.png +0 -0
- package/dist/interface/pwa/apple-splash-landscape-light-2796x1290.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1125x2436.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1170x2532.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1179x2556.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1242x2208.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1242x2688.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1284x2778.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1290x2796.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1536x2048.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1620x2160.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1668x2224.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-1668x2388.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-2048x2732.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-640x1136.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-750x1334.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-dark-828x1792.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1125x2436.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1170x2532.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1179x2556.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1242x2208.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1242x2688.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1284x2778.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1290x2796.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1536x2048.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1620x2160.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1668x2224.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-1668x2388.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-2048x2732.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-640x1136.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-750x1334.png +0 -0
- package/dist/interface/pwa/apple-splash-portrait-light-828x1792.png +0 -0
- package/dist/interface/pwa/apple-touch-icon-180x180.png +0 -0
- package/dist/interface/pwa/favicon-16.ico +0 -0
- package/dist/interface/pwa/favicon-32.ico +0 -0
- package/dist/interface/pwa/favicon-48.ico +0 -0
- package/dist/interface/pwa/favicon-64.ico +0 -0
- package/dist/interface/pwa/logo.svg +1 -0
- package/dist/interface/pwa/maskable-icon-1240x600.png +0 -0
- package/dist/interface/pwa/maskable-icon-512x512.png +0 -0
- package/dist/interface/pwa/maskable-icon-620x300.png +0 -0
- package/dist/interface/pwa/pwa-1024x1024.png +0 -0
- package/dist/interface/pwa/pwa-120x120.png +0 -0
- package/dist/interface/pwa/pwa-144x144.png +0 -0
- package/dist/interface/pwa/pwa-152x152.png +0 -0
- package/dist/interface/pwa/pwa-167x167.png +0 -0
- package/dist/interface/pwa/pwa-180x180.png +0 -0
- package/dist/interface/pwa/pwa-192x192.png +0 -0
- package/dist/interface/pwa/pwa-24x24.png +0 -0
- package/dist/interface/pwa/pwa-300x300.png +0 -0
- package/dist/interface/pwa/pwa-36x36.png +0 -0
- package/dist/interface/pwa/pwa-48x48.png +0 -0
- package/dist/interface/pwa/pwa-50x50.png +0 -0
- package/dist/interface/pwa/pwa-64x64.png +0 -0
- package/dist/interface/pwa/pwa-72x72.png +0 -0
- package/dist/interface/pwa/pwa-88x88.png +0 -0
- package/dist/interface/pwa/pwa-96x96.png +0 -0
- package/dist/interface/qrcode.DrYVb5am.0.0.30-alpha.0.js +8 -0
- package/dist/interface/react-dnd-html5-backend.1HQjlkwI.0.0.30-alpha.0.js +2 -0
- package/dist/interface/react-dnd-touch-backend.ByHGbrKq.0.0.30-alpha.0.js +1 -0
- package/dist/interface/redux.CuxFRhX_.0.0.30-alpha.0.js +1 -0
- package/dist/interface/registerSW.js +1 -0
- package/dist/interface/robots.txt +2 -0
- package/dist/interface/rxjs.Dl5P76vZ.0.0.30-alpha.0.js +3 -0
- package/dist/interface/socket.io-client.Cf7ABgrO.0.0.30-alpha.0.js +1 -0
- package/dist/interface/socket.io-parser.DHnwqfTj.0.0.30-alpha.0.js +1 -0
- package/dist/interface/sw.js +1 -0
- package/dist/interface/system.CRn9Cy3C.0.0.30-alpha.0.js +1 -0
- package/dist/interface/tslib.9k7AwCpt.0.0.30-alpha.0.js +1 -0
- package/dist/interface/uc.micro.kMc2yuuw.0.0.30-alpha.0.js +1 -0
- package/dist/interface/ui.C-XbEPHk.0.0.30-alpha.0.js +1 -0
- package/dist/interface/unidragger.zHlf1Df_.0.0.30-alpha.0.js +5 -0
- package/dist/interface/utils.BvINh1mj.0.0.30-alpha.0.js +1 -0
- package/dist/interface/uuid.DvF23Exx.0.0.30-alpha.0.js +1 -0
- package/dist/interface/v-calendar.CapJoEkJ.0.0.30-alpha.0.js +1 -0
- package/dist/interface/vee-validate.DcgOEpak.0.0.30-alpha.0.js +5 -0
- package/dist/interface/vue-i18n.D2pqkMP3.0.0.30-alpha.0.js +5 -0
- package/dist/interface/vue-inline-svg.DorOTPIf.0.0.30-alpha.0.js +1 -0
- package/dist/interface/vue-router.BVs4qaVs.0.0.30-alpha.0.js +5 -0
- package/dist/interface/vue.l0sNRNKZ.0.0.30-alpha.0.js +1 -0
- package/dist/interface/vue3-apexcharts.CBV9x5vk.0.0.30-alpha.0.js +1 -0
- package/dist/interface/vue3-dnd.CXMddGIZ.0.0.30-alpha.0.js +1 -0
- package/dist/interface/vue3-toastify.DE7YmDSX.0.0.30-alpha.0.js +1 -0
- package/dist/interface/vuetify.CYxxHEVN.0.0.30-alpha.0.js +5 -0
- package/dist/interface/workbox-3e911b1d.js +1 -0
- package/dist/interface/zod.BaF2dDCd.0.0.30-alpha.0.js +1 -0
- package/dist/server/bin/cameraui.d.ts +54 -0
- package/dist/server/bin/cameraui.js +622 -0
- package/dist/server/bin/cameraui.js.map +1 -0
- package/dist/server/bin/fork.d.ts +2 -0
- package/dist/server/bin/fork.js +13 -0
- package/dist/server/bin/fork.js.map +1 -0
- package/dist/server/bin/installer/base.d.ts +17 -0
- package/dist/server/bin/installer/base.js +45 -0
- package/dist/server/bin/installer/base.js.map +1 -0
- package/dist/server/bin/installer/darwin.d.ts +61 -0
- package/dist/server/bin/installer/darwin.js +249 -0
- package/dist/server/bin/installer/darwin.js.map +1 -0
- package/dist/server/bin/installer/freebsd.d.ts +64 -0
- package/dist/server/bin/installer/freebsd.js +254 -0
- package/dist/server/bin/installer/freebsd.js.map +1 -0
- package/dist/server/bin/installer/linux.d.ts +103 -0
- package/dist/server/bin/installer/linux.js +482 -0
- package/dist/server/bin/installer/linux.js.map +1 -0
- package/dist/server/bin/installer/win32.d.ts +45 -0
- package/dist/server/bin/installer/win32.js +178 -0
- package/dist/server/bin/installer/win32.js.map +1 -0
- package/dist/server/package.json +140 -0
- package/dist/server/requirements.txt +13 -0
- package/dist/server/src/api/controllers/api.controller.d.ts +7 -0
- package/dist/server/src/api/controllers/api.controller.js +14 -0
- package/dist/server/src/api/controllers/api.controller.js.map +1 -0
- package/dist/server/src/api/controllers/auth.controller.d.ts +16 -0
- package/dist/server/src/api/controllers/auth.controller.js +233 -0
- package/dist/server/src/api/controllers/auth.controller.js.map +1 -0
- package/dist/server/src/api/controllers/backup.controller.d.ts +10 -0
- package/dist/server/src/api/controllers/backup.controller.js +52 -0
- package/dist/server/src/api/controllers/backup.controller.js.map +1 -0
- package/dist/server/src/api/controllers/cameras.controller.d.ts +36 -0
- package/dist/server/src/api/controllers/cameras.controller.js +586 -0
- package/dist/server/src/api/controllers/cameras.controller.js.map +1 -0
- package/dist/server/src/api/controllers/config.controller.d.ts +14 -0
- package/dist/server/src/api/controllers/config.controller.js +89 -0
- package/dist/server/src/api/controllers/config.controller.js.map +1 -0
- package/dist/server/src/api/controllers/files.controller.d.ts +8 -0
- package/dist/server/src/api/controllers/files.controller.js +28 -0
- package/dist/server/src/api/controllers/files.controller.js.map +1 -0
- package/dist/server/src/api/controllers/frameWorkers.controller.d.ts +11 -0
- package/dist/server/src/api/controllers/frameWorkers.controller.js +85 -0
- package/dist/server/src/api/controllers/frameWorkers.controller.js.map +1 -0
- package/dist/server/src/api/controllers/plugins.controller.d.ts +58 -0
- package/dist/server/src/api/controllers/plugins.controller.js +1284 -0
- package/dist/server/src/api/controllers/plugins.controller.js.map +1 -0
- package/dist/server/src/api/controllers/system.controller.d.ts +21 -0
- package/dist/server/src/api/controllers/system.controller.js +230 -0
- package/dist/server/src/api/controllers/system.controller.js.map +1 -0
- package/dist/server/src/api/controllers/users.controller.d.ts +28 -0
- package/dist/server/src/api/controllers/users.controller.js +507 -0
- package/dist/server/src/api/controllers/users.controller.js.map +1 -0
- package/dist/server/src/api/database/index.d.ts +40 -0
- package/dist/server/src/api/database/index.js +254 -0
- package/dist/server/src/api/database/index.js.map +1 -0
- package/dist/server/src/api/database/migration.d.ts +12 -0
- package/dist/server/src/api/database/migration.js +47 -0
- package/dist/server/src/api/database/migration.js.map +1 -0
- package/dist/server/src/api/database/types.d.ts +226 -0
- package/dist/server/src/api/database/types.js +2 -0
- package/dist/server/src/api/database/types.js.map +1 -0
- package/dist/server/src/api/go2rtc/api/application.d.ts +9 -0
- package/dist/server/src/api/go2rtc/api/application.js +38 -0
- package/dist/server/src/api/go2rtc/api/application.js.map +1 -0
- package/dist/server/src/api/go2rtc/api/config.d.ts +8 -0
- package/dist/server/src/api/go2rtc/api/config.js +44 -0
- package/dist/server/src/api/go2rtc/api/config.js.map +1 -0
- package/dist/server/src/api/go2rtc/api/index.d.ts +1 -0
- package/dist/server/src/api/go2rtc/api/index.js +28 -0
- package/dist/server/src/api/go2rtc/api/index.js.map +1 -0
- package/dist/server/src/api/go2rtc/api/snapshot.d.ts +8 -0
- package/dist/server/src/api/go2rtc/api/snapshot.js +34 -0
- package/dist/server/src/api/go2rtc/api/snapshot.js.map +1 -0
- package/dist/server/src/api/go2rtc/api/streams.d.ts +11 -0
- package/dist/server/src/api/go2rtc/api/streams.js +57 -0
- package/dist/server/src/api/go2rtc/api/streams.js.map +1 -0
- package/dist/server/src/api/go2rtc/index.d.ts +13 -0
- package/dist/server/src/api/go2rtc/index.js +25 -0
- package/dist/server/src/api/go2rtc/index.js.map +1 -0
- package/dist/server/src/api/go2rtc/queue.d.ts +10 -0
- package/dist/server/src/api/go2rtc/queue.js +38 -0
- package/dist/server/src/api/go2rtc/queue.js.map +1 -0
- package/dist/server/src/api/go2rtc/types.d.ts +108 -0
- package/dist/server/src/api/go2rtc/types.js +2 -0
- package/dist/server/src/api/go2rtc/types.js.map +1 -0
- package/dist/server/src/api/index.d.ts +20 -0
- package/dist/server/src/api/index.js +223 -0
- package/dist/server/src/api/index.js.map +1 -0
- package/dist/server/src/api/middlewares/authPermission.middleware.d.ts +5 -0
- package/dist/server/src/api/middlewares/authPermission.middleware.js +28 -0
- package/dist/server/src/api/middlewares/authPermission.middleware.js.map +1 -0
- package/dist/server/src/api/middlewares/authValidation.middleware.d.ts +4 -0
- package/dist/server/src/api/middlewares/authValidation.middleware.js +129 -0
- package/dist/server/src/api/middlewares/authValidation.middleware.js.map +1 -0
- package/dist/server/src/api/middlewares/pagination.middleware.d.ts +3 -0
- package/dist/server/src/api/middlewares/pagination.middleware.js +65 -0
- package/dist/server/src/api/middlewares/pagination.middleware.js.map +1 -0
- package/dist/server/src/api/middlewares/socketAuth.middleware.d.ts +41 -0
- package/dist/server/src/api/middlewares/socketAuth.middleware.js +81 -0
- package/dist/server/src/api/middlewares/socketAuth.middleware.js.map +1 -0
- package/dist/server/src/api/plugins/cameraui.plugin.d.ts +11 -0
- package/dist/server/src/api/plugins/cameraui.plugin.js +6 -0
- package/dist/server/src/api/plugins/cameraui.plugin.js.map +1 -0
- package/dist/server/src/api/plugins/database.plugin.d.ts +11 -0
- package/dist/server/src/api/plugins/database.plugin.js +12 -0
- package/dist/server/src/api/plugins/database.plugin.js.map +1 -0
- package/dist/server/src/api/plugins/go2rtc.plugin.d.ts +11 -0
- package/dist/server/src/api/plugins/go2rtc.plugin.js +11 -0
- package/dist/server/src/api/plugins/go2rtc.plugin.js.map +1 -0
- package/dist/server/src/api/plugins/logger.plugin.d.ts +7 -0
- package/dist/server/src/api/plugins/logger.plugin.js +29 -0
- package/dist/server/src/api/plugins/logger.plugin.js.map +1 -0
- package/dist/server/src/api/plugins/socket.plugin.d.ts +11 -0
- package/dist/server/src/api/plugins/socket.plugin.js +12 -0
- package/dist/server/src/api/plugins/socket.plugin.js.map +1 -0
- package/dist/server/src/api/plugins/system.plugin.d.ts +18 -0
- package/dist/server/src/api/plugins/system.plugin.js +22 -0
- package/dist/server/src/api/plugins/system.plugin.js.map +1 -0
- package/dist/server/src/api/plugins/useragent.plugin.d.ts +8 -0
- package/dist/server/src/api/plugins/useragent.plugin.js +10 -0
- package/dist/server/src/api/plugins/useragent.plugin.js.map +1 -0
- package/dist/server/src/api/routes/api.routes.d.ts +2 -0
- package/dist/server/src/api/routes/api.routes.js +7 -0
- package/dist/server/src/api/routes/api.routes.js.map +1 -0
- package/dist/server/src/api/routes/auth.routes.d.ts +2 -0
- package/dist/server/src/api/routes/auth.routes.js +47 -0
- package/dist/server/src/api/routes/auth.routes.js.map +1 -0
- package/dist/server/src/api/routes/backup.routes.d.ts +2 -0
- package/dist/server/src/api/routes/backup.routes.js +23 -0
- package/dist/server/src/api/routes/backup.routes.js.map +1 -0
- package/dist/server/src/api/routes/cameras.routes.d.ts +2 -0
- package/dist/server/src/api/routes/cameras.routes.js +205 -0
- package/dist/server/src/api/routes/cameras.routes.js.map +1 -0
- package/dist/server/src/api/routes/config.routes.d.ts +2 -0
- package/dist/server/src/api/routes/config.routes.js +55 -0
- package/dist/server/src/api/routes/config.routes.js.map +1 -0
- package/dist/server/src/api/routes/files.routes.d.ts +2 -0
- package/dist/server/src/api/routes/files.routes.js +12 -0
- package/dist/server/src/api/routes/files.routes.js.map +1 -0
- package/dist/server/src/api/routes/frameWorkers.routes.d.ts +2 -0
- package/dist/server/src/api/routes/frameWorkers.routes.js +33 -0
- package/dist/server/src/api/routes/frameWorkers.routes.js.map +1 -0
- package/dist/server/src/api/routes/index.d.ts +6 -0
- package/dist/server/src/api/routes/index.js +32 -0
- package/dist/server/src/api/routes/index.js.map +1 -0
- package/dist/server/src/api/routes/plugins.routes.d.ts +2 -0
- package/dist/server/src/api/routes/plugins.routes.js +339 -0
- package/dist/server/src/api/routes/plugins.routes.js.map +1 -0
- package/dist/server/src/api/routes/system.routes.d.ts +2 -0
- package/dist/server/src/api/routes/system.routes.js +83 -0
- package/dist/server/src/api/routes/system.routes.js.map +1 -0
- package/dist/server/src/api/routes/users.routes.d.ts +2 -0
- package/dist/server/src/api/routes/users.routes.js +139 -0
- package/dist/server/src/api/routes/users.routes.js.map +1 -0
- package/dist/server/src/api/schemas/backup.schema.d.ts +118 -0
- package/dist/server/src/api/schemas/backup.schema.js +75 -0
- package/dist/server/src/api/schemas/backup.schema.js.map +1 -0
- package/dist/server/src/api/schemas/cameras.schema.d.ts +940 -0
- package/dist/server/src/api/schemas/cameras.schema.js +314 -0
- package/dist/server/src/api/schemas/cameras.schema.js.map +1 -0
- package/dist/server/src/api/schemas/config.schema.d.ts +122 -0
- package/dist/server/src/api/schemas/config.schema.js +44 -0
- package/dist/server/src/api/schemas/config.schema.js.map +1 -0
- package/dist/server/src/api/schemas/go2rtc.schema.d.ts +703 -0
- package/dist/server/src/api/schemas/go2rtc.schema.js +180 -0
- package/dist/server/src/api/schemas/go2rtc.schema.js.map +1 -0
- package/dist/server/src/api/schemas/plugins.schema.d.ts +72 -0
- package/dist/server/src/api/schemas/plugins.schema.js +103 -0
- package/dist/server/src/api/schemas/plugins.schema.js.map +1 -0
- package/dist/server/src/api/schemas/system.schema.d.ts +9 -0
- package/dist/server/src/api/schemas/system.schema.js +8 -0
- package/dist/server/src/api/schemas/system.schema.js.map +1 -0
- package/dist/server/src/api/schemas/users.schema.d.ts +1013 -0
- package/dist/server/src/api/schemas/users.schema.js +157 -0
- package/dist/server/src/api/schemas/users.schema.js.map +1 -0
- package/dist/server/src/api/services/auth.service.d.ts +24 -0
- package/dist/server/src/api/services/auth.service.js +191 -0
- package/dist/server/src/api/services/auth.service.js.map +1 -0
- package/dist/server/src/api/services/backup.service.d.ts +11 -0
- package/dist/server/src/api/services/backup.service.js +109 -0
- package/dist/server/src/api/services/backup.service.js.map +1 -0
- package/dist/server/src/api/services/cameras.service.d.ts +52 -0
- package/dist/server/src/api/services/cameras.service.js +713 -0
- package/dist/server/src/api/services/cameras.service.js.map +1 -0
- package/dist/server/src/api/services/plugins.service.d.ts +25 -0
- package/dist/server/src/api/services/plugins.service.js +143 -0
- package/dist/server/src/api/services/plugins.service.js.map +1 -0
- package/dist/server/src/api/services/system.service.d.ts +7 -0
- package/dist/server/src/api/services/system.service.js +23 -0
- package/dist/server/src/api/services/system.service.js.map +1 -0
- package/dist/server/src/api/services/users.service.d.ts +25 -0
- package/dist/server/src/api/services/users.service.js +198 -0
- package/dist/server/src/api/services/users.service.js.map +1 -0
- package/dist/server/src/api/types/index.d.ts +599 -0
- package/dist/server/src/api/types/index.js +9 -0
- package/dist/server/src/api/types/index.js.map +1 -0
- package/dist/server/src/api/utils/cert.d.ts +11 -0
- package/dist/server/src/api/utils/cert.js +411 -0
- package/dist/server/src/api/utils/cert.js.map +1 -0
- package/dist/server/src/api/utils/constants.d.ts +15 -0
- package/dist/server/src/api/utils/constants.js +17 -0
- package/dist/server/src/api/utils/constants.js.map +1 -0
- package/dist/server/src/api/utils/fetch.d.ts +2 -0
- package/dist/server/src/api/utils/fetch.js +24 -0
- package/dist/server/src/api/utils/fetch.js.map +1 -0
- package/dist/server/src/api/utils/moveFiles.d.ts +1 -0
- package/dist/server/src/api/utils/moveFiles.js +39 -0
- package/dist/server/src/api/utils/moveFiles.js.map +1 -0
- package/dist/server/src/api/utils/parse.d.ts +2 -0
- package/dist/server/src/api/utils/parse.js +12 -0
- package/dist/server/src/api/utils/parse.js.map +1 -0
- package/dist/server/src/api/websocket/index.d.ts +16 -0
- package/dist/server/src/api/websocket/index.js +75 -0
- package/dist/server/src/api/websocket/index.js.map +1 -0
- package/dist/server/src/api/websocket/nsp/logs.d.ts +11 -0
- package/dist/server/src/api/websocket/nsp/logs.js +114 -0
- package/dist/server/src/api/websocket/nsp/logs.js.map +1 -0
- package/dist/server/src/api/websocket/nsp/main.d.ts +7 -0
- package/dist/server/src/api/websocket/nsp/main.js +8 -0
- package/dist/server/src/api/websocket/nsp/main.js.map +1 -0
- package/dist/server/src/api/websocket/nsp/metrics.d.ts +24 -0
- package/dist/server/src/api/websocket/nsp/metrics.js +166 -0
- package/dist/server/src/api/websocket/nsp/metrics.js.map +1 -0
- package/dist/server/src/api/websocket/nsp/notifications.d.ts +12 -0
- package/dist/server/src/api/websocket/nsp/notifications.js +30 -0
- package/dist/server/src/api/websocket/nsp/notifications.js.map +1 -0
- package/dist/server/src/api/websocket/nsp/plugins.d.ts +13 -0
- package/dist/server/src/api/websocket/nsp/plugins.js +29 -0
- package/dist/server/src/api/websocket/nsp/plugins.js.map +1 -0
- package/dist/server/src/api/websocket/nsp/server.d.ts +21 -0
- package/dist/server/src/api/websocket/nsp/server.js +134 -0
- package/dist/server/src/api/websocket/nsp/server.js.map +1 -0
- package/dist/server/src/api/websocket/nsp/status.d.ts +15 -0
- package/dist/server/src/api/websocket/nsp/status.js +53 -0
- package/dist/server/src/api/websocket/nsp/status.js.map +1 -0
- package/dist/server/src/api/websocket/types.d.ts +47 -0
- package/dist/server/src/api/websocket/types.js +2 -0
- package/dist/server/src/api/websocket/types.js.map +1 -0
- package/dist/server/src/api.d.ts +43 -0
- package/dist/server/src/api.js +90 -0
- package/dist/server/src/api.js.map +1 -0
- package/dist/server/src/camera/controller.d.ts +41 -0
- package/dist/server/src/camera/controller.js +198 -0
- package/dist/server/src/camera/controller.js.map +1 -0
- package/dist/server/src/camera/device.d.ts +29 -0
- package/dist/server/src/camera/device.js +20 -0
- package/dist/server/src/camera/device.js.map +1 -0
- package/dist/server/src/camera/index.d.ts +90 -0
- package/dist/server/src/camera/index.js +581 -0
- package/dist/server/src/camera/index.js.map +1 -0
- package/dist/server/src/camera/interfaces/camera.d.ts +10 -0
- package/dist/server/src/camera/interfaces/camera.js +23 -0
- package/dist/server/src/camera/interfaces/camera.js.map +1 -0
- package/dist/server/src/camera/interfaces/prebuffer.d.ts +11 -0
- package/dist/server/src/camera/interfaces/prebuffer.js +31 -0
- package/dist/server/src/camera/interfaces/prebuffer.js.map +1 -0
- package/dist/server/src/camera/interfaces/ptz.d.ts +13 -0
- package/dist/server/src/camera/interfaces/ptz.js +47 -0
- package/dist/server/src/camera/interfaces/ptz.js.map +1 -0
- package/dist/server/src/camera/iou.d.ts +2 -0
- package/dist/server/src/camera/iou.js +53 -0
- package/dist/server/src/camera/iou.js.map +1 -0
- package/dist/server/src/camera/polygon.d.ts +6 -0
- package/dist/server/src/camera/polygon.js +151 -0
- package/dist/server/src/camera/polygon.js.map +1 -0
- package/dist/server/src/camera/streaming/peer-connection.d.ts +55 -0
- package/dist/server/src/camera/streaming/peer-connection.js +203 -0
- package/dist/server/src/camera/streaming/peer-connection.js.map +1 -0
- package/dist/server/src/camera/streaming/webrtc-connection.d.ts +35 -0
- package/dist/server/src/camera/streaming/webrtc-connection.js +170 -0
- package/dist/server/src/camera/streaming/webrtc-connection.js.map +1 -0
- package/dist/server/src/camera/streaming/werift-session.d.ts +41 -0
- package/dist/server/src/camera/streaming/werift-session.js +179 -0
- package/dist/server/src/camera/streaming/werift-session.js.map +1 -0
- package/dist/server/src/camera/types.d.ts +201 -0
- package/dist/server/src/camera/types.js +7 -0
- package/dist/server/src/camera/types.js.map +1 -0
- package/dist/server/src/camera/videoFrame.d.ts +24 -0
- package/dist/server/src/camera/videoFrame.js +104 -0
- package/dist/server/src/camera/videoFrame.js.map +1 -0
- package/dist/server/src/decoder/index.d.ts +11 -0
- package/dist/server/src/decoder/index.js +32 -0
- package/dist/server/src/decoder/index.js.map +1 -0
- package/dist/server/src/decoder/types.d.ts +151 -0
- package/dist/server/src/decoder/types.js +2 -0
- package/dist/server/src/decoder/types.js.map +1 -0
- package/dist/server/src/decoder/worker.d.ts +39 -0
- package/dist/server/src/decoder/worker.js +245 -0
- package/dist/server/src/decoder/worker.js.map +1 -0
- package/dist/server/src/go2rtc/index.d.ts +25 -0
- package/dist/server/src/go2rtc/index.js +221 -0
- package/dist/server/src/go2rtc/index.js.map +1 -0
- package/dist/server/src/go2rtc/types.d.ts +14 -0
- package/dist/server/src/go2rtc/types.js +73 -0
- package/dist/server/src/go2rtc/types.js.map +1 -0
- package/dist/server/src/index.d.ts +18 -0
- package/dist/server/src/index.js +5 -0
- package/dist/server/src/index.js.map +1 -0
- package/dist/server/src/main.d.ts +1 -0
- package/dist/server/src/main.js +132 -0
- package/dist/server/src/main.js.map +1 -0
- package/dist/server/src/nats/connection.d.ts +17 -0
- package/dist/server/src/nats/connection.js +66 -0
- package/dist/server/src/nats/connection.js.map +1 -0
- package/dist/server/src/nats/constants.d.ts +1 -0
- package/dist/server/src/nats/constants.js +2 -0
- package/dist/server/src/nats/constants.js.map +1 -0
- package/dist/server/src/nats/error.d.ts +9 -0
- package/dist/server/src/nats/error.js +11 -0
- package/dist/server/src/nats/error.js.map +1 -0
- package/dist/server/src/nats/index.d.ts +40 -0
- package/dist/server/src/nats/index.js +165 -0
- package/dist/server/src/nats/index.js.map +1 -0
- package/dist/server/src/nats/messageQueue.d.ts +20 -0
- package/dist/server/src/nats/messageQueue.js +132 -0
- package/dist/server/src/nats/messageQueue.js.map +1 -0
- package/dist/server/src/nats/proxy/cameraDevice.d.ts +21 -0
- package/dist/server/src/nats/proxy/cameraDevice.js +252 -0
- package/dist/server/src/nats/proxy/cameraDevice.js.map +1 -0
- package/dist/server/src/nats/proxy/coreManager.d.ts +14 -0
- package/dist/server/src/nats/proxy/coreManager.js +63 -0
- package/dist/server/src/nats/proxy/coreManager.js.map +1 -0
- package/dist/server/src/nats/proxy/deviceManager.d.ts +16 -0
- package/dist/server/src/nats/proxy/deviceManager.js +99 -0
- package/dist/server/src/nats/proxy/deviceManager.js.map +1 -0
- package/dist/server/src/nats/server.d.ts +38 -0
- package/dist/server/src/nats/server.js +317 -0
- package/dist/server/src/nats/server.js.map +1 -0
- package/dist/server/src/nats/subscription.d.ts +12 -0
- package/dist/server/src/nats/subscription.js +21 -0
- package/dist/server/src/nats/subscription.js.map +1 -0
- package/dist/server/src/nats/types.d.ts +129 -0
- package/dist/server/src/nats/types.js +2 -0
- package/dist/server/src/nats/types.js.map +1 -0
- package/dist/server/src/nats/utils.d.ts +2 -0
- package/dist/server/src/nats/utils.js +12 -0
- package/dist/server/src/nats/utils.js.map +1 -0
- package/dist/server/src/nats/websocket.d.ts +27 -0
- package/dist/server/src/nats/websocket.js +217 -0
- package/dist/server/src/nats/websocket.js.map +1 -0
- package/dist/server/src/plugins/index.d.ts +30 -0
- package/dist/server/src/plugins/index.js +242 -0
- package/dist/server/src/plugins/index.js.map +1 -0
- package/dist/server/src/plugins/interfaces/audioDetection.d.ts +7 -0
- package/dist/server/src/plugins/interfaces/audioDetection.js +4 -0
- package/dist/server/src/plugins/interfaces/audioDetection.js.map +1 -0
- package/dist/server/src/plugins/interfaces/base.d.ts +6 -0
- package/dist/server/src/plugins/interfaces/base.js +3 -0
- package/dist/server/src/plugins/interfaces/base.js.map +1 -0
- package/dist/server/src/plugins/interfaces/motionDetection.d.ts +6 -0
- package/dist/server/src/plugins/interfaces/motionDetection.js +4 -0
- package/dist/server/src/plugins/interfaces/motionDetection.js.map +1 -0
- package/dist/server/src/plugins/interfaces/objectDetection.d.ts +7 -0
- package/dist/server/src/plugins/interfaces/objectDetection.js +4 -0
- package/dist/server/src/plugins/interfaces/objectDetection.js.map +1 -0
- package/dist/server/src/plugins/plugin.d.ts +33 -0
- package/dist/server/src/plugins/plugin.js +159 -0
- package/dist/server/src/plugins/plugin.js.map +1 -0
- package/dist/server/src/plugins/types.d.ts +154 -0
- package/dist/server/src/plugins/types.js +18 -0
- package/dist/server/src/plugins/types.js.map +1 -0
- package/dist/server/src/plugins/worker.d.ts +36 -0
- package/dist/server/src/plugins/worker.js +302 -0
- package/dist/server/src/plugins/worker.js.map +1 -0
- package/dist/server/src/polyglot/node/decoder/child.d.ts +1 -0
- package/dist/server/src/polyglot/node/decoder/child.js +644 -0
- package/dist/server/src/polyglot/node/decoder/child.js.map +1 -0
- package/dist/server/src/polyglot/node/decoder/imageUtils.d.ts +24 -0
- package/dist/server/src/polyglot/node/decoder/imageUtils.js +205 -0
- package/dist/server/src/polyglot/node/decoder/imageUtils.js.map +1 -0
- package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.d.ts +144 -0
- package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.js +65 -0
- package/dist/server/src/polyglot/node/decoder/wasm/build/decoder.wasm +0 -0
- package/dist/server/src/polyglot/node/decoder/wasm/test/imageUtils.py +106 -0
- package/dist/server/src/polyglot/node/plugins/cameraStorage.d.ts +107 -0
- package/dist/server/src/polyglot/node/plugins/cameraStorage.js +292 -0
- package/dist/server/src/polyglot/node/plugins/cameraStorage.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/child.d.ts +28 -0
- package/dist/server/src/polyglot/node/plugins/child.js +222 -0
- package/dist/server/src/polyglot/node/plugins/child.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/configService.d.ts +104 -0
- package/dist/server/src/polyglot/node/plugins/configService.js +213 -0
- package/dist/server/src/polyglot/node/plugins/configService.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/pluginApi.d.ts +35 -0
- package/dist/server/src/polyglot/node/plugins/pluginApi.js +23 -0
- package/dist/server/src/polyglot/node/plugins/pluginApi.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/pluginLogger.d.ts +18 -0
- package/dist/server/src/polyglot/node/plugins/pluginLogger.js +89 -0
- package/dist/server/src/polyglot/node/plugins/pluginLogger.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.d.ts +69 -0
- package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.js +423 -0
- package/dist/server/src/polyglot/node/plugins/proxy/cameraDevice.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/proxy/coreManager.d.ts +40 -0
- package/dist/server/src/polyglot/node/plugins/proxy/coreManager.js +105 -0
- package/dist/server/src/polyglot/node/plugins/proxy/coreManager.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.d.ts +47 -0
- package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.js +164 -0
- package/dist/server/src/polyglot/node/plugins/proxy/deviceManager.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/schema.d.ts +293 -0
- package/dist/server/src/polyglot/node/plugins/schema.js +740 -0
- package/dist/server/src/polyglot/node/plugins/schema.js.map +1 -0
- package/dist/server/src/polyglot/node/plugins/storageController.d.ts +30 -0
- package/dist/server/src/polyglot/node/plugins/storageController.js +40 -0
- package/dist/server/src/polyglot/node/plugins/storageController.js.map +1 -0
- package/dist/server/src/polyglot/python/camera/interfaces/camera.py +20 -0
- package/dist/server/src/polyglot/python/camera/interfaces/prebuffer.py +28 -0
- package/dist/server/src/polyglot/python/camera/interfaces/ptz.py +38 -0
- package/dist/server/src/polyglot/python/camera/iou.py +80 -0
- package/dist/server/src/polyglot/python/camera/polygon.py +173 -0
- package/dist/server/src/polyglot/python/camera/video_frame.py +188 -0
- package/dist/server/src/polyglot/python/camera_ui_types/__init__.py +1200 -0
- package/dist/server/src/polyglot/python/decoder/child.py +882 -0
- package/dist/server/src/polyglot/python/decoder/image_utils.py +149 -0
- package/dist/server/src/polyglot/python/decoder/typings.py +99 -0
- package/dist/server/src/polyglot/python/plugins/camera_storage.py +391 -0
- package/dist/server/src/polyglot/python/plugins/child.py +394 -0
- package/dist/server/src/polyglot/python/plugins/config_service.py +187 -0
- package/dist/server/src/polyglot/python/plugins/constants.py +1 -0
- package/dist/server/src/polyglot/python/plugins/message_queue.py +182 -0
- package/dist/server/src/polyglot/python/plugins/plugin_api.py +34 -0
- package/dist/server/src/polyglot/python/plugins/plugin_logger.py +111 -0
- package/dist/server/src/polyglot/python/plugins/proxy/camera_device.py +1599 -0
- package/dist/server/src/polyglot/python/plugins/proxy/core_manager.py +145 -0
- package/dist/server/src/polyglot/python/plugins/proxy/device_manager.py +226 -0
- package/dist/server/src/polyglot/python/plugins/schema.py +181 -0
- package/dist/server/src/polyglot/python/plugins/storage_controller.py +58 -0
- package/dist/server/src/polyglot/python/plugins/typings.py +253 -0
- package/dist/server/src/polyglot/python/utilities/connection.py +86 -0
- package/dist/server/src/polyglot/python/utilities/json_lmdb.py +19 -0
- package/dist/server/src/polyglot/python/utilities/object_path.py +195 -0
- package/dist/server/src/polyglot/python/utilities/packer.py +11 -0
- package/dist/server/src/polyglot/python/utilities/subscriptions.py +22 -0
- package/dist/server/src/polyglot/python/utilities/task.py +35 -0
- package/dist/server/src/polyglot/python/utilities/thread.py +10 -0
- package/dist/server/src/polyglot/python/utilities/utils.py +73 -0
- package/dist/server/src/services/config/constants.d.ts +4 -0
- package/dist/server/src/services/config/constants.js +59 -0
- package/dist/server/src/services/config/constants.js.map +1 -0
- package/dist/server/src/services/config/index.d.ts +60 -0
- package/dist/server/src/services/config/index.js +391 -0
- package/dist/server/src/services/config/index.js.map +1 -0
- package/dist/server/src/services/config/types.d.ts +161 -0
- package/dist/server/src/services/config/types.js +11 -0
- package/dist/server/src/services/config/types.js.map +1 -0
- package/dist/server/src/services/logger/index.d.ts +23 -0
- package/dist/server/src/services/logger/index.js +114 -0
- package/dist/server/src/services/logger/index.js.map +1 -0
- package/dist/server/src/types.d.ts +7 -0
- package/dist/server/src/types.js +2 -0
- package/dist/server/src/types.js.map +1 -0
- package/dist/server/src/utils/ffmpeg.d.ts +2 -0
- package/dist/server/src/utils/ffmpeg.js +61 -0
- package/dist/server/src/utils/ffmpeg.js.map +1 -0
- package/dist/server/src/utils/network.d.ts +12 -0
- package/dist/server/src/utils/network.js +92 -0
- package/dist/server/src/utils/network.js.map +1 -0
- package/dist/server/src/utils/npm.d.ts +4 -0
- package/dist/server/src/utils/npm.js +128 -0
- package/dist/server/src/utils/npm.js.map +1 -0
- package/dist/server/src/utils/packer.d.ts +2 -0
- package/dist/server/src/utils/packer.js +17 -0
- package/dist/server/src/utils/packer.js.map +1 -0
- package/dist/server/src/utils/pythonInstaller.d.ts +48 -0
- package/dist/server/src/utils/pythonInstaller.js +494 -0
- package/dist/server/src/utils/pythonInstaller.js.map +1 -0
- package/dist/server/src/utils/reader.d.ts +5 -0
- package/dist/server/src/utils/reader.js +41 -0
- package/dist/server/src/utils/reader.js.map +1 -0
- package/dist/server/src/utils/subscribed.d.ts +9 -0
- package/dist/server/src/utils/subscribed.js +17 -0
- package/dist/server/src/utils/subscribed.js.map +1 -0
- package/dist/server/src/utils/utils.d.ts +10 -0
- package/dist/server/src/utils/utils.js +165 -0
- package/dist/server/src/utils/utils.js.map +1 -0
- package/package.json +140 -0
- package/upgrade-server.sh +205 -0
|
@@ -0,0 +1,1284 @@
|
|
|
1
|
+
import { spawn as spawnPty } from '@scrypted/node-pty';
|
|
2
|
+
import { cyan, green, red, yellow } from 'ansicolor';
|
|
3
|
+
import { ensureDir, move, pathExists, readJSON, readJson, remove, writeJson } from 'fs-extra/esm';
|
|
4
|
+
import { LRUCache } from 'lru-cache';
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
|
+
import { constants, readFile as readFileSync } from 'node:fs';
|
|
7
|
+
import { access, mkdtemp, readFile, rmdir, unlink, writeFile } from 'node:fs/promises';
|
|
8
|
+
import { platform, tmpdir, userInfo } from 'node:os';
|
|
9
|
+
import { basename, dirname, join } from 'node:path';
|
|
10
|
+
import { gt, parse as parseVersion, satisfies } from 'semver';
|
|
11
|
+
import sharp from 'sharp';
|
|
12
|
+
import { x as extract } from 'tar';
|
|
13
|
+
import { container } from 'tsyringe';
|
|
14
|
+
import { PluginManager } from '../../plugins/index.js';
|
|
15
|
+
import { ConfigService } from '../../services/config/index.js';
|
|
16
|
+
import { getNpmPath } from '../../utils/npm.js';
|
|
17
|
+
import { orderBy, sleep } from '../../utils/utils.js';
|
|
18
|
+
import { CamerasService } from '../services/cameras.service.js';
|
|
19
|
+
import { PluginsService } from '../services/plugins.service.js';
|
|
20
|
+
import fetchInstance from '../utils/fetch.js';
|
|
21
|
+
const npmPluginCache = new LRUCache({ ttl: 300, max: 100, allowStale: false });
|
|
22
|
+
const searchResultBlacklist = new Set(['camera.ui', 'homebridge-camera-ui']);
|
|
23
|
+
const pluginLogoCache = new LRUCache({ max: 100, ttl: 1000 * 60 * 60 * 24 });
|
|
24
|
+
export class PluginsController {
|
|
25
|
+
app;
|
|
26
|
+
logger;
|
|
27
|
+
configService;
|
|
28
|
+
io;
|
|
29
|
+
pluginManager;
|
|
30
|
+
proxyServer;
|
|
31
|
+
service;
|
|
32
|
+
camerasService;
|
|
33
|
+
socketService;
|
|
34
|
+
constructor(app) {
|
|
35
|
+
this.app = app;
|
|
36
|
+
this.io = app.io;
|
|
37
|
+
this.service = new PluginsService();
|
|
38
|
+
this.camerasService = new CamerasService();
|
|
39
|
+
this.logger = container.resolve('logger');
|
|
40
|
+
this.configService = container.resolve('configService');
|
|
41
|
+
this.pluginManager = container.resolve('pluginManager');
|
|
42
|
+
this.proxyServer = container.resolve('proxy');
|
|
43
|
+
this.socketService = container.resolve('socketService');
|
|
44
|
+
}
|
|
45
|
+
async enableByName(req, reply) {
|
|
46
|
+
try {
|
|
47
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
48
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
49
|
+
if (!plugin) {
|
|
50
|
+
return reply.code(404).send({
|
|
51
|
+
statusCode: 404,
|
|
52
|
+
message: 'Plugin not exists',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!plugin.disabled) {
|
|
56
|
+
return reply.code(400).send({
|
|
57
|
+
statusCode: 404,
|
|
58
|
+
message: 'Plugin already enabled',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
plugin.disabled = false;
|
|
62
|
+
if (this.configService.config.plugins.disabledPlugins.includes(pluginName)) {
|
|
63
|
+
const index = this.configService.config.plugins.disabledPlugins.indexOf(pluginName);
|
|
64
|
+
this.configService.config.plugins.disabledPlugins.splice(index, 1);
|
|
65
|
+
this.configService.writeConfig();
|
|
66
|
+
}
|
|
67
|
+
await this.pluginManager.startPluginChild(pluginName);
|
|
68
|
+
return reply.code(204).send();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return reply.code(500).send({
|
|
72
|
+
statusCode: 500,
|
|
73
|
+
message: error.message,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async disableByName(req, reply) {
|
|
78
|
+
try {
|
|
79
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
80
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
81
|
+
if (!plugin) {
|
|
82
|
+
return reply.code(404).send({
|
|
83
|
+
statusCode: 404,
|
|
84
|
+
message: 'Plugin not exists',
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (plugin.disabled) {
|
|
88
|
+
return reply.code(400).send({
|
|
89
|
+
statusCode: 404,
|
|
90
|
+
message: 'Plugin already disabled',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
plugin.disabled = true;
|
|
94
|
+
this.configService.config.plugins.disabledPlugins.push(pluginName);
|
|
95
|
+
this.configService.writeConfig();
|
|
96
|
+
await this.pluginManager.stopPluginChild(pluginName);
|
|
97
|
+
return reply.code(204).send();
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return reply.code(500).send({
|
|
101
|
+
statusCode: 500,
|
|
102
|
+
message: error.message,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
getByName(req, reply) {
|
|
107
|
+
try {
|
|
108
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
109
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
110
|
+
if (!plugin) {
|
|
111
|
+
return reply.code(404).send({
|
|
112
|
+
statusCode: 404,
|
|
113
|
+
message: 'Plugin not exists',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return reply.code(200).send(plugin.info);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
return reply.code(500).send({
|
|
120
|
+
statusCode: 500,
|
|
121
|
+
message: error.message,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async getPluginUpdateByName(req, reply) {
|
|
126
|
+
try {
|
|
127
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
128
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
129
|
+
if (!plugin) {
|
|
130
|
+
return reply.code(404).send({
|
|
131
|
+
statusCode: 404,
|
|
132
|
+
message: 'Plugin not exists',
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const pluginUpdateState = await this.getPluginFromNpm(plugin.info);
|
|
136
|
+
return reply.code(200).send(pluginUpdateState);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
return reply.code(500).send({
|
|
140
|
+
statusCode: 500,
|
|
141
|
+
message: error.message,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async getVersionsByName(req, reply) {
|
|
146
|
+
try {
|
|
147
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
148
|
+
const availableVersions = await this.getAvailablePluginVersions(pluginName);
|
|
149
|
+
return reply.code(200).send(availableVersions);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
return reply.code(500).send({
|
|
153
|
+
statusCode: 500,
|
|
154
|
+
message: error.message,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async getChangelogByName(req, reply) {
|
|
159
|
+
try {
|
|
160
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
161
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
162
|
+
if (!plugin) {
|
|
163
|
+
return reply.code(404).send({
|
|
164
|
+
statusCode: 404,
|
|
165
|
+
message: 'Plugin not exists',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
const changelog = join(plugin.installPath, 'CHANGELOG.md');
|
|
170
|
+
if (await pathExists(changelog)) {
|
|
171
|
+
const file = await readFile(`${plugin.installPath}/CHANGELOG.md`, 'utf8');
|
|
172
|
+
reply.header('Content-Type', 'text/plain');
|
|
173
|
+
return reply.code(200).send(file);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
//
|
|
178
|
+
}
|
|
179
|
+
const version = plugin.info.installedVersion || 'latest';
|
|
180
|
+
const response = await fetchInstance(`https://unpkg.com/${plugin.pluginName}@${version}/CHANGELOG.md`, {
|
|
181
|
+
method: 'GET',
|
|
182
|
+
});
|
|
183
|
+
const data = await response.text();
|
|
184
|
+
return reply.code(200).send(data);
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
return reply.code(500).send({
|
|
188
|
+
statusCode: 500,
|
|
189
|
+
message: error.message,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async getConfigJsonByName(req, reply) {
|
|
194
|
+
try {
|
|
195
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
196
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
197
|
+
const configFile = plugin?.configFile;
|
|
198
|
+
if (!plugin || !configFile) {
|
|
199
|
+
return reply.code(404).send({
|
|
200
|
+
statusCode: 404,
|
|
201
|
+
message: 'Plugin or Plugin Config not exists',
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
const config = (await readJSON(configFile, { throws: false })) || {};
|
|
205
|
+
reply.header('Content-Type', 'application/json');
|
|
206
|
+
return reply.code(200).send(config);
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
return reply.code(500).send({
|
|
210
|
+
statusCode: 500,
|
|
211
|
+
message: error.message,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async getPluginLogoByName(req, reply) {
|
|
216
|
+
try {
|
|
217
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
218
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
219
|
+
if (!plugin) {
|
|
220
|
+
return reply.code(200).send(Buffer.from('').toString('base64'));
|
|
221
|
+
}
|
|
222
|
+
const logoPath = join(plugin.installPath, 'logo.png');
|
|
223
|
+
if (!(await pathExists(logoPath))) {
|
|
224
|
+
return reply.code(200).send(Buffer.from('').toString('base64'));
|
|
225
|
+
}
|
|
226
|
+
let base64Logo;
|
|
227
|
+
if (pluginLogoCache.has(pluginName)) {
|
|
228
|
+
base64Logo = pluginLogoCache.get(pluginName);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
const logo = await sharp(logoPath).resize({ width: 100, height: 100, fit: 'cover', kernel: 'nearest' }).toBuffer();
|
|
232
|
+
base64Logo = Buffer.from(logo).toString('base64');
|
|
233
|
+
pluginLogoCache.set(pluginName, base64Logo);
|
|
234
|
+
}
|
|
235
|
+
reply.header('Content-Type', 'image/png');
|
|
236
|
+
return reply.code(200).send(base64Logo);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
return reply.code(500).send({
|
|
240
|
+
statusCode: 500,
|
|
241
|
+
message: error.message,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async getPluginSchemaByName(req, reply) {
|
|
246
|
+
try {
|
|
247
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
248
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
249
|
+
if (!plugin) {
|
|
250
|
+
return reply.code(404).send({
|
|
251
|
+
statusCode: 404,
|
|
252
|
+
message: 'Plugin not exists',
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
const schemaPath = join(plugin.installPath, 'config.schema.json');
|
|
256
|
+
if (!(await pathExists(schemaPath))) {
|
|
257
|
+
return reply.code(200).send();
|
|
258
|
+
}
|
|
259
|
+
const schemaJson = await readJson(schemaPath, { throws: false });
|
|
260
|
+
reply.header('Content-Type', 'application/json');
|
|
261
|
+
return reply.code(200).send(schemaJson);
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
return reply.code(500).send({
|
|
265
|
+
statusCode: 500,
|
|
266
|
+
message: error.message,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
async getPluginInterface(req, reply) {
|
|
271
|
+
try {
|
|
272
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
273
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
274
|
+
if (!plugin) {
|
|
275
|
+
return reply.code(404).send({
|
|
276
|
+
statusCode: 404,
|
|
277
|
+
message: 'Plugin not exists',
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
const { type } = req.query.type;
|
|
281
|
+
const schemaJson = await this.proxyServer.requestPluginFn(type, plugin.id, 'interfaceSchema', []);
|
|
282
|
+
reply.header('Content-Type', 'application/json');
|
|
283
|
+
return reply.code(200).send(schemaJson);
|
|
284
|
+
}
|
|
285
|
+
catch (error) {
|
|
286
|
+
return reply.code(500).send({
|
|
287
|
+
statusCode: 500,
|
|
288
|
+
message: error.message,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
async detectObjects(req, reply) {
|
|
293
|
+
try {
|
|
294
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
295
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
296
|
+
if (!plugin) {
|
|
297
|
+
return reply.code(404).send({
|
|
298
|
+
statusCode: 404,
|
|
299
|
+
message: 'Plugin not exists',
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
if (!req.isMultipart()) {
|
|
303
|
+
throw new Error('No multipart request!');
|
|
304
|
+
}
|
|
305
|
+
const file = req.body.upload;
|
|
306
|
+
const tempDir = await mkdtemp(join(tmpdir(), 'cameraui-object-detection-'));
|
|
307
|
+
const fileName = file.filename;
|
|
308
|
+
const tempFilePath = join(tempDir, fileName);
|
|
309
|
+
const fileBuffer = await file.toBuffer();
|
|
310
|
+
await writeFile(tempFilePath, fileBuffer);
|
|
311
|
+
const response = await this.proxyServer.requestPluginFn('objectDetection', plugin.id, 'detectObjects', [tempFilePath, req.body.metadata, req.body.config], 15000);
|
|
312
|
+
try {
|
|
313
|
+
const promises = [];
|
|
314
|
+
if (tempFilePath) {
|
|
315
|
+
promises.push(unlink(tempFilePath));
|
|
316
|
+
}
|
|
317
|
+
if (tempDir) {
|
|
318
|
+
promises.push(rmdir(tempDir));
|
|
319
|
+
}
|
|
320
|
+
await Promise.allSettled(promises);
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
//
|
|
324
|
+
}
|
|
325
|
+
return reply.code(201).send(response.detections);
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
return reply.code(500).send({
|
|
329
|
+
statusCode: 500,
|
|
330
|
+
message: error.message,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
async detectAudio(req, reply) {
|
|
335
|
+
try {
|
|
336
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
337
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
338
|
+
if (!plugin) {
|
|
339
|
+
return reply.code(404).send({
|
|
340
|
+
statusCode: 404,
|
|
341
|
+
message: 'Plugin not exists',
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
if (!req.isMultipart()) {
|
|
345
|
+
throw new Error('No multipart request!');
|
|
346
|
+
}
|
|
347
|
+
const file = req.body.upload;
|
|
348
|
+
const tempDir = await mkdtemp(join(tmpdir(), 'cameraui-audio-detection-'));
|
|
349
|
+
const fileName = file.filename;
|
|
350
|
+
const tempFilePath = join(tempDir, fileName);
|
|
351
|
+
const fileBuffer = await file.toBuffer();
|
|
352
|
+
await writeFile(tempFilePath, fileBuffer);
|
|
353
|
+
const response = await this.proxyServer.requestPluginFn('audioDetection', plugin.id, 'detectAudio', [tempFilePath, req.body.metadata, req.body.config], 15000);
|
|
354
|
+
try {
|
|
355
|
+
const promises = [];
|
|
356
|
+
if (tempFilePath) {
|
|
357
|
+
promises.push(unlink(tempFilePath));
|
|
358
|
+
}
|
|
359
|
+
if (tempDir) {
|
|
360
|
+
promises.push(rmdir(tempDir));
|
|
361
|
+
}
|
|
362
|
+
await Promise.allSettled(promises);
|
|
363
|
+
}
|
|
364
|
+
catch {
|
|
365
|
+
//
|
|
366
|
+
}
|
|
367
|
+
return reply.code(201).send(response.detected);
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
return reply.code(500).send({
|
|
371
|
+
statusCode: 500,
|
|
372
|
+
message: error.message,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
async detectMotion(req, reply) {
|
|
377
|
+
try {
|
|
378
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
379
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
380
|
+
if (!plugin) {
|
|
381
|
+
return reply.code(404).send({
|
|
382
|
+
statusCode: 404,
|
|
383
|
+
message: 'Plugin not exists',
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
if (!req.isMultipart()) {
|
|
387
|
+
throw new Error('No multipart request!');
|
|
388
|
+
}
|
|
389
|
+
const file = req.body.upload;
|
|
390
|
+
const tempDir = await mkdtemp(join(tmpdir(), 'cameraui-motion-detection-'));
|
|
391
|
+
const fileName = file.filename;
|
|
392
|
+
const tempFilePath = join(tempDir, fileName);
|
|
393
|
+
const fileBuffer = await file.toBuffer();
|
|
394
|
+
await writeFile(tempFilePath, fileBuffer);
|
|
395
|
+
const response = await this.proxyServer.requestPluginFn('motionDetection', plugin.id, 'detectMotion', [tempFilePath, req.body.config], 60 * 1000);
|
|
396
|
+
readFileSync(response.filePath, async (error, fileBuffer) => {
|
|
397
|
+
if (error) {
|
|
398
|
+
this.logger.error(error);
|
|
399
|
+
}
|
|
400
|
+
try {
|
|
401
|
+
const promises = [];
|
|
402
|
+
if (tempFilePath) {
|
|
403
|
+
promises.push(unlink(tempFilePath));
|
|
404
|
+
}
|
|
405
|
+
if (response.filePath && response.filePath !== tempFilePath) {
|
|
406
|
+
promises.push(unlink(response.filePath));
|
|
407
|
+
}
|
|
408
|
+
if (tempDir) {
|
|
409
|
+
promises.push(rmdir(tempDir));
|
|
410
|
+
}
|
|
411
|
+
await Promise.allSettled(promises);
|
|
412
|
+
}
|
|
413
|
+
catch {
|
|
414
|
+
//
|
|
415
|
+
}
|
|
416
|
+
reply.send(error || fileBuffer);
|
|
417
|
+
});
|
|
418
|
+
reply.header('Content-Type', 'application/octet-stream');
|
|
419
|
+
reply.header('Content-Disposition', 'attachment; filename=video.mp4');
|
|
420
|
+
return reply;
|
|
421
|
+
}
|
|
422
|
+
catch (error) {
|
|
423
|
+
return reply.code(500).send({
|
|
424
|
+
statusCode: 500,
|
|
425
|
+
message: error.message,
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
async submitActionButtonByName(req, reply) {
|
|
430
|
+
try {
|
|
431
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
432
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
433
|
+
const configFile = plugin?.configFile;
|
|
434
|
+
if (!plugin || !configFile) {
|
|
435
|
+
return reply.code(404).send({
|
|
436
|
+
statusCode: 404,
|
|
437
|
+
message: 'Plugin or Plugin Config not exists',
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
const toastMessage = await this.proxyServer.requestPluginFn('base', plugin.id, 'onFormSubmit', [req.body.actionId, req.body.payload]);
|
|
441
|
+
return reply.code(201).send(toastMessage);
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
return reply.code(500).send({
|
|
445
|
+
statusCode: 500,
|
|
446
|
+
message: error.message,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
getContractByName(req, reply) {
|
|
451
|
+
try {
|
|
452
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
453
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
454
|
+
if (!plugin) {
|
|
455
|
+
return reply.code(404).send({
|
|
456
|
+
statusCode: 404,
|
|
457
|
+
message: 'Plugin not exists',
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
const contract = plugin.contract;
|
|
461
|
+
const camerasList = plugin.contract.extension || plugin.contract.supportAdditionalCameras ? this.camerasService.list() : this.camerasService.listByPluginId(plugin.id);
|
|
462
|
+
const cameras = camerasList?.map((camera) => {
|
|
463
|
+
return {
|
|
464
|
+
name: camera.name,
|
|
465
|
+
extensions: camera.extensions,
|
|
466
|
+
};
|
|
467
|
+
}) || [];
|
|
468
|
+
return reply.code(200).send({ contract, cameras });
|
|
469
|
+
}
|
|
470
|
+
catch (error) {
|
|
471
|
+
return reply.code(500).send({
|
|
472
|
+
statusCode: 500,
|
|
473
|
+
message: error.message,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
async getReadmeByName(req, reply) {
|
|
478
|
+
try {
|
|
479
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
480
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
481
|
+
if (!plugin) {
|
|
482
|
+
return reply.code(404).send({
|
|
483
|
+
statusCode: 404,
|
|
484
|
+
message: 'Plugin not exists',
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
try {
|
|
488
|
+
const readme = join(plugin.installPath, 'CHANGELOG.md');
|
|
489
|
+
if (await pathExists(readme)) {
|
|
490
|
+
const file = await readFile(`${plugin.installPath}/README.md`, 'utf8');
|
|
491
|
+
reply.header('Content-Type', 'text/plain');
|
|
492
|
+
return reply.code(200).send(file);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
catch {
|
|
496
|
+
//
|
|
497
|
+
}
|
|
498
|
+
const version = plugin.info.installedVersion || 'latest';
|
|
499
|
+
const response = await fetchInstance(`https://unpkg.com/${plugin.pluginName}@${version}/README.md`, {
|
|
500
|
+
method: 'GET',
|
|
501
|
+
});
|
|
502
|
+
const data = await response.text();
|
|
503
|
+
return reply.code(200).send(data);
|
|
504
|
+
}
|
|
505
|
+
catch (error) {
|
|
506
|
+
return reply.code(500).send({
|
|
507
|
+
statusCode: 500,
|
|
508
|
+
message: error.message,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
async getReleaseByName(req, reply) {
|
|
513
|
+
try {
|
|
514
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
515
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
516
|
+
if (!plugin) {
|
|
517
|
+
return reply.code(404).send({
|
|
518
|
+
statusCode: 404,
|
|
519
|
+
message: 'Plugin not exists',
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
const repoMatch = plugin.info.links?.homepage?.match(/https:\/\/github.com\/([^/]+)\/([^/#]+)/);
|
|
523
|
+
if (!repoMatch) {
|
|
524
|
+
return reply.code(404).send({
|
|
525
|
+
statusCode: 404,
|
|
526
|
+
message: '"homepage" not exists in package.json or is not a github repo',
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
const response = await fetchInstance(`https://api.github.com/repos/${repoMatch[1]}/${repoMatch[2]}/releases/latest`, {
|
|
530
|
+
method: 'GET',
|
|
531
|
+
});
|
|
532
|
+
const data = await response.json();
|
|
533
|
+
return reply.code(200).send({
|
|
534
|
+
name: data.name,
|
|
535
|
+
changelog: data.body,
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
catch (error) {
|
|
539
|
+
return reply.code(500).send({
|
|
540
|
+
statusCode: 500,
|
|
541
|
+
message: error.message,
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
list(req, reply) {
|
|
546
|
+
try {
|
|
547
|
+
const installedPlugins = this.service.installedPlugins();
|
|
548
|
+
const plugins = installedPlugins.map((plugin) => plugin.info);
|
|
549
|
+
return orderBy(plugins, ['displayName'], ['asc']);
|
|
550
|
+
// return orderBy(plugins, ['disabled', 'displayName'], ['asc', 'asc']);
|
|
551
|
+
}
|
|
552
|
+
catch (error) {
|
|
553
|
+
return reply.code(500).send({
|
|
554
|
+
statusCode: 500,
|
|
555
|
+
message: error.message,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
listExtensions(req, reply) {
|
|
560
|
+
try {
|
|
561
|
+
const installedPlugins = this.service.installedPlugins();
|
|
562
|
+
const allExtensions = installedPlugins
|
|
563
|
+
.filter((plugin) => plugin.contract.extension || plugin.contract.supportAdditionalCameras)
|
|
564
|
+
.map((plugin) => ({
|
|
565
|
+
pluginName: plugin.pluginName,
|
|
566
|
+
displayName: plugin.displayName,
|
|
567
|
+
type: plugin.contract.extension ? [plugin.contract.extension] : plugin.contract.builtIns,
|
|
568
|
+
}));
|
|
569
|
+
return orderBy(allExtensions, ['displayName'], ['asc']);
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
return reply.code(500).send({
|
|
573
|
+
statusCode: 500,
|
|
574
|
+
message: error.message,
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
async patchConfigJsonByName(req, reply) {
|
|
579
|
+
try {
|
|
580
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
581
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
582
|
+
const configFile = plugin?.configFile;
|
|
583
|
+
if (!plugin || !configFile) {
|
|
584
|
+
return reply.code(404).send({
|
|
585
|
+
statusCode: 404,
|
|
586
|
+
message: 'Plugin or Plugin Config not exists',
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
let configData = req.body;
|
|
590
|
+
if (typeof req.body === 'string') {
|
|
591
|
+
try {
|
|
592
|
+
configData = JSON.parse(req.body);
|
|
593
|
+
}
|
|
594
|
+
catch {
|
|
595
|
+
//
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
await writeJson(configFile, configData, { spaces: 2 });
|
|
599
|
+
return reply.code(201).send(configData);
|
|
600
|
+
}
|
|
601
|
+
catch (error) {
|
|
602
|
+
return reply.code(500).send({
|
|
603
|
+
statusCode: 500,
|
|
604
|
+
message: error.message,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
async restartByName(req, reply) {
|
|
609
|
+
try {
|
|
610
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
611
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
612
|
+
if (!plugin) {
|
|
613
|
+
return reply.code(404).send({
|
|
614
|
+
statusCode: 404,
|
|
615
|
+
message: 'Plugin not exists',
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
const pluginProcess = this.service.getPluginProcessByName(pluginName);
|
|
619
|
+
if (!pluginProcess) {
|
|
620
|
+
return reply.code(404).send({
|
|
621
|
+
statusCode: 404,
|
|
622
|
+
message: 'Plugin process not initialized',
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
await pluginProcess.restart();
|
|
626
|
+
return reply.code(204).send();
|
|
627
|
+
}
|
|
628
|
+
catch (error) {
|
|
629
|
+
return reply.code(500).send({
|
|
630
|
+
statusCode: 500,
|
|
631
|
+
message: error.message,
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
async search(req, reply) {
|
|
636
|
+
try {
|
|
637
|
+
const query = req.query.pluginname || '';
|
|
638
|
+
const q = (!query || !query.length ? '' : query + '+') + 'keywords:camera-ui-plugin+not:deprecated&size=30';
|
|
639
|
+
let searchResults;
|
|
640
|
+
try {
|
|
641
|
+
const response = await fetchInstance(`https://registry.npmjs.org/-/v1/search?text=${q}`, {
|
|
642
|
+
method: 'GET',
|
|
643
|
+
});
|
|
644
|
+
searchResults = await response.json();
|
|
645
|
+
}
|
|
646
|
+
catch (error) {
|
|
647
|
+
throw new Error(`Failed to search the npm registry - "${error.message}"`);
|
|
648
|
+
}
|
|
649
|
+
const result = searchResults.objects
|
|
650
|
+
.filter((x) => x.package.name.indexOf('camera-ui-') === 0 || this.isScopedPlugin(x.package.name))
|
|
651
|
+
.filter((x) => !searchResultBlacklist.has(x.package.name))
|
|
652
|
+
.map((pkg) => {
|
|
653
|
+
let plugin = {
|
|
654
|
+
id: '0',
|
|
655
|
+
pluginName: pkg.package.name,
|
|
656
|
+
displayName: PluginManager.transformDisplaName(pkg.package.name),
|
|
657
|
+
private: false,
|
|
658
|
+
isPython: false,
|
|
659
|
+
isNode: true,
|
|
660
|
+
};
|
|
661
|
+
const installedPlugins = this.service.installedPlugins();
|
|
662
|
+
const isInstalled = installedPlugins.find((installedPlugin) => installedPlugin.pluginName === plugin.pluginName);
|
|
663
|
+
if (isInstalled) {
|
|
664
|
+
plugin = isInstalled.info;
|
|
665
|
+
plugin.lastUpdated = pkg.package.date;
|
|
666
|
+
return plugin;
|
|
667
|
+
}
|
|
668
|
+
plugin.publicPackage = true;
|
|
669
|
+
plugin.installedVersion = undefined;
|
|
670
|
+
plugin.latestVersion = pkg.package.version;
|
|
671
|
+
plugin.lastUpdated = pkg.package.date;
|
|
672
|
+
plugin.description = pkg.package.description ? pkg.package.description.replace(/(?:https?|ftp):\/\/[\n\S]+/g, '').trim() : pkg.package.name;
|
|
673
|
+
plugin.links = pkg.package.links;
|
|
674
|
+
plugin.author = pkg.package.publisher ? pkg.package.publisher.username : undefined;
|
|
675
|
+
return plugin;
|
|
676
|
+
});
|
|
677
|
+
if (!result.length && (query.indexOf('camera-ui-') === 0 || this.isScopedPlugin(query)) && !searchResultBlacklist.has(query.toLowerCase())) {
|
|
678
|
+
const singlePluginQuey = await this.searchNpmRegistrySingle(query.toLowerCase());
|
|
679
|
+
return singlePluginQuey;
|
|
680
|
+
}
|
|
681
|
+
return orderBy(result, ['displayName'], ['asc']);
|
|
682
|
+
}
|
|
683
|
+
catch (error) {
|
|
684
|
+
return reply.code(500).send({
|
|
685
|
+
statusCode: 500,
|
|
686
|
+
message: error.message,
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
async startByName(req, reply) {
|
|
691
|
+
try {
|
|
692
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
693
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
694
|
+
if (!plugin) {
|
|
695
|
+
return reply.code(404).send({
|
|
696
|
+
statusCode: 404,
|
|
697
|
+
message: 'Plugin not exists',
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
const pluginProcess = this.service.getPluginProcessByName(pluginName);
|
|
701
|
+
if (!pluginProcess) {
|
|
702
|
+
return reply.code(404).send({
|
|
703
|
+
statusCode: 404,
|
|
704
|
+
message: 'Plugin process not initialized',
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
await pluginProcess.start();
|
|
708
|
+
return reply.code(204).send();
|
|
709
|
+
}
|
|
710
|
+
catch (error) {
|
|
711
|
+
return reply.code(500).send({
|
|
712
|
+
statusCode: 500,
|
|
713
|
+
message: error.message,
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
async stopByName(req, reply) {
|
|
718
|
+
try {
|
|
719
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
720
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
721
|
+
if (!plugin) {
|
|
722
|
+
return reply.code(404).send({
|
|
723
|
+
statusCode: 404,
|
|
724
|
+
message: 'Plugin not exists',
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
const pluginProcess = this.service.getPluginProcessByName(pluginName);
|
|
728
|
+
if (!pluginProcess) {
|
|
729
|
+
return reply.code(404).send({
|
|
730
|
+
statusCode: 404,
|
|
731
|
+
message: 'Plugin process not initialized',
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
await pluginProcess.teardown();
|
|
735
|
+
return reply.code(204).send();
|
|
736
|
+
}
|
|
737
|
+
catch (error) {
|
|
738
|
+
return reply.code(500).send({
|
|
739
|
+
statusCode: 500,
|
|
740
|
+
message: error.message,
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
async installOrUpdate(req, reply) {
|
|
745
|
+
try {
|
|
746
|
+
let plugin = this.pluginManager.plugins.get(req.body.pluginname);
|
|
747
|
+
const command = plugin ? 'update' : 'install';
|
|
748
|
+
this.logger.log(`${plugin ? 'Updating' : 'Installing'} plugin: ${req.body.pluginname}@${req.body.pluginversion}`);
|
|
749
|
+
const installPath = await this.manage(req.body.pluginname, command, req.body.pluginversion, plugin?.id);
|
|
750
|
+
if (!plugin) {
|
|
751
|
+
plugin = await this.pluginManager.loadPlugin(installPath);
|
|
752
|
+
this.logger.log(`Plugin installed: ${plugin.pluginName}.${plugin.displayName} (${plugin.info.installedVersion})`);
|
|
753
|
+
this.pluginManager.initializeInstalledPlugin(plugin);
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
this.logger.log(`Plugin updated: ${plugin.pluginName}.${plugin.displayName} (${req.body.pluginversion}), restarting ...`);
|
|
757
|
+
const pluginProcess = this.service.getPluginProcessByName(req.body.pluginname);
|
|
758
|
+
pluginProcess?.restart();
|
|
759
|
+
}
|
|
760
|
+
npmPluginCache.delete(plugin.pluginName);
|
|
761
|
+
plugin.reparsePackageJson();
|
|
762
|
+
const serverNsp = this.socketService.namespaces.get('/server');
|
|
763
|
+
serverNsp.checkUpdate();
|
|
764
|
+
return reply.code(201).send(plugin.info);
|
|
765
|
+
}
|
|
766
|
+
catch (error) {
|
|
767
|
+
return reply.code(500).send({
|
|
768
|
+
statusCode: 500,
|
|
769
|
+
message: error.message,
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
async updateServer(req, reply) {
|
|
774
|
+
try {
|
|
775
|
+
this.logger.log(`Updating server: ${ConfigService.APP_NAME}@${req.body.pluginversion}`);
|
|
776
|
+
const installPath = await this.manage(ConfigService.APP_NAME, 'installServer', req.body.pluginversion);
|
|
777
|
+
this.logger.log(`Server updated: ${ConfigService.APP_NAME}@${ConfigService.VERSION} (${installPath})`);
|
|
778
|
+
const serverNsp = this.socketService.namespaces.get('/server');
|
|
779
|
+
serverNsp.checkUpdate();
|
|
780
|
+
return reply.code(204).send();
|
|
781
|
+
}
|
|
782
|
+
catch (error) {
|
|
783
|
+
return reply.code(500).send({
|
|
784
|
+
statusCode: 500,
|
|
785
|
+
message: error.message,
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
async uninstallByName(req, reply) {
|
|
790
|
+
try {
|
|
791
|
+
const pluginName = this.resolvePluginName(req.params);
|
|
792
|
+
const plugin = this.service.getPluginByName(pluginName);
|
|
793
|
+
if (!plugin) {
|
|
794
|
+
return reply.code(404).send({
|
|
795
|
+
statusCode: 404,
|
|
796
|
+
message: 'Plugin not exists',
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
this.logger.log(`Uninstalling plugin: ${plugin.pluginName}.${plugin.displayName} (${plugin.info.installedVersion})`);
|
|
800
|
+
await this.manage(plugin.pluginName, 'uninstall', undefined, plugin.id);
|
|
801
|
+
await this.pluginManager.removePlugin(plugin, req.query.removeStorage);
|
|
802
|
+
npmPluginCache.delete(plugin.pluginName);
|
|
803
|
+
npmPluginCache.delete(`lookup-${plugin.pluginName}`);
|
|
804
|
+
this.logger.log(`Plugin uninstalled: ${plugin.pluginName}.${plugin.displayName} (${plugin.info.installedVersion})`);
|
|
805
|
+
return reply.code(204).send();
|
|
806
|
+
}
|
|
807
|
+
catch (error) {
|
|
808
|
+
return reply.code(500).send({
|
|
809
|
+
statusCode: 500,
|
|
810
|
+
message: error.message,
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
async uninstallAll(req, reply) {
|
|
815
|
+
try {
|
|
816
|
+
this.logger.log('Uninstalling all plugins');
|
|
817
|
+
const plugins = this.service.installedPlugins();
|
|
818
|
+
const pluginNames = plugins.map((plugin) => plugin.pluginName);
|
|
819
|
+
await Promise.all(plugins.map((plugin) => this.manage(plugin.pluginName, 'uninstall', undefined, plugin.id)));
|
|
820
|
+
for (const plugin of plugins) {
|
|
821
|
+
await this.pluginManager.removePlugin(plugin, req.query.removeStorage);
|
|
822
|
+
}
|
|
823
|
+
const pluginsToDelete = [...pluginNames, ...pluginNames.map((pluginName) => `lookup-${pluginName}`)];
|
|
824
|
+
pluginsToDelete.forEach((p) => npmPluginCache.delete(p));
|
|
825
|
+
this.logger.log('All plugins uninstalled');
|
|
826
|
+
return reply.code(204).send();
|
|
827
|
+
}
|
|
828
|
+
catch (error) {
|
|
829
|
+
return reply.code(500).send({
|
|
830
|
+
statusCode: 500,
|
|
831
|
+
message: error.message,
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
async manage(pluginName, action, version, pluginId) {
|
|
836
|
+
if (pluginName === ConfigService.APP_NAME && !ConfigService.INSTALL_PATH) {
|
|
837
|
+
throw new Error(`Can not determine the install path for ${pluginName}`);
|
|
838
|
+
}
|
|
839
|
+
const dir = pluginName === ConfigService.APP_NAME ? ConfigService.INSTALL_PATH : this.configService.PLUGINS_INSTALL_PATH;
|
|
840
|
+
let targetDir;
|
|
841
|
+
if (pluginName === ConfigService.APP_NAME) {
|
|
842
|
+
targetDir = dir;
|
|
843
|
+
}
|
|
844
|
+
else {
|
|
845
|
+
targetDir = join(dir, pluginName);
|
|
846
|
+
}
|
|
847
|
+
this.emitProgress(pluginName, `\n\rUSER: ${userInfo().username}\n\r`, cyan);
|
|
848
|
+
this.emitProgress(pluginName, `DIR: ${targetDir}\n\r`, cyan);
|
|
849
|
+
this.emitProgress(pluginName, `ACTION: ${action}\n\r\n\r`, cyan);
|
|
850
|
+
await this.removeSynologyMetadata();
|
|
851
|
+
switch (action) {
|
|
852
|
+
case 'install':
|
|
853
|
+
await this.installPlugin(pluginName, version || 'latest', targetDir);
|
|
854
|
+
break;
|
|
855
|
+
case 'installServer':
|
|
856
|
+
await this.installServer(pluginName, version || 'latest', targetDir);
|
|
857
|
+
break;
|
|
858
|
+
case 'update':
|
|
859
|
+
await this.updatePlugin(pluginName, version || 'latest', targetDir);
|
|
860
|
+
break;
|
|
861
|
+
case 'uninstall':
|
|
862
|
+
await this.uninstallPlugin(pluginName, targetDir);
|
|
863
|
+
await sleep(2000);
|
|
864
|
+
break;
|
|
865
|
+
default:
|
|
866
|
+
throw new Error(`Unknown action: ${action}`);
|
|
867
|
+
}
|
|
868
|
+
await this.ensurePluginDirExists();
|
|
869
|
+
if (pluginId && action === 'uninstall' && pluginName !== ConfigService.APP_NAME) {
|
|
870
|
+
await this.camerasService.removeByPluginId(pluginId);
|
|
871
|
+
}
|
|
872
|
+
return targetDir;
|
|
873
|
+
}
|
|
874
|
+
async installServer(pluginName, version, targetDir) {
|
|
875
|
+
await this.removeSynologyMetadata();
|
|
876
|
+
const upgradeInstallScriptPath = join(targetDir, 'upgrade-server.sh');
|
|
877
|
+
let timeoutTimer;
|
|
878
|
+
const command = [upgradeInstallScriptPath, version, targetDir];
|
|
879
|
+
try {
|
|
880
|
+
await access(join(targetDir, 'node_modules'), constants.W_OK);
|
|
881
|
+
}
|
|
882
|
+
catch {
|
|
883
|
+
this.emitProgress(pluginName, `The user "${userInfo().username}" does not have write access to the target directory:\n\r\n\r`, yellow);
|
|
884
|
+
this.emitProgress(pluginName, `${join(targetDir, 'node_modules')}\n\r\n\r`);
|
|
885
|
+
this.emitProgress(pluginName, 'This may cause the operation to fail.\n\r\n\r', yellow);
|
|
886
|
+
}
|
|
887
|
+
this.logger.log(`Running Command: ${command.join(' ')}`);
|
|
888
|
+
if (!satisfies(process.version, `>=${ConfigService.MIN_NODE_VERSION}`)) {
|
|
889
|
+
this.emitProgress(pluginName, `Node.js v${ConfigService.MIN_NODE_VERSION} higher is required for ${ConfigService.APP_NAME}.\n\r`, yellow);
|
|
890
|
+
this.emitProgress(pluginName, `You may experience issues while running on Node.js ${process.version}.\n\r\n\r`, yellow);
|
|
891
|
+
}
|
|
892
|
+
// set up the environment for the call
|
|
893
|
+
const env = {};
|
|
894
|
+
Object.assign(env, process.env);
|
|
895
|
+
Object.assign(env, {
|
|
896
|
+
// npm_config_install_strategy: 'shallow',
|
|
897
|
+
npm_config_unsafe_perm: 'true',
|
|
898
|
+
npm_config_update_notifier: 'false',
|
|
899
|
+
npm_config_prefer_online: 'true',
|
|
900
|
+
npm_config_foreground_scripts: 'true',
|
|
901
|
+
npm_config_loglevel: 'info',
|
|
902
|
+
npm_config_prefix: targetDir,
|
|
903
|
+
});
|
|
904
|
+
// set global prefix for unix based systems
|
|
905
|
+
if (platform() !== 'win32') {
|
|
906
|
+
if (basename(targetDir) === 'lib') {
|
|
907
|
+
Object.assign(env, {
|
|
908
|
+
npm_config_prefix: dirname(targetDir),
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
await new Promise((_resolve, _reject) => {
|
|
913
|
+
const term = spawnPty(command.shift(), command, {
|
|
914
|
+
name: 'xterm-color',
|
|
915
|
+
cols: 80,
|
|
916
|
+
rows: 30,
|
|
917
|
+
cwd: targetDir,
|
|
918
|
+
env,
|
|
919
|
+
});
|
|
920
|
+
// send stdout data from the process to all clients
|
|
921
|
+
term.onData((data) => {
|
|
922
|
+
this.emitProgress(pluginName, data);
|
|
923
|
+
});
|
|
924
|
+
// send an error message to the client if the command does not exit with code 0
|
|
925
|
+
term.onExit((error) => {
|
|
926
|
+
clearTimeout(timeoutTimer);
|
|
927
|
+
if (error.exitCode === 0) {
|
|
928
|
+
this.emitProgress(pluginName, `\n\rServer ${pluginName}@${version} has been successfully updated.\n\r\n\r`, green);
|
|
929
|
+
_resolve(null);
|
|
930
|
+
}
|
|
931
|
+
else {
|
|
932
|
+
this.emitProgress(pluginName, `\n\rError during update of ${pluginName}@${version}.\n\r\n\r`, red);
|
|
933
|
+
_reject(new Error('Operation failed. Please review log for details.'));
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
// if the command spends to long trying to execute kill it after 5 minutes
|
|
937
|
+
timeoutTimer = setTimeout(() => {
|
|
938
|
+
term.kill('SIGTERM');
|
|
939
|
+
}, 300000);
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
async installPlugin(pluginName, version, targetDir, update) {
|
|
943
|
+
try {
|
|
944
|
+
const npmRegistry = 'https://registry.npmjs.org';
|
|
945
|
+
const packageUrl = `${npmRegistry}/${pluginName}/${version}`;
|
|
946
|
+
this.emitProgress(pluginName, '> Fetching package information...');
|
|
947
|
+
const response = await fetch(packageUrl);
|
|
948
|
+
if (!response.ok) {
|
|
949
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
950
|
+
}
|
|
951
|
+
const packageInfo = await response.json();
|
|
952
|
+
const tarballUrl = packageInfo.dist.tarball;
|
|
953
|
+
const expectedShasum = packageInfo.dist.shasum;
|
|
954
|
+
this.emitProgress(pluginName, ' Done\n\r\n\r', green);
|
|
955
|
+
const tarballData = await this.downloadWithProgress(tarballUrl, pluginName, version);
|
|
956
|
+
this.emitProgress(pluginName, ' - Done\n\r\n\r', green);
|
|
957
|
+
this.emitProgress(pluginName, '> Verifying package integrity...');
|
|
958
|
+
const computedShasum = createHash('sha1').update(Buffer.from(tarballData)).digest('hex');
|
|
959
|
+
if (computedShasum !== expectedShasum) {
|
|
960
|
+
throw new Error(`SHA checksum mismatch. Expected: ${expectedShasum}, Got: ${computedShasum}`);
|
|
961
|
+
}
|
|
962
|
+
this.emitProgress(pluginName, ' Done\n\r\n\r', green);
|
|
963
|
+
await ensureDir(targetDir);
|
|
964
|
+
this.emitProgress(pluginName, '> Extracting package...');
|
|
965
|
+
await new Promise((_resolve, _reject) => {
|
|
966
|
+
const extractStream = extract({
|
|
967
|
+
cwd: targetDir,
|
|
968
|
+
strip: 1,
|
|
969
|
+
});
|
|
970
|
+
extractStream.on('error', _reject);
|
|
971
|
+
extractStream.on('end', () => {
|
|
972
|
+
this.emitProgress(pluginName, ' Done\n\r\n\r', green);
|
|
973
|
+
_resolve();
|
|
974
|
+
});
|
|
975
|
+
extractStream.write(Buffer.from(tarballData));
|
|
976
|
+
extractStream.end();
|
|
977
|
+
});
|
|
978
|
+
await this.installProductionDependencies(targetDir, pluginName);
|
|
979
|
+
this.emitProgress(pluginName, `\n\rPlugin ${pluginName}@${version} has been successfully ${update ? 'updated' : 'installed'}.\n\r\n\r`, green);
|
|
980
|
+
}
|
|
981
|
+
catch (error) {
|
|
982
|
+
this.emitProgress(pluginName, `\n\rError during ${update ? 'update' : 'installation'} of ${pluginName}@${version}.\n\r\n\r`, red);
|
|
983
|
+
throw error;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
async updatePlugin(pluginName, version, targetDir) {
|
|
987
|
+
try {
|
|
988
|
+
this.emitProgress(pluginName, '> Preparing update...');
|
|
989
|
+
const packageJsonPath = join(targetDir, 'package.json');
|
|
990
|
+
const packageJson = await readJson(packageJsonPath);
|
|
991
|
+
const currentVersion = packageJson.version;
|
|
992
|
+
if (currentVersion === version) {
|
|
993
|
+
this.emitProgress(pluginName, ' Break', red);
|
|
994
|
+
this.emitProgress(pluginName, `Plugin ${pluginName} is already up to date\n\r\n\r`, green);
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
const tempNodeModules = join(targetDir, 'node_modules_temp');
|
|
998
|
+
await move(join(targetDir, 'node_modules'), tempNodeModules);
|
|
999
|
+
this.emitProgress(pluginName, ' Done\n\r\n\r', green);
|
|
1000
|
+
let cleaningUp = false;
|
|
1001
|
+
try {
|
|
1002
|
+
await this.installPlugin(pluginName, version, targetDir, true);
|
|
1003
|
+
this.emitProgress(pluginName, '> Cleaning up...');
|
|
1004
|
+
cleaningUp = true;
|
|
1005
|
+
await remove(tempNodeModules);
|
|
1006
|
+
this.emitProgress(pluginName, ' Done\n\r\n\r', green);
|
|
1007
|
+
}
|
|
1008
|
+
catch (error) {
|
|
1009
|
+
if (cleaningUp) {
|
|
1010
|
+
this.emitProgress(pluginName, ' Error\n\r\n\r', red);
|
|
1011
|
+
}
|
|
1012
|
+
this.emitProgress(pluginName, ' Restoring previous version...');
|
|
1013
|
+
await remove(targetDir);
|
|
1014
|
+
await move(tempNodeModules, targetDir);
|
|
1015
|
+
this.emitProgress(pluginName, ' Done\n\r\n\r', green);
|
|
1016
|
+
throw error;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
catch (error) {
|
|
1020
|
+
this.emitProgress(pluginName, `\n\rError during update of ${pluginName}@${version}.\n\r\n\r`, red);
|
|
1021
|
+
throw error;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
async uninstallPlugin(pluginName, targetDir) {
|
|
1025
|
+
try {
|
|
1026
|
+
this.emitProgress(pluginName, '> Fetching plugin information...');
|
|
1027
|
+
const pluginInstalled = await pathExists(targetDir);
|
|
1028
|
+
this.emitProgress(pluginName, ' Done\n\r\n\r', green);
|
|
1029
|
+
if (!pluginInstalled) {
|
|
1030
|
+
this.emitProgress(pluginName, `Plugin ${pluginName} is not installed. Break\n\r\n\r`, red);
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
this.emitProgress(pluginName, '> Uninstalling plugin...');
|
|
1034
|
+
await remove(targetDir);
|
|
1035
|
+
this.emitProgress(pluginName, ' Done\n\r\n\r', green);
|
|
1036
|
+
this.emitProgress(pluginName, `Plugin ${pluginName} has been successfully uninstalled.\n\r`, green);
|
|
1037
|
+
}
|
|
1038
|
+
catch (error) {
|
|
1039
|
+
this.emitProgress(pluginName, ' Error\n\r\n\r', red);
|
|
1040
|
+
this.emitProgress(pluginName, `\n\rError during uninstallation of ${pluginName}.\n\r\n\r`, red);
|
|
1041
|
+
throw error;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
async installProductionDependencies(packageDir, pluginName) {
|
|
1045
|
+
await new Promise((_resolve, _reject) => {
|
|
1046
|
+
this.emitProgress(pluginName, '> Installing dependencies...\n\r\n\r');
|
|
1047
|
+
const command = [...getNpmPath(), 'install', '--omit=dev', '--loglevel', 'info'];
|
|
1048
|
+
const env = {};
|
|
1049
|
+
Object.assign(env, process.env);
|
|
1050
|
+
Object.assign(env, {
|
|
1051
|
+
// npm_config_global_style: 'false',
|
|
1052
|
+
// npm_config_install_strategy: 'shallow',
|
|
1053
|
+
npm_config_unsafe_perm: 'true',
|
|
1054
|
+
npm_config_update_notifier: 'false',
|
|
1055
|
+
npm_config_prefer_online: 'true',
|
|
1056
|
+
npm_config_foreground_scripts: 'true',
|
|
1057
|
+
npm_config_loglevel: 'info',
|
|
1058
|
+
npm_config_prefix: packageDir,
|
|
1059
|
+
});
|
|
1060
|
+
// set global prefix for unix based systems
|
|
1061
|
+
if (platform() !== 'win32') {
|
|
1062
|
+
if (basename(packageDir) === 'lib') {
|
|
1063
|
+
packageDir = dirname(packageDir);
|
|
1064
|
+
Object.assign(env, {
|
|
1065
|
+
npm_config_prefix: packageDir,
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
this.logger.log(`Running Command: ${command.join(' ')}`);
|
|
1070
|
+
const term = spawnPty(command.shift(), command, {
|
|
1071
|
+
name: 'xterm-color',
|
|
1072
|
+
cols: 80,
|
|
1073
|
+
rows: 30,
|
|
1074
|
+
cwd: packageDir,
|
|
1075
|
+
env,
|
|
1076
|
+
});
|
|
1077
|
+
// send stdout data from the process to all clients
|
|
1078
|
+
term.onData((data) => {
|
|
1079
|
+
this.emitProgress(pluginName, data);
|
|
1080
|
+
});
|
|
1081
|
+
// send an error message to the client if the command does not exit with code 0
|
|
1082
|
+
term.onExit((error) => {
|
|
1083
|
+
clearTimeout(timeoutTimer);
|
|
1084
|
+
if (error.exitCode === 0) {
|
|
1085
|
+
_resolve(null);
|
|
1086
|
+
}
|
|
1087
|
+
else {
|
|
1088
|
+
_reject(new Error('Operation failed. Please review log for details.'));
|
|
1089
|
+
}
|
|
1090
|
+
});
|
|
1091
|
+
// if the command spends to long trying to execute kill it after 5 minutes
|
|
1092
|
+
const timeoutTimer = setTimeout(() => {
|
|
1093
|
+
term.kill('SIGTERM');
|
|
1094
|
+
}, 300000);
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
async ensurePluginDirExists() {
|
|
1098
|
+
if (!this.configService.PLUGINS_INSTALL_PATH) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
if (!(await pathExists(this.configService.PLUGINS_INSTALL_PATH))) {
|
|
1102
|
+
this.logger.warn(`Plugin directory was removed. Re-creating: ${this.configService.PLUGINS_INSTALL_PATH}`);
|
|
1103
|
+
try {
|
|
1104
|
+
await ensureDir(this.configService.PLUGINS_INSTALL_PATH);
|
|
1105
|
+
}
|
|
1106
|
+
catch (error) {
|
|
1107
|
+
this.logger.error('Failed to recreate plugin directory', error);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
async getAvailablePluginVersions(pluginName) {
|
|
1112
|
+
const fromCache = npmPluginCache.get(`lookup-${pluginName}`);
|
|
1113
|
+
let pkg = fromCache;
|
|
1114
|
+
if (!pkg) {
|
|
1115
|
+
const response = await fetchInstance(`https://registry.npmjs.org/${encodeURIComponent(pluginName).replace(/%40/g, '@')}`, {
|
|
1116
|
+
method: 'GET',
|
|
1117
|
+
headers: {
|
|
1118
|
+
accept: 'application/vnd.npm.install-v1+json', // only return minimal information
|
|
1119
|
+
},
|
|
1120
|
+
});
|
|
1121
|
+
pkg = (await response.json());
|
|
1122
|
+
}
|
|
1123
|
+
if (!fromCache) {
|
|
1124
|
+
npmPluginCache.set(`lookup-${pluginName}`, pkg, { ttl: 60 * 1000 });
|
|
1125
|
+
}
|
|
1126
|
+
return {
|
|
1127
|
+
tags: pkg['dist-tags'],
|
|
1128
|
+
versions: Object.keys(pkg.versions).reverse(),
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
async getPluginFromNpm(plugin) {
|
|
1132
|
+
const pluginState = {
|
|
1133
|
+
updateAvailable: false,
|
|
1134
|
+
betaUpdateAvailable: false,
|
|
1135
|
+
};
|
|
1136
|
+
try {
|
|
1137
|
+
// attempt to load from cache
|
|
1138
|
+
const fromCache = npmPluginCache.get(plugin.pluginName);
|
|
1139
|
+
let pkg = fromCache;
|
|
1140
|
+
if (!pkg) {
|
|
1141
|
+
const response = await fetchInstance(`https://registry.npmjs.org/${encodeURIComponent(plugin.pluginName).replace(/%40/g, '@')}/latest`, {
|
|
1142
|
+
method: 'GET',
|
|
1143
|
+
});
|
|
1144
|
+
pkg = (await response.json());
|
|
1145
|
+
}
|
|
1146
|
+
pluginState.latestVersion = pkg.version;
|
|
1147
|
+
pluginState.updateAvailable = gt(pkg.version, plugin.installedVersion);
|
|
1148
|
+
// check for beta updates, if no latest version is available
|
|
1149
|
+
if (!pluginState.updateAvailable) {
|
|
1150
|
+
const pluginVersion = parseVersion(plugin.installedVersion);
|
|
1151
|
+
if (pluginVersion?.prerelease[0] === 'beta' && gt(plugin.installedVersion, pluginState.latestVersion || '0.0.1')) {
|
|
1152
|
+
const versions = await this.getAvailablePluginVersions(plugin.pluginName);
|
|
1153
|
+
if (versions.tags.beta && gt(versions.tags.beta, plugin.installedVersion)) {
|
|
1154
|
+
pluginState.betaUpdateAvailable = true;
|
|
1155
|
+
pluginState.latestVersion = versions.tags.beta;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
// store in cache if it was not there already
|
|
1160
|
+
if (!fromCache) {
|
|
1161
|
+
npmPluginCache.set(plugin.pluginName, pkg);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
catch (error) {
|
|
1165
|
+
if (error.response?.status !== 404) {
|
|
1166
|
+
this.logger.error(`[${plugin.pluginName}] Failed to check registry.npmjs.org for updates`, error);
|
|
1167
|
+
}
|
|
1168
|
+
pluginState.latestVersion = undefined;
|
|
1169
|
+
pluginState.updateAvailable = false;
|
|
1170
|
+
pluginState.betaUpdateAvailable = false;
|
|
1171
|
+
}
|
|
1172
|
+
return pluginState;
|
|
1173
|
+
}
|
|
1174
|
+
async removeSynologyMetadata() {
|
|
1175
|
+
if (!this.configService.PLUGINS_INSTALL_PATH) {
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
const offendingPath = join(this.configService.PLUGINS_INSTALL_PATH, '@eaDir');
|
|
1179
|
+
try {
|
|
1180
|
+
if (!(await pathExists(offendingPath))) {
|
|
1181
|
+
await remove(offendingPath);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
catch (error) {
|
|
1185
|
+
this.logger.error(`Failed to remove ${offendingPath}`, error);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
async searchNpmRegistrySingle(query) {
|
|
1189
|
+
try {
|
|
1190
|
+
const fromCache = npmPluginCache.get(`lookup-${query}`);
|
|
1191
|
+
let pkg = fromCache;
|
|
1192
|
+
if (!pkg) {
|
|
1193
|
+
const response = await fetchInstance(`https://registry.npmjs.org/${encodeURIComponent(query).replace(/%40/g, '@')}`, {
|
|
1194
|
+
method: 'GET',
|
|
1195
|
+
});
|
|
1196
|
+
pkg = (await response.json());
|
|
1197
|
+
}
|
|
1198
|
+
if (!fromCache) {
|
|
1199
|
+
npmPluginCache.set(`lookup-${query}`, pkg, { ttl: 60 * 1000 });
|
|
1200
|
+
}
|
|
1201
|
+
if (!pkg.keywords || !pkg.keywords.includes('camera-ui-plugin')) {
|
|
1202
|
+
return [];
|
|
1203
|
+
}
|
|
1204
|
+
let plugin;
|
|
1205
|
+
const installedPlugins = this.service.installedPlugins();
|
|
1206
|
+
const isInstalled = installedPlugins.find((installedPlugin) => installedPlugin.pluginName === pkg.name);
|
|
1207
|
+
if (isInstalled) {
|
|
1208
|
+
plugin = isInstalled.info;
|
|
1209
|
+
plugin.lastUpdated = pkg.time.modified;
|
|
1210
|
+
return [plugin];
|
|
1211
|
+
}
|
|
1212
|
+
plugin = {
|
|
1213
|
+
id: '0',
|
|
1214
|
+
pluginName: pkg.name,
|
|
1215
|
+
private: false,
|
|
1216
|
+
displayName: PluginManager.transformDisplaName(pkg.name),
|
|
1217
|
+
description: pkg.description ? pkg.description.replace(/(?:https?|ftp):\/\/[\n\S]+/g, '').trim() : pkg.name,
|
|
1218
|
+
isPython: false,
|
|
1219
|
+
isNode: true,
|
|
1220
|
+
publicPackage: true,
|
|
1221
|
+
latestVersion: pkg['dist-tags'] ? pkg['dist-tags'].latest : undefined,
|
|
1222
|
+
lastUpdated: pkg.time.modified,
|
|
1223
|
+
links: {
|
|
1224
|
+
npm: `https://www.npmjs.com/package/${pkg.name}`,
|
|
1225
|
+
homepage: pkg.homepage,
|
|
1226
|
+
},
|
|
1227
|
+
author: pkg.maintainers[0]?.name,
|
|
1228
|
+
};
|
|
1229
|
+
return [plugin];
|
|
1230
|
+
}
|
|
1231
|
+
catch (error) {
|
|
1232
|
+
if (error.response?.status !== 404) {
|
|
1233
|
+
this.logger.error('Failed to search the npm registry', error);
|
|
1234
|
+
}
|
|
1235
|
+
return [];
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
resolvePluginName(params) {
|
|
1239
|
+
if (params.scope) {
|
|
1240
|
+
const at = params.scope.startsWith('@') ? '' : '@';
|
|
1241
|
+
return `${at}${params.scope}/${params.pluginname}`;
|
|
1242
|
+
}
|
|
1243
|
+
else {
|
|
1244
|
+
return params.pluginname;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
isScopedPlugin(pluginName) {
|
|
1248
|
+
return pluginName.charAt(0) === '@' && pluginName.split('/').length > 0 && pluginName.split('/')[1]?.indexOf('camera-ui-') === 0;
|
|
1249
|
+
}
|
|
1250
|
+
async downloadWithProgress(url, pluginName, version) {
|
|
1251
|
+
const response = await fetch(url);
|
|
1252
|
+
if (!response.ok) {
|
|
1253
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
1254
|
+
}
|
|
1255
|
+
const contentLength = Number(response.headers.get('Content-Length'));
|
|
1256
|
+
let receivedLength = 0;
|
|
1257
|
+
const chunks = [];
|
|
1258
|
+
const reader = response.body.getReader();
|
|
1259
|
+
this.emitProgress(pluginName, `> Downloading ${pluginName}@${version}...\n\r`);
|
|
1260
|
+
// eslint-disable-next-line no-constant-condition
|
|
1261
|
+
while (true) {
|
|
1262
|
+
const { done, value } = await reader.read();
|
|
1263
|
+
if (done) {
|
|
1264
|
+
break;
|
|
1265
|
+
}
|
|
1266
|
+
chunks.push(value);
|
|
1267
|
+
receivedLength += value.length;
|
|
1268
|
+
const percentComplete = Math.round((receivedLength / contentLength) * 100);
|
|
1269
|
+
const progressBar = this.getProgressBar(percentComplete);
|
|
1270
|
+
this.emitProgress(pluginName, `\r${progressBar} ${percentComplete}%`, cyan);
|
|
1271
|
+
}
|
|
1272
|
+
return await new Blob(chunks).arrayBuffer();
|
|
1273
|
+
}
|
|
1274
|
+
getProgressBar(percent) {
|
|
1275
|
+
const width = 50;
|
|
1276
|
+
const complete = Math.round(width * (percent / 100));
|
|
1277
|
+
const incomplete = width - complete;
|
|
1278
|
+
return `[${'='.repeat(complete)}${'-'.repeat(incomplete)}]`;
|
|
1279
|
+
}
|
|
1280
|
+
emitProgress(pluginName, message, color) {
|
|
1281
|
+
this.io.of('/logs').emit(`stdout/${pluginName}`, color ? color(message) : message);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
//# sourceMappingURL=plugins.controller.js.map
|