node-red-contrib-hik-media-buffer 1.1.10 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,17 +42,26 @@ module.exports = function(RED) {
42
42
 
43
43
  // --- PRENDE IL NOME DELLA TELECAMERA ---
44
44
  async function getCameraName(cam) {
45
+ const camAuth = new AxiosDigestAuth({
46
+ username: node.user,
47
+ password: node.camPass
48
+ });
49
+
45
50
  try {
46
- const res = await hikRequest({
51
+ // Chiediamo le info generali del dispositivo (valido per TUTTE le Hikvision)
52
+ const res = await camAuth.request({
47
53
  method: 'GET',
48
- url: `${node.protocol}://${cam.ip}:${node.port}/ISAPI/System/Video/inputs/channels/${cam.channel}`,
49
- user: node.user,
50
- pass: node.camPass
54
+ url: `${node.protocol}://${cam.ip}:${node.port}/ISAPI/System/deviceInfo`,
55
+ timeout: 5000
51
56
  });
52
- const match = res.data.match(/<name>([^<]+)<\/name>/);
53
- return match ? match[1] : `Cam_${cam.channel}`;
57
+
58
+ const data = res.data.toString();
59
+ // Nelle info dispositivo il nome è dentro <deviceName>
60
+ const match = data.match(/<deviceName>([^<]+)<\/deviceName>/i);
61
+
62
+ return match ? match[1] : `Cam_${cam.ip}`;
54
63
  } catch (e) {
55
- return `Camera_${cam.ip}`; // Fallback se la camera è già offline
64
+ return `Camera_${cam.ip}`;
56
65
  }
57
66
  }
58
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-hik-media-buffer",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "Ottiene buffer video e immagine da camere Hikvision via ISAPI",
5
5
  "keywords": [
6
6
  "node-red",