mirror of
https://github.com/koush/scrypted.git
synced 2026-02-13 10:22:57 +00:00
onvif: dont fail if name/hardware parsing fails
This commit is contained in:
6
plugins/onvif/package-lock.json
generated
6
plugins/onvif/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.0.86",
|
||||
"version": "0.0.88",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.0.86",
|
||||
"version": "0.0.88",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@koush/axios-digest-auth": "^0.8.5",
|
||||
@@ -41,7 +41,7 @@
|
||||
},
|
||||
"../../sdk": {
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.0.192",
|
||||
"version": "0.0.198",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/preset-typescript": "^7.16.7",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.0.86",
|
||||
"version": "0.0.88",
|
||||
"description": "ONVIF Camera Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
@@ -348,19 +348,22 @@ class OnvifProvider extends RtspProvider implements DeviceDiscovery, Settings {
|
||||
this.console.error('discovery error', err);
|
||||
return;
|
||||
}
|
||||
let urn = result['Envelope']['Body'][0]['ProbeMatches'][0]['ProbeMatch'][0]['EndpointReference'][0]['Address'][0].payload;
|
||||
let xaddrs = result['Envelope']['Body'][0]['ProbeMatches'][0]['ProbeMatch'][0]['XAddrs'][0].payload;
|
||||
let scopes = result['Envelope']['Body'][0]['ProbeMatches'][0]['ProbeMatch'][0]['Scopes'][0].payload;
|
||||
scopes = scopes.split(" ");
|
||||
const urn = result['Envelope']['Body'][0]['ProbeMatches'][0]['ProbeMatch'][0]['EndpointReference'][0]['Address'][0].payload;
|
||||
const xaddrs = result['Envelope']['Body'][0]['ProbeMatches'][0]['ProbeMatch'][0]['XAddrs'][0].payload;
|
||||
let name: string;
|
||||
|
||||
let hardware = "";
|
||||
let name = "";
|
||||
for (let i = 0; i < scopes.length; i++) {
|
||||
if (scopes[i].includes('onvif://www.onvif.org/name')) { name = decodeURI(scopes[i].substring(27)); }
|
||||
if (scopes[i].includes('onvif://www.onvif.org/hardware')) { hardware = decodeURI(scopes[i].substring(31)); }
|
||||
try {
|
||||
let scopes = result['Envelope']['Body'][0]['ProbeMatches'][0]['ProbeMatch'][0]['Scopes'][0].payload;
|
||||
scopes = scopes.split(" ");
|
||||
|
||||
for (let i = 0; i < scopes.length; i++) {
|
||||
if (scopes[i].includes('onvif://www.onvif.org/name')) { name = decodeURI(scopes[i].substring(27)); }
|
||||
}
|
||||
}
|
||||
let msg = 'Discovery Reply from ' + rinfo.address + ' (' + name + ') (' + hardware + ') (' + xaddrs + ') (' + urn + ')';
|
||||
this.console.log(msg);
|
||||
catch (e) {
|
||||
}
|
||||
|
||||
this.console.log('Discovery Reply from ' + rinfo.address + ' (' + name + ') (' + xaddrs + ') (' + urn + ')');
|
||||
|
||||
const isNew = !deviceManager.getNativeIds().includes(urn);
|
||||
if (!isNew)
|
||||
|
||||
Reference in New Issue
Block a user