Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-hikvision-ultimate

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-hikvision-ultimate - npm Package Compare versions

Comparing version 1.1.12 to 1.1.13

5

CHANGELOG.md

@@ -7,2 +7,7 @@ <p align="center"><img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-hikvision-ultimate/master/img/logo.png' width="40%"></p>

<p>
<b>Version 1.1.13</b> October 2023<br/>
- Refined some function and start to write the help TAB of Node-Red.<br/>
- Added the debug level option.<br/>
</p>
<p>
<b>Version 1.1.12</b> October 2023<br/>

@@ -9,0 +14,0 @@ - Silenced the log error, while error occurs fetching the http socket.<br/>

104

nodes/Hikvision-config.js
module.exports = (RED) => {
const discoHikvisionDevices = require('./utils/hikDiscovery');
const DigestFetch = require('digest-fetch'); // 04/6/2022 DO NOT UPGRADE TO NODE-FETCH V3, BECAUSE DIGEST-FETCH DOESN'T SUPPORT IT

@@ -13,4 +11,2 @@ const AbortController = require('abort-controller');

function Hikvisionconfig(config) {

@@ -20,4 +16,4 @@ RED.nodes.createNode(this, config)

node.port = config.port || 80;
node.debug = config.host.toString().toLowerCase().indexOf("banana") > -1;
node.host = config.host.toString().toLowerCase().replace("banana", "") + ":" + node.port;
node.debug = (config.debuglevel === undefined || config.debuglevel === "no") ? false : true;
node.host = config.host + ":" + node.port;
node.protocol = config.protocol || "http";

@@ -109,34 +105,35 @@ node.nodeClients = []; // Stores the registered clients

// 14/12/2020 Get the infos from the camera
RED.httpAdmin.get("/hikvisionUltimateDiscoverOnlineDevices", RED.auth.needsPermission('Hikvisionconfig.read'), function (req, res) {
if (node.onLineHikvisionDevicesDiscoverList === null) {
try {
(async () => {
try {
let discoveredDevices = await discoHikvisionDevices.Discover();
try {
res.json(discoveredDevices);
return;
} catch (error) {
res.json(error);
return;
}
} catch (error) {
RED.log.error("Errore hikvisionUltimateDiscoverOnlineDevices " + error.message);
res.json(error);
}
})();
} catch (err) {
res.json(err);
}
} else {
res.json(node.onLineHikvisionDevicesDiscoverList)
}
});
// RED.httpAdmin.get("/hikvisionUltimateDiscoverOnlineDevices", RED.auth.needsPermission('Hikvisionconfig.read'), function (req, res) {
// if (node.onLineHikvisionDevicesDiscoverList === null) {
// try {
// (async () => {
// try {
// let discoveredDevices = await discoHikvisionDevices.Discover();
// try {
// res.json(discoveredDevices);
// return;
// } catch (error) {
// res.json(error);
// return;
// }
// } catch (error) {
// RED.log.error("Errore hikvisionUltimateDiscoverOnlineDevices " + error.message);
// res.json(error);
// }
// })();
// } catch (err) {
// res.json(err);
// }
// } else {
// res.json(node.onLineHikvisionDevicesDiscoverList)
// }
// });
// This function starts the heartbeat timer, to detect the disconnection from the server
node.resetHeartBeatTimer = () => {

@@ -204,2 +201,3 @@ // Reset node.timerCheckHeartBeat

};
try {

@@ -295,3 +293,3 @@

//sRet = sRet.replace(/--boundary/g, '');
var i = sRet.indexOf("<"); // Get only the XML, starting with "<"
var i = sRet.includes("Content-Type: application/xml");
if (i > -1) {

@@ -314,22 +312,20 @@ sRet = sRet.substring(i);

} else {
i = sRet.indexOf("{") // It's a Json
if (i > -1) {
if (node.debug) RED.log.error("BANANA SBANANATO JSON " + sRet);
sRet = sRet.substring(i);
try {
sRet = JSON.parse(sRet);
// if (node.debug) RED.log.error("BANANA JSONATO: " + sRet);
if (sRet !== null && sRet !== undefined) {
node.nodeClients.forEach(oClient => {
oClient.sendPayload({ topic: oClient.topic || "", payload: sRet });
})
}
} catch (error) {
sRet = "";
} else if (sRet.includes("Content-Type: application/json")) {
i = sRet.indexOf("{") // It's a Json
if (node.debug) RED.log.error("BANANA SBANANATO JSON " + sRet);
sRet = sRet.substring(i);
try {
sRet = JSON.parse(sRet);
// if (node.debug) RED.log.error("BANANA JSONATO: " + sRet);
if (sRet !== null && sRet !== undefined) {
node.nodeClients.forEach(oClient => {
oClient.sendPayload({ topic: oClient.topic || "", payload: sRet });
})
}
} else {
// Invalid body
if (node.debug) RED.log.info("Hikvision-config: DecodingBody Info only: Invalid Json " + sRet);
} catch (error) {
sRet = "";
}
} else {
// Invalid body
if (node.debug) RED.log.info("Hikvision-config: DecodingBody Info only: Invalid Json " + sRet);
}

@@ -336,0 +332,0 @@ // All is fine. Reset and restart the hearbeat timer

{
"name": "node-red-contrib-hikvision-ultimate",
"version": "1.1.12",
"version": "1.1.13",
"description": "A native set of nodes for Hikvision (and compatible) Cameras, Alarms, Radars, NVR, Doorbells, etc.",

@@ -5,0 +5,0 @@ "author": "Supergiovane (https://github.com/Supergiovane)",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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