mirror of
https://github.com/koush/scrypted.git
synced 2026-05-04 21:30:30 +01:00
perform npm build during the docker build process
This commit is contained in:
@@ -6,4 +6,5 @@ WORKDIR /server
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y install libavahi-compat-libdnssd-dev
|
||||
RUN npm install
|
||||
CMD npm run serve
|
||||
RUN npm run build
|
||||
CMD npm run serve-no-build
|
||||
|
||||
4
plugins/cloud/package-lock.json
generated
4
plugins/cloud/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/cloud",
|
||||
"version": "0.0.13",
|
||||
"version": "0.0.15",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/cloud",
|
||||
"version": "0.0.13",
|
||||
"version": "0.0.15",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"debug": "^4.3.1",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/cloud",
|
||||
"description": "Scrypted Cloud plugin which makes your hub accessible at home.scrypted.app",
|
||||
"scripts": {
|
||||
"prepublishOnly": "NODE_ENV=production scrypted-webpack",
|
||||
"prescrypted-vscode-launch": "scrypted-webpack",
|
||||
@@ -11,6 +12,14 @@
|
||||
"scrypted-package-json": "scrypted-package-json",
|
||||
"scrypted-webpack": "scrypted-webpack"
|
||||
},
|
||||
"keywords": [
|
||||
"scrypted",
|
||||
"plugin",
|
||||
"google",
|
||||
"assistant",
|
||||
"home",
|
||||
"cloud"
|
||||
],
|
||||
"scrypted": {
|
||||
"name": "Scrypted Cloud",
|
||||
"type": "API",
|
||||
@@ -34,5 +43,5 @@
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/http-proxy": "^1.17.5"
|
||||
},
|
||||
"version": "0.0.13"
|
||||
"version": "0.0.15"
|
||||
}
|
||||
|
||||
4
plugins/core/package-lock.json
generated
4
plugins/core/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.0.79",
|
||||
"version": "0.0.80",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.0.79",
|
||||
"version": "0.0.80",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.0.79",
|
||||
"version": "0.0.80",
|
||||
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -161,6 +161,7 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Eng
|
||||
const { nativeId, pluginId } = await plugins.getDeviceInfo(deviceId);
|
||||
const port = await plugins.getRemoteServicePort(pluginId, name);
|
||||
const socket = net.connect(port);
|
||||
socket.on('close', () => ws.close());
|
||||
socket.on('data', data => ws.send(data));
|
||||
socket.resume();
|
||||
socket.write(nativeId?.toString() || 'undefined');
|
||||
@@ -186,8 +187,6 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Eng
|
||||
const userStorage = new UserStorage(request.username);
|
||||
peer.params.userStorage = userStorage;
|
||||
|
||||
|
||||
const listeners = new Set<EventListenerRegister>();
|
||||
const api = new PluginAPIProxy(pluginHostAPI, mediaManager);
|
||||
const remote = await setupPluginRemote(peer, api, null);
|
||||
await remote.setSystemState(systemManager.getSystemState());
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {ScryptedDevice, Camera, ScryptedMimeTypes, RTCAVMessage, MediaManager, VideoCamera} from '@scrypted/sdk/types';
|
||||
|
||||
async function sleep(ms) {
|
||||
await new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
export async function streamCamera(mediaManager: MediaManager, device: ScryptedDevice & VideoCamera, getVideo: () => any, createPeerConnection: (configuration: any) => RTCPeerConnection) {
|
||||
const videoStream = await device.getVideoStream();
|
||||
const offer = await mediaManager.convertMediaObjectToBuffer(
|
||||
|
||||
3
plugins/core/ui/src/common/sleep.ts
Normal file
3
plugins/core/ui/src/common/sleep.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export async function sleep(ms) {
|
||||
await new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
@@ -6,12 +6,30 @@
|
||||
</template>
|
||||
<script>
|
||||
import { Terminal } from "xterm";
|
||||
import { FitAddon } from 'xterm-addon-fit';
|
||||
import { FitAddon } from "xterm-addon-fit";
|
||||
import eio from "engine.io-client";
|
||||
import { sleep } from "../common/sleep";
|
||||
|
||||
export default {
|
||||
props: ["deviceId"],
|
||||
socket: null,
|
||||
methods: {
|
||||
reconnect(term) {
|
||||
const endpointPath = `/endpoint/@scrypted/core`;
|
||||
|
||||
const options = {
|
||||
path: `${endpointPath}/engine.io/console/${this.deviceId}`,
|
||||
};
|
||||
const rootLocation = `${window.location.protocol}//${window.location.host}`;
|
||||
this.socket = eio(rootLocation, options);
|
||||
|
||||
this.socket.on("message", (data) => term.write(new Uint8Array(data)));
|
||||
this.socket.on("close", async () => {
|
||||
await sleep(1000);
|
||||
this.reconnect(term);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
const term = new Terminal({
|
||||
convertEol: true,
|
||||
@@ -22,18 +40,10 @@ export default {
|
||||
term.open(this.$refs.terminal);
|
||||
fitAddon.fit();
|
||||
|
||||
const endpointPath = `/endpoint/@scrypted/core`;
|
||||
|
||||
const options = {
|
||||
path: `${endpointPath}/engine.io/console/${this.deviceId}`,
|
||||
};
|
||||
const rootLocation = `${window.location.protocol}//${window.location.host}`;
|
||||
this.socket = eio(rootLocation, options);
|
||||
|
||||
this.socket.on('message', data => term.write(new Uint8Array(data)));
|
||||
this.reconnect(term);
|
||||
},
|
||||
destroyed() {
|
||||
this.socket?.close();
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
4
plugins/homekit/package-lock.json
generated
4
plugins/homekit/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/homekit",
|
||||
"version": "0.0.45",
|
||||
"version": "0.0.46",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/homekit",
|
||||
"version": "0.0.45",
|
||||
"version": "0.0.46",
|
||||
"dependencies": {
|
||||
"hap-nodejs": "file:../HAP-NodeJS",
|
||||
"lodash": "^4.17.21",
|
||||
|
||||
@@ -40,5 +40,5 @@
|
||||
"@types/qrcode": "^1.4.1",
|
||||
"@types/url-parse": "^1.4.3"
|
||||
},
|
||||
"version": "0.0.45"
|
||||
"version": "0.0.46"
|
||||
}
|
||||
|
||||
@@ -93,6 +93,12 @@ class HomeKit extends ScryptedDeviceBase implements MixinProvider, Settings {
|
||||
title: "Username Override",
|
||||
value: this.getUsername(),
|
||||
key: "mac",
|
||||
},
|
||||
{
|
||||
title: 'Bridge Address',
|
||||
value: localStorage.getItem('addressOverride'),
|
||||
key: 'addressOverride',
|
||||
description: 'Override the default network address used by the Scrypted bridge. Set this to your wired IP if connected by both wired and wireless.'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -202,11 +202,7 @@ addSupportedType({
|
||||
}
|
||||
sessions.set(request.sessionID, session);
|
||||
|
||||
// const addressOverride = (Object.entries(os.networkInterfaces()).filter(([iface, entry]) => iface.startsWith('en') || iface.startsWith('wlan')) as any)
|
||||
// .flat().map(([iface, entry]) => entry).find(i => i.family == 'IPv4').address;
|
||||
|
||||
const response: PrepareStreamResponse = {
|
||||
// addressOverride,
|
||||
video: {
|
||||
srtp_key: request.video.srtp_key,
|
||||
srtp_salt: request.video.srtp_salt,
|
||||
@@ -220,6 +216,14 @@ addSupportedType({
|
||||
ssrc: audiossrc,
|
||||
}
|
||||
}
|
||||
|
||||
// plugin scope or device scope?
|
||||
const addressOverride = localStorage.getItem('addressOverride');
|
||||
if (addressOverride) {
|
||||
console.log('using address override', addressOverride);
|
||||
response.addressOverride = addressOverride;
|
||||
}
|
||||
|
||||
callback(null, response);
|
||||
},
|
||||
async handleStreamRequest(request: StreamingRequest, callback: StreamRequestCallback) {
|
||||
@@ -454,7 +458,7 @@ addSupportedType({
|
||||
accessory.configureController(controller);
|
||||
|
||||
if (controller.motionService) {
|
||||
const motionDetected = needAudioMotionService ?
|
||||
const motionDetected = needAudioMotionService ?
|
||||
() => device.audioDetected || device.motionDetected :
|
||||
() => !!device.motionDetected;
|
||||
|
||||
@@ -464,21 +468,21 @@ addSupportedType({
|
||||
callback(null, motionDetected());
|
||||
});
|
||||
|
||||
device.listen({
|
||||
event: ScryptedInterface.MotionSensor,
|
||||
watch: false,
|
||||
}, (eventSource, eventDetails, data) => {
|
||||
service.updateCharacteristic(Characteristic.MotionDetected, motionDetected());
|
||||
});
|
||||
|
||||
if (needAudioMotionService) {
|
||||
device.listen({
|
||||
event: ScryptedInterface.MotionSensor,
|
||||
event: ScryptedInterface.AudioSensor,
|
||||
watch: false,
|
||||
}, (eventSource, eventDetails, data) => {
|
||||
service.updateCharacteristic(Characteristic.MotionDetected, motionDetected());
|
||||
});
|
||||
|
||||
if (needAudioMotionService) {
|
||||
device.listen({
|
||||
event: ScryptedInterface.AudioSensor,
|
||||
watch: false,
|
||||
}, (eventSource, eventDetails, data) => {
|
||||
service.updateCharacteristic(Characteristic.MotionDetected, motionDetected());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return accessory;
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"preserve": "npm run build",
|
||||
"serve": " node dist/scrypted-main.js",
|
||||
"serve": "node dist/scrypted-main.js",
|
||||
"serve-no-build": "node dist/scrypted-main.js",
|
||||
"ts-serve": "ts-node src/scrypted-main.ts",
|
||||
"build": "tsc --outDir dist"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user