Add ONVIF camera page and probe routing
- Add onvif.html: credentials form, Discover Streams button, fallback to Standard Discovery and HomeKit Pairing - Update index.html routing: onvif type -> onvif.html with all probe params (onvif_url, onvif_port, onvif_name, onvif_hardware, mdns_* for HomeKit fallback)
This commit is contained in:
+47
-2
@@ -317,8 +317,8 @@
|
||||
|
||||
const data = await r.json();
|
||||
|
||||
if (data.type === 'standard' || (data.reachable && data.type !== 'homekit')) {
|
||||
navigateStandard(ip, data);
|
||||
if (data.type === 'onvif') {
|
||||
navigateOnvif(ip, data);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -327,6 +327,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.type === 'standard' || data.reachable) {
|
||||
navigateStandard(ip, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.type === 'unreachable') {
|
||||
showUnreachable(ip);
|
||||
return;
|
||||
@@ -340,6 +345,46 @@
|
||||
}
|
||||
}
|
||||
|
||||
function navigateOnvif(ip, data) {
|
||||
var p = new URLSearchParams();
|
||||
p.set('ip', ip);
|
||||
|
||||
var probes = data.probes || {};
|
||||
|
||||
if (probes.ports && probes.ports.open && probes.ports.open.length) {
|
||||
p.set('ports', probes.ports.open.join(','));
|
||||
}
|
||||
if (probes.arp) {
|
||||
if (probes.arp.mac) p.set('mac', probes.arp.mac);
|
||||
if (probes.arp.vendor) p.set('vendor', probes.arp.vendor);
|
||||
}
|
||||
if (probes.http && probes.http.server) {
|
||||
p.set('server', probes.http.server);
|
||||
}
|
||||
if (probes.dns && probes.dns.hostname) {
|
||||
p.set('hostname', probes.dns.hostname);
|
||||
}
|
||||
if (probes.ping && probes.ping.latency_ms) {
|
||||
p.set('latency', Math.round(probes.ping.latency_ms));
|
||||
}
|
||||
if (probes.onvif) {
|
||||
if (probes.onvif.url) p.set('onvif_url', probes.onvif.url);
|
||||
if (probes.onvif.port) p.set('onvif_port', probes.onvif.port);
|
||||
if (probes.onvif.name) p.set('onvif_name', probes.onvif.name);
|
||||
if (probes.onvif.hardware) p.set('onvif_hardware', probes.onvif.hardware);
|
||||
}
|
||||
if (probes.mdns) {
|
||||
if (probes.mdns.name) p.set('mdns_name', probes.mdns.name);
|
||||
if (probes.mdns.model) p.set('mdns_model', probes.mdns.model);
|
||||
if (probes.mdns.category) p.set('mdns_category', probes.mdns.category);
|
||||
if (probes.mdns.device_id) p.set('mdns_device_id', probes.mdns.device_id);
|
||||
if (probes.mdns.port) p.set('mdns_port', probes.mdns.port);
|
||||
p.set('mdns_paired', probes.mdns.paired ? '1' : '0');
|
||||
}
|
||||
|
||||
window.location.href = 'onvif.html?' + p.toString();
|
||||
}
|
||||
|
||||
function navigateStandard(ip, data) {
|
||||
var p = new URLSearchParams();
|
||||
p.set('ip', ip);
|
||||
|
||||
Reference in New Issue
Block a user