mirror of
https://github.com/koush/scrypted.git
synced 2026-05-04 21:30:30 +01:00
core: add nvr link, implement add to launcher
This commit is contained in:
2
plugins/core/.vscode/settings.json
vendored
2
plugins/core/.vscode/settings.json
vendored
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"scrypted.debugHost": "127.0.0.1",
|
||||
"scrypted.debugHost": "koushik-ubuntu",
|
||||
}
|
||||
4
plugins/core/package-lock.json
generated
4
plugins/core/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.50",
|
||||
"version": "0.1.51",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.50",
|
||||
"version": "0.1.51",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.50",
|
||||
"version": "0.1.51",
|
||||
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
@@ -26,6 +26,7 @@
|
||||
"name": "Scrypted Core",
|
||||
"type": "DeviceProvider",
|
||||
"interfaces": [
|
||||
"@scrypted/launcher-ignore",
|
||||
"HttpRequestHandler",
|
||||
"EngineIOHandler",
|
||||
"DeviceProvider"
|
||||
|
||||
24
plugins/core/src/launcher-mixin.ts
Normal file
24
plugins/core/src/launcher-mixin.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { DeviceState, MixinProvider, ScryptedDeviceBase, ScryptedDeviceType, ScryptedInterface } from "@scrypted/sdk";
|
||||
import { typeToIcon } from "../ui/src/components/helpers";
|
||||
|
||||
export class LauncherMixin extends ScryptedDeviceBase implements MixinProvider {
|
||||
async canMixin(type: ScryptedDeviceType, interfaces: string[]): Promise<string[]> {
|
||||
if (interfaces.includes("@scrypted/launcher-ignore"))
|
||||
return;
|
||||
return [
|
||||
ScryptedInterface.LauncherApplication,
|
||||
];
|
||||
}
|
||||
|
||||
async getMixin(mixinDevice: any, mixinDeviceInterfaces: ScryptedInterface[], mixinDeviceState: DeviceState): Promise<any> {
|
||||
mixinDeviceState.applicationInfo = {
|
||||
icon: 'fa ' + typeToIcon(mixinDeviceState.type),
|
||||
href: '/endpoint/@scrypted/core/public/#/device/' + mixinDeviceState.id,
|
||||
}
|
||||
return mixinDevice;
|
||||
}
|
||||
|
||||
async releaseMixin(id: string, mixinDevice: any): Promise<void> {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import net from 'net';
|
||||
import { updatePluginsData } from './update-plugins';
|
||||
import { MediaCore } from './media-core';
|
||||
import { ScriptCore, ScriptCoreNativeId } from './script-core';
|
||||
import { LauncherMixin } from './launcher-mixin';
|
||||
|
||||
const { pluginHostAPI, systemManager, deviceManager, mediaManager, endpointManager } = sdk;
|
||||
|
||||
@@ -47,6 +48,7 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Eng
|
||||
router: any = Router();
|
||||
publicRouter: any = Router();
|
||||
mediaCore: MediaCore;
|
||||
launcher: LauncherMixin;
|
||||
scriptCore: ScriptCore;
|
||||
automations = new Map<string, Automation>();
|
||||
aggregate = new Map<string, AggregateDevice>();
|
||||
@@ -77,6 +79,16 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Eng
|
||||
this.scriptCore = new ScriptCore(ScriptCoreNativeId);
|
||||
})();
|
||||
|
||||
deviceManager.onDeviceDiscovered({
|
||||
name: 'Add to Launcher',
|
||||
nativeId: 'launcher',
|
||||
interfaces: [
|
||||
'@scrypted/launcher-ignore',
|
||||
ScryptedInterface.MixinProvider,
|
||||
],
|
||||
type: ScryptedDeviceType.Builtin,
|
||||
});
|
||||
|
||||
for (const nativeId of deviceManager.getNativeIds()) {
|
||||
if (nativeId?.startsWith('automation:')) {
|
||||
const automation = new Automation(nativeId);
|
||||
@@ -141,6 +153,8 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Eng
|
||||
}
|
||||
|
||||
async getDevice(nativeId: string) {
|
||||
if (nativeId === 'launcher')
|
||||
return new LauncherMixin('launcher');
|
||||
if (nativeId === 'mediacore')
|
||||
return this.mediaCore;
|
||||
if (nativeId === ScriptCoreNativeId)
|
||||
|
||||
1326
plugins/core/ui/package-lock.json
generated
1326
plugins/core/ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,11 +9,11 @@
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^6.1.2",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.1.2",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.1.2",
|
||||
"@fortawesome/free-regular-svg-icons": "^6.1.2",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.1.2",
|
||||
"@fortawesome/fontawesome-free": "^6.2.1",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.2.1",
|
||||
"@fortawesome/free-regular-svg-icons": "^6.2.1",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.2.1",
|
||||
"@fortawesome/vue-fontawesome": "^2.0.8",
|
||||
"@radial-color-picker/vue-color-picker": "^2.3.0",
|
||||
"@scrypted/common": "file:../../../common",
|
||||
|
||||
@@ -51,6 +51,47 @@
|
||||
</v-tooltip>
|
||||
</div>
|
||||
</v-card>
|
||||
<v-card width="300px" class="elevation-24 mt-4" v-if="showNvr" dark>
|
||||
<v-card-title style="justify-content: center;" class="headline text-uppercase">Support Scrypted
|
||||
</v-card-title>
|
||||
<v-card-subtitle style="justify-content: center; text-align: center;"
|
||||
class="headline text-uppercase">Get Scrypted NVR</v-card-subtitle>
|
||||
<v-list>
|
||||
|
||||
<v-list-item>
|
||||
<v-list-item-icon>
|
||||
<v-icon>fa fa-timeline</v-icon>
|
||||
</v-list-item-icon>
|
||||
24/7 recording with smart detections.
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item>
|
||||
<v-list-item-icon>
|
||||
<v-icon>fa-solid fa-video-camera</v-icon>
|
||||
</v-list-item-icon>
|
||||
4K and adaptive bitrate streaming.
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item>
|
||||
<v-list-item-icon>
|
||||
<v-icon>fa fa-dashboard</v-icon>
|
||||
</v-list-item-icon>
|
||||
|
||||
Dashboard of all your cameras.
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item>
|
||||
<v-list-item-icon>
|
||||
<v-icon>fa fa-mobile</v-icon>
|
||||
</v-list-item-icon>
|
||||
Mobile App.
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<div style="width: 100%; display: flex; justify-content: center;">
|
||||
<v-btn style="justify-self: center;" href="https://demo.scrypted.app/#/demo">View Demo
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-card>
|
||||
</div>
|
||||
</div>
|
||||
</v-app>
|
||||
@@ -87,6 +128,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
showNvr: false,
|
||||
applications: [
|
||||
{
|
||||
name: 'Management Console',
|
||||
@@ -116,14 +158,14 @@ export default {
|
||||
const ret = {
|
||||
name: (app.applicationInfo && app.applicationInfo.name) || app.name,
|
||||
icon: app.applicationInfo && app.applicationInfo.icon,
|
||||
href: `/endpoint/${appId}/public/`,
|
||||
href: (app.applicationInfo && app.applicationInfo.href) || `/endpoint/${appId}/public/`,
|
||||
};
|
||||
return ret;
|
||||
});
|
||||
if (!applications.length) {
|
||||
this.$router.push('/component/plugin');
|
||||
return;
|
||||
}
|
||||
// if (!applications.length) {
|
||||
// this.$router.push('/component/plugin');
|
||||
// return;
|
||||
// }
|
||||
|
||||
this.applications.unshift(
|
||||
{
|
||||
@@ -132,6 +174,8 @@ export default {
|
||||
to: '/component/plugin',
|
||||
},
|
||||
)
|
||||
|
||||
this.showNvr = !systemManager.getDeviceByName('@scrypted/nvr');
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -82,6 +82,8 @@ import {
|
||||
faShieldAlt,
|
||||
faWrench,
|
||||
faVideoCamera,
|
||||
faTimeline,
|
||||
faMobile,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
import {
|
||||
@@ -170,6 +172,8 @@ const icons: IconDefinition[] =[
|
||||
faShieldAlt,
|
||||
faWrench,
|
||||
faVideoCamera,
|
||||
faTimeline,
|
||||
faMobile,
|
||||
];
|
||||
|
||||
for (var icon in icons) {
|
||||
|
||||
Reference in New Issue
Block a user