cameras: Update to notify recommended rebroadcast plugin

This commit is contained in:
Koushik Dutta
2021-09-24 00:44:26 -07:00
parent 22b4193241
commit 624f91bd7c
20 changed files with 156 additions and 75 deletions

View File

@@ -0,0 +1,30 @@
import sdk from "@scrypted/sdk";
const { systemManager, log } = sdk;
export async function alertRecommendedPlugins(plugins: { [pkg: string]: string }) {
const pluginsComponent = await systemManager.getComponent('plugins');
let recommended: any;
try {
recommended = JSON.parse(localStorage.getItem('alert-recommended'));
}
catch (e) {
recommended = {};
}
for (const plugin of Object.keys(plugins)) {
try {
if (recommended[plugin])
continue;
recommended[plugin] = true;
localStorage.setItem('alert-recommended', JSON.stringify(recommended));
const id = await pluginsComponent.getIdForPluginId(plugin);
if (id)
continue;
const name = plugins[plugin];
log.a(`Installation of the ${name} plugin is also recommended. origin:/#/component/plugin/install/${plugin}`)
}
catch (e) {
}
}
}

View File

@@ -1,4 +1,4 @@
import { MixinProvider, ScryptedDevice, ScryptedDeviceBase, ScryptedDeviceType, ScryptedInterface } from "@scrypted/sdk";
import { ScryptedDevice, ScryptedDeviceBase, ScryptedDeviceType, ScryptedInterface } from "@scrypted/sdk";
import sdk from "@scrypted/sdk";
const { systemManager } = sdk;

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/amcrest",
"version": "0.0.35",
"version": "0.0.36",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/amcrest",
"version": "0.0.35",
"version": "0.0.36",
"license": "Apache",
"dependencies": {
"@koush/axios-digest-auth": "^0.7.2",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/amcrest",
"version": "0.0.35",
"version": "0.0.36",
"description": "Amcrest Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/core",
"version": "0.0.96",
"version": "0.0.97",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/core",
"version": "0.0.96",
"version": "0.0.97",
"license": "Apache-2.0",
"dependencies": {
"@scrypted/sdk": "file:../../sdk",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/core",
"version": "0.0.96",
"version": "0.0.97",
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
"author": "Scrypted",
"license": "Apache-2.0",

View File

@@ -1,21 +1,38 @@
<template>
<v-layout wrap>
<!-- <v-flex xs12 v-if="deviceComponent && deviceComponent === 'Script'">
<component
@save="saveStorage"
:is="deviceComponent"
v-model="deviceData"
:id="id"
ref="componentCard"
></component>
</v-flex> -->
<v-flex xs12>
<div v-if="deviceAlerts.length" class="pb-5">
<v-alert
dismissible
@input="removeAlert(alert)"
v-for="alert in deviceAlerts"
:key="alert.id"
xs12
md6
lg6
outlined
text
color="primary"
icon="mdi-vuetify"
border="left"
>
<template v-slot:prepend>
<v-icon class="white--text mr-3" size="sm" color="#a9afbb">{{
getAlertIcon(alert)
}}</v-icon>
</template>
<div class="caption">{{ alert.title }}</div>
<div
v-linkified:options="{ className: 'alert-link' }"
v-html="alert.message.replace('origin:', origin)"
style="color: white"
></div>
</v-alert>
</div>
</v-flex>
<v-flex v-for="iface in noCardAboveInterfaces" :key="iface">
<component
:value="deviceState"
:device="device"
:is="iface"
></component>
<component :value="deviceState" :device="device" :is="iface"></component>
</v-flex>
<v-flex xs12 v-if="showConsole" ref="consoleEl">
@@ -28,34 +45,6 @@
<v-flex xs12 md6 v-if="name != null">
<v-layout row wrap>
<v-flex xs12>
<div v-if="deviceAlerts.length" class="pb-5">
<v-alert
dismissible
@input="removeAlert(alert)"
v-for="alert in deviceAlerts"
:key="alert.id"
xs12
md6
lg6
outlined
text
color="primary"
icon="mdi-vuetify"
border="left"
>
<template v-slot:prepend>
<v-icon class="white--text mr-3" size="sm" color="#a9afbb">{{
getAlertIcon(alert)
}}</v-icon>
</template>
<div class="caption">{{ alert.title }}</div>
<div
v-linkified:options="{ className: 'alert-link' }"
v-html="alert.message"
style="color: white"
></div>
</v-alert>
</div>
<v-card raised>
<v-card-title class="orange-gradient subtitle-1 font-weight-light">
@@ -239,7 +228,10 @@
>
<v-spacer></v-spacer>
<PluginAdvancedUpdate :pluginData="pluginData" @installed="reload" />
<PluginAdvancedUpdate
:pluginData="pluginData"
@installed="reload"
/>
</v-card-actions>
</v-card>
</v-flex>
@@ -442,7 +434,7 @@ import { checkUpdate } from "./plugin/plugin";
import AggregateDevice from "./aggregate/AggregateDevice.vue";
import Automation from "./automation/Automation.vue";
import Script from "./script/Script.vue";
import PluginAdvancedUpdate from './plugin/PluginAdvancedUpdate.vue';
import PluginAdvancedUpdate from "./plugin/PluginAdvancedUpdate.vue";
import Vue from "vue";
import {
getDeviceAvailableMixins,
@@ -690,7 +682,7 @@ export default {
);
this.pluginData = pluginData;
checkUpdate(pluginData.pluginId, pluginData.packageJson.version).then(
result => Object.assign(pluginData, result)
(result) => Object.assign(pluginData, result)
);
const device = this.device;
@@ -769,6 +761,9 @@ export default {
},
},
computed: {
origin() {
return window.location.origin;
},
ownerDevice() {
if (this.device.providerId === this.device.id) return;
return this.$scrypted.systemManager.getDeviceById(this.device.providerId);

View File

@@ -78,7 +78,7 @@ import { installNpm } from "./plugin";
export default {
data: function () {
return {
search: "",
search: this.$route.params.pathMatch || '',
results: [],
};
},

View File

@@ -41,6 +41,10 @@ let router = new VueRouter({
path: "/component/plugin/install",
component: InstallPlugin
},
{
path: "/component/plugin/install/*",
component: InstallPlugin
},
{
path: "/component/aggregate",
component: AggregateComponent

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/hikvision",
"version": "0.0.46",
"version": "0.0.47",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/hikvision",
"version": "0.0.46",
"version": "0.0.47",
"license": "Apache",
"dependencies": {
"@mhoc/axios-digest-auth": "^0.7.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/hikvision",
"version": "0.0.46",
"version": "0.0.47",
"description": "HikVision Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/onvif",
"version": "0.0.5",
"version": "0.0.6",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/onvif",
"version": "0.0.5",
"version": "0.0.6",
"license": "Apache",
"dependencies": {
"@scrypted/sdk": "file:../../sdk",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/onvif",
"version": "0.0.5",
"version": "0.0.6",
"description": "ONVIF Camera Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",

View File

@@ -1,37 +1,54 @@
{
"name": "@scrypted/rtsp",
"version": "0.0.24",
"version": "0.0.25",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/rtsp",
"version": "0.0.24",
"version": "0.0.25",
"license": "Apache",
"dependencies": {
"axios": "^0.18.1",
"url-parse": "^1.4.7"
},
"devDependencies": {
"@scrypted/sdk": "file:../../sdk"
"@scrypted/common": "file:../../common",
"@scrypted/sdk": "file:../../sdk",
"@types/node": "^16.9.6"
}
},
"../../common": {
"version": "1.0.1",
"dev": true,
"license": "ISC",
"dependencies": {
"@scrypted/sdk": "file:../sdk"
},
"devDependencies": {
"@types/node": "^16.9.0"
}
},
"../../sdk": {
"name": "@scrypted/sdk",
"version": "0.0.65",
"version": "0.0.81",
"dev": true,
"license": "ISC",
"dependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
"@babel/plugin-transform-typescript": "^7.15.0",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.2.3",
"@babel/preset-typescript": "^7.15.0",
"@types/node": "^16.6.1",
"adm-zip": "^0.4.13",
"axios": "^0.21.1",
"axios": "^0.21.4",
"babel-loader": "^8.0.4",
"babel-plugin-const-enum": "^1.1.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
"babel-polyfill": "^6.26.0",
"babel-template": "^6.26.0",
"browserify-buffertools": "^1.0.2",
@@ -62,19 +79,26 @@
"scrypted-webpack": "bin/scrypted-webpack.js"
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
"@types/node": "^16.6.1",
"babel-plugin-const-enum": "^1.1.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1"
"typescript-json-schema": "^0.50.1"
}
},
"../sdk": {
"extraneous": true
},
"node_modules/@scrypted/common": {
"resolved": "../../common",
"link": true
},
"node_modules/@scrypted/sdk": {
"resolved": "../../sdk",
"link": true
},
"node_modules/@types/node": {
"version": "16.9.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.6.tgz",
"integrity": "sha512-YHUZhBOMTM3mjFkXVcK+WwAcYmyhe1wL4lfqNtzI0b3qAy7yuSetnM7QJazgE5PFmgVTNGiLOgRFfJMqW7XpSQ==",
"dev": true
},
"node_modules/axios": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz",
@@ -137,6 +161,13 @@
}
},
"dependencies": {
"@scrypted/common": {
"version": "file:../../common",
"requires": {
"@scrypted/sdk": "file:../sdk",
"@types/node": "^16.9.0"
}
},
"@scrypted/sdk": {
"version": "file:../../sdk",
"requires": {
@@ -150,7 +181,7 @@
"@babel/preset-typescript": "^7.15.0",
"@types/node": "^16.6.1",
"adm-zip": "^0.4.13",
"axios": "^0.21.1",
"axios": "^0.21.4",
"babel-loader": "^8.0.4",
"babel-plugin-const-enum": "^1.1.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
@@ -171,11 +202,18 @@
"ts-loader": "^5.4.5",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "^4.3.5",
"typescript-json-schema": "^0.50.1",
"webpack": "^4.28.1",
"webpack-cli": "^3.1.2",
"webpack-inject-plugin": "^1.0.2"
}
},
"@types/node": {
"version": "16.9.6",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.6.tgz",
"integrity": "sha512-YHUZhBOMTM3mjFkXVcK+WwAcYmyhe1wL4lfqNtzI0b3qAy7yuSetnM7QJazgE5PFmgVTNGiLOgRFfJMqW7XpSQ==",
"dev": true
},
"axios": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.18.1.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/rtsp",
"version": "0.0.24",
"version": "0.0.25",
"description": "RTSP Cameras and Streams Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",
@@ -28,7 +28,9 @@
]
},
"devDependencies": {
"@scrypted/sdk": "file:../../sdk"
"@scrypted/sdk": "file:../../sdk",
"@scrypted/common": "file:../../common",
"@types/node": "^16.9.6"
},
"dependencies": {
"axios": "^0.18.1",

View File

@@ -0,0 +1,7 @@
import { alertRecommendedPlugins } from "@scrypted/common/src/alert-recommended-plugins";
export async function recommendRebroadcast() {
alertRecommendedPlugins({
'@scrypted/prebuffer-mixin': 'Rebroadcast',
});
}

View File

@@ -1,8 +1,9 @@
import sdk, { ScryptedDeviceBase, DeviceProvider, Settings, Setting, ScryptedDeviceType, VideoCamera, MediaObject, MediaStreamOptions, ScryptedInterface, FFMpegInput } from "@scrypted/sdk";
import { KeyObject } from "crypto";
import { EventEmitter } from "stream";
import { recommendRebroadcast } from "./recommend";
const { log, deviceManager, mediaManager } = sdk;
export class RtspCamera extends ScryptedDeviceBase implements VideoCamera, Settings {
constructor(nativeId: string) {
super(nativeId);
@@ -184,6 +185,8 @@ export class RtspProvider extends ScryptedDeviceBase implements DeviceProvider,
if (camId)
this.getDevice(camId);
}
recommendRebroadcast();
}
getAdditionalInterfaces() {

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/unifi-protect",
"version": "0.0.35",
"version": "0.0.36",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/unifi-protect",
"version": "0.0.35",
"version": "0.0.36",
"license": "Apache",
"dependencies": {
"@types/ws": "^7.4.7",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/unifi-protect",
"version": "0.0.35",
"version": "0.0.36",
"description": "Unifi Protect Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",

View File

@@ -4,6 +4,7 @@ import { ProtectApiUpdates, ProtectNvrUpdatePayloadCameraUpdate, ProtectNvrUpdat
import { ProtectCameraChannelConfig, ProtectCameraConfigInterface } from "./unifi-protect/src/protect-types";
import child_process, { ChildProcess } from 'child_process';
import { ffmpegLogInitialOutput } from '../../../common/src/media-helpers';
import { recommendRebroadcast } from "../../rtsp/src/recommend";
const { log, deviceManager, mediaManager } = sdk;
@@ -275,6 +276,7 @@ class UnifiProtect extends ScryptedDeviceBase implements Settings, DeviceProvide
super();
this.startup = this.discoverDevices(0)
recommendRebroadcast();
}
async discoverDevices(duration: number) {