mirror of
https://github.com/eduard256/Strix
synced 2026-04-21 13:37:27 +00:00
- 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)
420 lines
16 KiB
HTML
420 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
<meta name="theme-color" content="#0a0a0f">
|
|
<title>Strix - ONVIF Camera</title>
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
:root {
|
|
--bg-primary: #0a0a0f;
|
|
--bg-secondary: #1a1a24;
|
|
--bg-tertiary: #24242f;
|
|
--bg-elevated: #2a2a38;
|
|
--purple-primary: #8b5cf6;
|
|
--purple-light: #a78bfa;
|
|
--purple-dark: #7c3aed;
|
|
--purple-glow: rgba(139, 92, 246, 0.3);
|
|
--purple-glow-strong: rgba(139, 92, 246, 0.5);
|
|
--text-primary: #e0e0e8;
|
|
--text-secondary: #a0a0b0;
|
|
--text-tertiary: #606070;
|
|
--success: #10b981;
|
|
--error: #ef4444;
|
|
--border-color: rgba(139, 92, 246, 0.15);
|
|
--font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
|
--font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
|
|
--transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
--transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
--shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
|
|
|
|
body {
|
|
font-family: var(--font-primary);
|
|
background: var(--bg-primary);
|
|
color: var(--text-primary);
|
|
line-height: 1.5;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.screen {
|
|
min-height: 100vh;
|
|
padding: 1.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
animation: fadeIn var(--transition-base);
|
|
}
|
|
|
|
.container { max-width: 480px; width: 100%; }
|
|
|
|
@media (min-width: 768px) {
|
|
.screen { padding: 3rem 1.5rem; }
|
|
.container { max-width: 540px; }
|
|
}
|
|
|
|
.back-wrapper {
|
|
position: absolute; top: 1.5rem;
|
|
left: 50%; transform: translateX(-50%);
|
|
width: 100%; max-width: 600px;
|
|
padding: 0 1.5rem;
|
|
z-index: 10;
|
|
}
|
|
|
|
@media (min-width: 768px) {
|
|
.back-wrapper { max-width: 660px; }
|
|
}
|
|
|
|
.btn-back {
|
|
display: inline-flex; align-items: center; gap: 0.5rem;
|
|
background: none; border: none;
|
|
color: var(--text-secondary); font-size: 0.875rem;
|
|
font-family: var(--font-primary); cursor: pointer;
|
|
padding: 0.5rem 0;
|
|
transition: color var(--transition-fast);
|
|
}
|
|
.btn-back:hover { color: var(--purple-primary); }
|
|
|
|
.hero { text-align: center; margin-bottom: 2.5rem; }
|
|
|
|
.onvif-word {
|
|
font-size: 2.5rem; font-weight: 700;
|
|
letter-spacing: 0.08em;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.onvif-o {
|
|
background: linear-gradient(180deg, #00a0e9 0%, #1a237e 100%);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
background-clip: text;
|
|
}
|
|
|
|
.onvif-nvif {
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.title {
|
|
font-size: 1.25rem; font-weight: 600;
|
|
letter-spacing: 0.03em;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
.subtitle {
|
|
font-size: 0.8125rem; color: var(--text-tertiary);
|
|
margin-top: 0.375rem;
|
|
font-family: var(--font-mono);
|
|
}
|
|
|
|
.subtitle .highlight {
|
|
color: var(--purple-light);
|
|
}
|
|
|
|
/* Form */
|
|
.form-group { margin-bottom: 1.5rem; }
|
|
|
|
.label {
|
|
display: flex; align-items: center; gap: 0.5rem;
|
|
font-size: 0.875rem; font-weight: 500;
|
|
color: var(--text-secondary); margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.info-icon {
|
|
position: relative; display: inline-flex;
|
|
align-items: center; justify-content: center;
|
|
width: 16px; height: 16px; cursor: help;
|
|
color: var(--text-tertiary); transition: color var(--transition-fast);
|
|
}
|
|
.info-icon:hover { color: var(--purple-primary); }
|
|
.info-icon svg { width: 16px; height: 16px; }
|
|
|
|
.tooltip {
|
|
position: absolute; top: calc(100% + 8px); left: 50%;
|
|
transform: translateX(-50%);
|
|
background: var(--bg-elevated);
|
|
border: 1px solid var(--purple-primary);
|
|
border-radius: 8px; padding: 1rem;
|
|
width: 320px; max-width: 90vw;
|
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--purple-glow);
|
|
z-index: 1000; opacity: 0; visibility: hidden;
|
|
transition: opacity var(--transition-fast), visibility var(--transition-fast);
|
|
pointer-events: none;
|
|
}
|
|
|
|
.tooltip::after {
|
|
content: ''; position: absolute; bottom: 100%; left: 50%;
|
|
transform: translateX(-50%);
|
|
border: 6px solid transparent; border-bottom-color: var(--purple-primary);
|
|
}
|
|
|
|
.info-icon:hover .tooltip { opacity: 1; visibility: visible; }
|
|
|
|
.tooltip-title { font-weight: 600; color: var(--purple-primary); margin-bottom: 0.5rem; font-size: 0.875rem; }
|
|
.tooltip-text { font-size: 0.75rem; line-height: 1.5; color: var(--text-secondary); }
|
|
|
|
.input {
|
|
width: 100%; padding: 1rem;
|
|
background: var(--bg-secondary);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
color: var(--text-primary);
|
|
font-size: 1rem; font-family: var(--font-primary);
|
|
transition: all var(--transition-fast);
|
|
outline: none;
|
|
}
|
|
|
|
.input:focus {
|
|
border-color: var(--purple-primary);
|
|
box-shadow: 0 0 0 3px var(--purple-glow);
|
|
}
|
|
|
|
.input::placeholder { color: var(--text-tertiary); }
|
|
|
|
.input-password { position: relative; }
|
|
.input-password .input { padding-right: 3rem; }
|
|
.btn-toggle-pass {
|
|
position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
|
|
background: none; border: none; padding: 0.5rem; cursor: pointer;
|
|
color: var(--text-tertiary); display: flex;
|
|
transition: color var(--transition-fast);
|
|
}
|
|
.btn-toggle-pass:hover { color: var(--purple-primary); }
|
|
|
|
/* Buttons */
|
|
.btn {
|
|
display: inline-flex; align-items: center; justify-content: center;
|
|
gap: 0.5rem; padding: 1rem 1.5rem; border-radius: 8px;
|
|
font-size: 1rem; font-weight: 600; font-family: var(--font-primary);
|
|
cursor: pointer; transition: all var(--transition-fast);
|
|
border: none; outline: none;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: linear-gradient(135deg, var(--purple-primary), var(--purple-dark));
|
|
color: white; box-shadow: 0 4px 12px var(--purple-glow);
|
|
}
|
|
.btn-primary:hover:not(:disabled) {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 20px var(--purple-glow-strong);
|
|
}
|
|
.btn-primary:active:not(:disabled) { transform: translateY(0); }
|
|
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
|
|
.btn-large { width: 100%; padding: 1.5rem; font-size: 1.125rem; }
|
|
|
|
.btn-outline {
|
|
display: inline-flex; align-items: center; justify-content: center;
|
|
gap: 0.5rem; padding: 1rem 1.5rem; border-radius: 8px;
|
|
font-size: 1rem; font-weight: 600; font-family: var(--font-primary);
|
|
cursor: pointer; transition: all var(--transition-fast);
|
|
background: transparent; color: var(--text-secondary);
|
|
border: 1px solid var(--border-color); width: 100%;
|
|
margin-top: 0.75rem;
|
|
}
|
|
.btn-outline:hover { border-color: var(--purple-primary); color: var(--purple-light); }
|
|
|
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="back-wrapper">
|
|
<button class="btn-back" id="btn-back">
|
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
<path d="M12 4L6 10l6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
</svg>
|
|
Back
|
|
</button>
|
|
</div>
|
|
|
|
<div class="screen">
|
|
<div class="container">
|
|
<div class="hero">
|
|
<div class="onvif-word"><span class="onvif-o">O</span><span class="onvif-nvif">nvif</span></div>
|
|
<h1 class="title" id="title">ONVIF Camera</h1>
|
|
<p class="subtitle" id="subtitle"></p>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="label">
|
|
Username
|
|
<span class="info-icon">
|
|
<svg viewBox="0 0 16 16" fill="none">
|
|
<circle cx="8" cy="8" r="7" stroke="currentColor" stroke-width="1.5"/>
|
|
<path d="M8 7v4M8 5v.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
</svg>
|
|
<div class="tooltip">
|
|
<div class="tooltip-title">ONVIF Username</div>
|
|
<p class="tooltip-text">The username for your camera's ONVIF service. Usually the same as the web interface login. Common defaults: admin, root.</p>
|
|
</div>
|
|
</span>
|
|
</label>
|
|
<input type="text" id="f-user" class="input" value="admin" autocomplete="off" spellcheck="false">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="label">
|
|
Password
|
|
<span class="info-icon">
|
|
<svg viewBox="0 0 16 16" fill="none">
|
|
<circle cx="8" cy="8" r="7" stroke="currentColor" stroke-width="1.5"/>
|
|
<path d="M8 7v4M8 5v.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
</svg>
|
|
<div class="tooltip">
|
|
<div class="tooltip-title">ONVIF Password</div>
|
|
<p class="tooltip-text">The password for your camera's ONVIF service. Some cameras allow ONVIF access without a password -- leave empty to try.</p>
|
|
</div>
|
|
</span>
|
|
</label>
|
|
<div class="input-password">
|
|
<input type="password" id="f-pass" class="input" placeholder="Camera password" autocomplete="off">
|
|
<button class="btn-toggle-pass" id="btn-toggle-pass" type="button">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
|
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
|
|
<circle cx="12" cy="12" r="3"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<button class="btn btn-primary btn-large" id="btn-discover">Discover Streams</button>
|
|
<button class="btn-outline" id="btn-standard">Skip, use Standard Discovery</button>
|
|
<button class="btn-outline" id="btn-homekit" style="display:none">Try HomeKit Pairing</button>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
var params = new URLSearchParams(location.search);
|
|
|
|
var ip = params.get('ip') || '';
|
|
var ports = params.get('ports') || '';
|
|
var mac = params.get('mac') || '';
|
|
var vendor = params.get('vendor') || '';
|
|
var server = params.get('server') || '';
|
|
var hostname = params.get('hostname') || '';
|
|
var latency = params.get('latency') || '';
|
|
var onvifUrl = params.get('onvif_url') || '';
|
|
var onvifPort = params.get('onvif_port') || '';
|
|
var onvifName = params.get('onvif_name') || '';
|
|
var onvifHardware = params.get('onvif_hardware') || '';
|
|
var mdnsName = params.get('mdns_name') || '';
|
|
var mdnsModel = params.get('mdns_model') || '';
|
|
var mdnsCategory = params.get('mdns_category') || '';
|
|
var mdnsPort = params.get('mdns_port') || '';
|
|
var mdnsPaired = params.get('mdns_paired') || '';
|
|
var mdnsDeviceId = params.get('mdns_device_id') || '';
|
|
|
|
// title from ONVIF name
|
|
if (onvifName) {
|
|
document.getElementById('title').textContent = onvifName;
|
|
}
|
|
|
|
// subtitle with IP and hardware
|
|
var subtitleEl = document.getElementById('subtitle');
|
|
var parts = [];
|
|
if (ip) parts.push(ip);
|
|
if (onvifHardware && onvifHardware !== onvifName) parts.push(onvifHardware);
|
|
if (parts.length) {
|
|
while (subtitleEl.firstChild) subtitleEl.removeChild(subtitleEl.firstChild);
|
|
parts.forEach(function(text, i) {
|
|
if (i > 0) {
|
|
var sep = document.createElement('span');
|
|
sep.textContent = ' / ';
|
|
subtitleEl.appendChild(sep);
|
|
}
|
|
var span = document.createElement('span');
|
|
span.className = 'highlight';
|
|
span.textContent = text;
|
|
subtitleEl.appendChild(span);
|
|
});
|
|
}
|
|
|
|
// show HomeKit button only if mDNS data present
|
|
if (mdnsName && mdnsDeviceId) {
|
|
document.getElementById('btn-homekit').style.display = '';
|
|
}
|
|
|
|
// password toggle
|
|
document.getElementById('btn-toggle-pass').addEventListener('click', function() {
|
|
var input = document.getElementById('f-pass');
|
|
input.type = input.type === 'password' ? 'text' : 'password';
|
|
});
|
|
|
|
// discover streams -> build onvif:// URL and go to create.html
|
|
document.getElementById('btn-discover').addEventListener('click', function() {
|
|
var user = document.getElementById('f-user').value.trim();
|
|
var pass = document.getElementById('f-pass').value;
|
|
|
|
var auth = '';
|
|
if (user || pass) {
|
|
auth = encodeURIComponent(user) + ':' + encodeURIComponent(pass) + '@';
|
|
}
|
|
|
|
var host = ip;
|
|
var port = parseInt(onvifPort, 10) || 80;
|
|
if (port !== 80) {
|
|
host = ip + ':' + port;
|
|
}
|
|
|
|
var onvifStreamUrl = 'onvif://' + auth + host;
|
|
|
|
var p = new URLSearchParams();
|
|
p.set('url', onvifStreamUrl);
|
|
if (ip) p.set('ip', ip);
|
|
if (mac) p.set('mac', mac);
|
|
if (vendor) p.set('vendor', vendor);
|
|
if (onvifName) p.set('model', onvifName);
|
|
if (server) p.set('server', server);
|
|
if (hostname) p.set('hostname', hostname);
|
|
if (ports) p.set('ports', ports);
|
|
|
|
window.location.href = 'create.html?' + p.toString();
|
|
});
|
|
|
|
// standard discovery
|
|
document.getElementById('btn-standard').addEventListener('click', function() {
|
|
var p = new URLSearchParams();
|
|
if (ip) p.set('ip', ip);
|
|
if (ports) p.set('ports', ports);
|
|
if (mac) p.set('mac', mac);
|
|
if (vendor) p.set('vendor', vendor);
|
|
if (server) p.set('server', server);
|
|
if (hostname) p.set('hostname', hostname);
|
|
if (latency) p.set('latency', latency);
|
|
window.location.href = 'standard.html?' + p.toString();
|
|
});
|
|
|
|
// homekit pairing
|
|
document.getElementById('btn-homekit').addEventListener('click', function() {
|
|
var p = new URLSearchParams();
|
|
if (ip) p.set('ip', ip);
|
|
if (ports) p.set('ports', ports);
|
|
if (mac) p.set('mac', mac);
|
|
if (vendor) p.set('vendor', vendor);
|
|
if (server) p.set('server', server);
|
|
if (hostname) p.set('hostname', hostname);
|
|
if (latency) p.set('latency', latency);
|
|
if (mdnsName) p.set('mdns_name', mdnsName);
|
|
if (mdnsModel) p.set('mdns_model', mdnsModel);
|
|
if (mdnsCategory) p.set('mdns_category', mdnsCategory);
|
|
if (mdnsPort) p.set('mdns_port', mdnsPort);
|
|
if (mdnsPaired) p.set('mdns_paired', mdnsPaired);
|
|
if (mdnsDeviceId) p.set('mdns_device_id', mdnsDeviceId);
|
|
window.location.href = 'homekit.html?' + p.toString();
|
|
});
|
|
|
|
// back
|
|
document.getElementById('btn-back').addEventListener('click', function() {
|
|
window.location.href = 'index.html';
|
|
});
|
|
|
|
// autofocus password field (user is prefilled)
|
|
document.getElementById('f-pass').focus();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|