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
3
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.113 to 0.0.114

2

package.json
{
"name": "@scrypted/amcrest",
"version": "0.0.113",
"version": "0.0.114",
"description": "Amcrest Plugin for Scrypted",

@@ -5,0 +5,0 @@ "author": "Scrypted",

@@ -37,2 +37,36 @@ import AxiosDigestAuth from '@koush/axios-digest-auth';

// appAutoStart=true
// deviceType=IP4M-1041B
// hardwareVersion=1.00
// processor=SSC327DE
// serialNumber=12345
// updateSerial=IPC-AW46WN-S2
// updateSerialCloudUpgrade=IPC-AW46WN-.....
async getDeviceInfo() {
const response = await this.digestAuth.request({
httpsAgent: amcrestHttpsAgent,
method: "GET",
responseType: 'text',
url: `http://${this.ip}/cgi-bin/magicBox.cgi?action=getSystemInfo`,
});
const lines = (response.data as string).split('\n');
const vals: {
[key: string]: string,
} = {};
for (const line of lines) {
let index = line.indexOf('=');
if (index === -1)
index = line.length;
const k = line.substring(0, index);
const v = line.substring(index + 1);
vals[k] = v.trim();
}
return {
deviceType: vals.deviceType,
hardwareVersion: vals.hardwareVersion,
serialNumber: vals.serialNumber,
}
}
async jpegSnapshot(): Promise<Buffer> {

@@ -39,0 +73,0 @@

import { ffmpegLogInitialOutput } from '@scrypted/common/src/media-helpers';
import { readLength } from "@scrypted/common/src/read-stream";
import sdk, { Camera, FFmpegInput, Intercom, MediaObject, MediaStreamOptions, PictureOptions, RequestRecordingStreamOptions, ResponseMediaStreamOptions, ScryptedDeviceType, ScryptedInterface, ScryptedMimeTypes, Setting, VideoCameraConfiguration, VideoRecorder } from "@scrypted/sdk";
import sdk, { Camera, DeviceCreatorSettings, DeviceInformation, FFmpegInput, Intercom, MediaObject, MediaStreamOptions, PictureOptions, RequestRecordingStreamOptions, ResponseMediaStreamOptions, ScryptedDeviceType, ScryptedInterface, ScryptedMimeTypes, Setting, VideoCameraConfiguration, VideoRecorder } from "@scrypted/sdk";
import child_process, { ChildProcess } from 'child_process';

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

if (!options.id?.startsWith('channel'))
throw new Error('invalid id');
throw new Error('invalid id');
const channel = parseInt(this.getRtspChannel()) || 1;

@@ -259,9 +259,10 @@ const formatNumber = parseInt(options.id?.substring('channel'.length)) - 1;

},
{
title: 'Continuous Recording',
key: 'continuousRecording',
description: 'Continuously record onto the Camera SD Card.',
type: 'boolean',
value: (this.storage.getItem('continuousRecording') === 'true').toString(),
},
// sdcard write causes jitter.
// {
// title: 'Continuous Recording',
// key: 'continuousRecording',
// description: 'Continuously record onto the Camera SD Card.',
// type: 'boolean',
// value: (this.storage.getItem('continuousRecording') === 'true').toString(),
// },
);

@@ -431,3 +432,3 @@

const interfaces = provider.getInterfaces();
const interfaces = this.provider.getInterfaces();
let type: ScryptedDeviceType = undefined;

@@ -444,3 +445,3 @@ if (isDoorbell) {

interfaces.push(ScryptedInterface.VideoRecorder);
provider.updateDevice(this.nativeId, this.name, interfaces, type);
this.provider.updateDevice(this.nativeId, this.name, interfaces, type);

@@ -548,2 +549,68 @@ this.updateManagementUrl();

async createDevice(settings: DeviceCreatorSettings, nativeId?: string): Promise<string> {
const httpAddress = `${settings.ip}:${settings.httpPort || 80}`;
let info: DeviceInformation = {};
const username = settings.username?.toString();
const password = settings.password?.toString();
const skipValidate = settings.skipValidate === 'true';
if (!skipValidate) {
try {
const api = new AmcrestCameraClient(httpAddress, username, password, this.console);
const deviceInfo = await api.getDeviceInfo();
settings.newCamera = deviceInfo.deviceType;
info.model = deviceInfo.deviceType;
info.serialNumber = deviceInfo.serialNumber;
}
catch (e) {
this.console.error('Error adding Hikvision camera', e);
throw e;
}
}
settings.newCamera ||= 'Hikvision Camera';
nativeId = await super.createDevice(settings, nativeId);
const device = await this.getDevice(nativeId) as AmcrestCamera;
device.info = info;
device.putSetting('username', username);
device.putSetting('password', password);
device.setIPAddress(settings.ip?.toString());
device.setHttpPortOverride(settings.httpPort?.toString());
return nativeId;
}
async getCreateDeviceSettings(): Promise<Setting[]> {
return [
{
key: 'username',
title: 'Username',
},
{
key: 'password',
title: 'Password',
type: 'password',
},
{
key: 'ip',
title: 'IP Address',
placeholder: '192.168.2.222',
},
{
key: 'httpPort',
title: 'HTTP Port',
description: 'Optional: Override the HTTP Port from the default value of 80',
placeholder: '80',
},
{
key: 'skipValidate',
title: 'Skip Validation',
description: 'Add the device without verifying the credentials and network settings.',
type: 'boolean',
}
]
}
createCamera(nativeId: string) {

@@ -554,4 +621,2 @@ return new AmcrestCamera(nativeId, this);

const provider = new AmcrestProvider();
export default provider;
export default AmcrestProvider;
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2021",
"resolveJsonModule": true,
"moduleResolution": "node",
"target": "esnext",
"moduleResolution": "Node16",
"esModuleInterop": true,
"sourceMap": true
},

@@ -8,0 +10,0 @@ "include": [

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