From d59816543d02fb47b177ea8141c716e6ce8dcfa3 Mon Sep 17 00:00:00 2001 From: eduard256 Date: Fri, 3 Apr 2026 20:03:45 +0000 Subject: [PATCH] Add direct stream URL input support to web UI --- www/create.html | 19 ++++++++++++------- www/index.html | 10 ++++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/www/create.html b/www/create.html index 360b300..5ba7e4a 100644 --- a/www/create.html +++ b/www/create.html @@ -326,8 +326,16 @@ var dbStreams = []; // from /api/streams var customStreams = []; // user-added + // Pre-populate custom streams from "url" query parameter (supports multiple) + params.getAll('url').forEach(function(u) { + u = u.trim(); + if (u && u.indexOf('://') !== -1 && customStreams.indexOf(u) === -1) { + customStreams.push(u); + } + }); + // subtitle - document.getElementById('subtitle').textContent = ip ? 'Target: ' + ip : ''; + document.getElementById('subtitle').textContent = ip ? 'Target: ' + ip : 'Add stream URLs manually'; // back document.getElementById('btn-back').addEventListener('click', function() { @@ -339,7 +347,8 @@ async function loadStreams() { if (!ids || !ip) { - renderError('Missing required parameters (ids, ip)'); + // No parameters — show empty list with add section + renderAll(); return; } @@ -359,11 +368,7 @@ var data = await r.json(); dbStreams = data.streams || []; - if (dbStreams.length === 0 && customStreams.length === 0) { - renderEmpty(); - } else { - renderAll(); - } + renderAll(); } catch (e) { renderError('Connection error: ' + e.message); } diff --git a/www/index.html b/www/index.html index 5f1af5a..e88561e 100644 --- a/www/index.html +++ b/www/index.html @@ -257,7 +257,7 @@ -

IP address of the camera

+

IP address or stream URL (rtsp://, http://, ...)

@@ -295,7 +295,13 @@ async function checkAddress() { const ip = ipInput.value.trim(); - if (!ip) { showToast('Enter an IP address'); return; } + if (!ip) { showToast('Enter an IP address or stream URL'); return; } + + // Direct stream URL — skip probe, go straight to create.html + if (ip.indexOf('://') !== -1) { + window.location.href = 'create.html?url=' + encodeURIComponent(ip); + return; + } btnCheck.disabled = true; btnCheck.textContent = 'Checking...';