New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@scrypted/amcrest

Package Overview
Dependencies
Maintainers
0
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scrypted/amcrest - npm Package Compare versions

Comparing version 0.0.164 to 0.0.165

2

.vscode/settings.json
{
"scrypted.debugHost": "127.0.0.1",
"scrypted.debugHost": "scrypted-nvr",
}
{
"name": "@scrypted/amcrest",
"version": "0.0.164",
"version": "0.0.165",
"description": "Amcrest Plugin for Scrypted",

@@ -42,8 +42,10 @@ "author": "Scrypted",

"@scrypted/sdk": "file:../../sdk",
"content-type": "^1.0.5"
"content-type": "^1.0.5",
"xml2js": "^0.6.2"
},
"devDependencies": {
"@types/content-type": "^1.1.8",
"@types/node": "^20.11.30"
"@types/node": "^20.11.30",
"@types/xml2js": "^0.4.14"
}
}
import { automaticallyConfigureSettings, checkPluginNeedsAutoConfigure } from "@scrypted/common/src/autoconfigure-codecs";
import { ffmpegLogInitialOutput } from '@scrypted/common/src/media-helpers';
import { readLength } from "@scrypted/common/src/read-stream";
import sdk, { Camera, DeviceCreatorSettings, DeviceInformation, FFmpegInput, Intercom, Lock, MediaObject, MediaStreamOptions, ObjectDetectionTypes, ObjectDetector, ObjectsDetected, Reboot, RequestPictureOptions, RequestRecordingStreamOptions, ResponseMediaStreamOptions, ScryptedDeviceType, ScryptedInterface, ScryptedMimeTypes, ScryptedNativeId, Setting, VideoCameraConfiguration, VideoRecorder } from "@scrypted/sdk";
import sdk, { Camera, DeviceCreatorSettings, DeviceInformation, FFmpegInput, Intercom, Lock, MediaObject, MediaStreamOptions, ObjectDetectionTypes, ObjectDetector, ObjectsDetected, Reboot, RequestPictureOptions, RequestRecordingStreamOptions, ResponseMediaStreamOptions, ScryptedDeviceType, ScryptedInterface, ScryptedMimeTypes, ScryptedNativeId, Setting, VideoCameraConfiguration, VideoRecorder, VideoTextOverlay, VideoTextOverlays } from "@scrypted/sdk";
import child_process, { ChildProcess } from 'child_process';

@@ -11,3 +11,2 @@ import { PassThrough, Readable, Stream } from "stream";

import { amcrestAutoConfigureSettings, autoconfigureSettings } from "./amcrest-configure";
import { group } from "console";

@@ -27,3 +26,3 @@ const { mediaManager } = sdk;

class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, Camera, Intercom, Lock, VideoRecorder, Reboot, ObjectDetector {
class AmcrestCamera extends RtspSmartCamera implements VideoCameraConfiguration, Camera, Intercom, Lock, VideoRecorder, Reboot, ObjectDetector, VideoTextOverlays {
eventStream: Stream;

@@ -48,2 +47,88 @@ cp: ChildProcess;

async getVideoTextOverlays(): Promise<Record<string, VideoTextOverlay>> {
const client = this.getClient();
const response = await client.request({
method: "GET",
url: `http://${this.getHttpAddress()}/cgi-bin/configManager.cgi?action=getConfig&name=VideoWidget`,
responseType: "text",
headers: {
"Content-Type": "application/xml",
},
});
const body: string = response.body;
if (!body.startsWith("<")) {
const encodeBlend = '.EncodeBlend';
const config: Record<string, VideoTextOverlay> = {};
for (const line of body.split(/\r?\n/).filter(l => l.includes(encodeBlend + '='))) {
const trimmed = line.trim();
if (!trimmed) continue;
const splitIndex = trimmed.indexOf("=");
if (splitIndex === -1) continue;
// remove encodeBlend
let key = trimmed.substring(0, splitIndex);
key = key.substring(0, key.length - encodeBlend.length);
config[key] = {
readonly: true,
};
}
const textValue = '.Text';
for (const line of body.split(/\r?\n/).filter(l => l.includes(textValue + '='))) {
const trimmed = line.trim();
if (!trimmed) continue;
const splitIndex = trimmed.indexOf("=");
if (splitIndex === -1) continue;
// remove encodeBlend
let key = trimmed.substring(0, splitIndex);
key = key.substring(0, key.length - textValue.length);
const text = trimmed.substring(splitIndex + 1).trim();
const c = config[key];
if (!c)
continue;
delete c.readonly;
c.text = text;
}
return config;
} else {
throw new Error('invalid response');
// const json = await xml2js.parseStringPromise(body);
// return { json, xml: body };
}
}
async setVideoTextOverlay(id: string, value: VideoTextOverlay): Promise<void> {
// trim the table. off id
if (id.startsWith('table.'))
id = id.substring('table.'.length);
const client = this.getClient();
if (value.text) {
const enableUrl = `http://${this.getHttpAddress()}/cgi-bin/configManager.cgi?action=setConfig&${id}.EncodeBlend=true&${id}.PreviewBlend=true`;
await client.request({
method: "GET",
url: enableUrl,
responseType: "text",
});
const textUrl = `http://${this.getHttpAddress()}/cgi-bin/configManager.cgi?action=setConfig&${id}.Text=${encodeURIComponent(
value.text
)}`;
await client.request({
method: "GET",
url: textUrl,
responseType: "text",
});
}
else {
const disableUrl = `http://${this.getHttpAddress()}/cgi-bin/configManager.cgi?action=setConfig&${id}.EncodeBlend=false&${id}.PreviewBlend=false`;
await client.request({
method: "GET",
url: disableUrl,
responseType: "text",
});
}
}
async reboot() {

@@ -637,2 +722,3 @@ const client = this.getClient();

ScryptedInterface.MotionSensor,
ScryptedInterface.VideoTextOverlays,
];

@@ -639,0 +725,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc