From c94a678467cdfae0da767ccf33be66bf0d81cfe0 Mon Sep 17 00:00:00 2001
From: virmaior <70625876+virmaior@users.noreply.github.com>
Date: Thu, 13 Jul 2023 05:13:30 +0900
Subject: [PATCH] fix unicast urls for v2s / disable editing of camera config
(#558)
* Update config.js
correct RSTP links for V2
* Update config.cgi
fix urls for v2 RTSP in config.cgi
* Update cam.cgi
prevent editing of cam config (not hack config) in www
---
SD_ROOT/wz_mini/www/cgi-bin/cam.cgi | 10 +++---
SD_ROOT/wz_mini/www/cgi-bin/config.cgi | 2 +-
SD_ROOT/wz_mini/www/config.js | 49 ++++++++++++++------------
3 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/SD_ROOT/wz_mini/www/cgi-bin/cam.cgi b/SD_ROOT/wz_mini/www/cgi-bin/cam.cgi
index cb722a2..92ed6e6 100644
--- a/SD_ROOT/wz_mini/www/cgi-bin/cam.cgi
+++ b/SD_ROOT/wz_mini/www/cgi-bin/cam.cgi
@@ -144,7 +144,7 @@ function ini_to_html_free
classes=""
printf '
' "row_$3[$1]" $2 $2 $3
documentation_to_html $1
printf ''
}
@@ -164,7 +164,7 @@ echo -ne ""
echo -ne ''
echo -ne "$title
";
-echo -ne "cam.cgi only lists values in your current configuration file. To add other values, edit manually!
"
+echo -ne "cam.cgi only lists values in your current configuration file.
To Prevent Bricking This Form is Disabled!
"
if [ "$updated" = true ];
then
@@ -182,7 +182,7 @@ fi
-echo -ne ''
-echo -ne '';
+#echo -ne '';
revert_menu $base_hack_ini $cam_config
diff --git a/SD_ROOT/wz_mini/www/cgi-bin/config.cgi b/SD_ROOT/wz_mini/www/cgi-bin/config.cgi
index 0a47c61..13f9f6a 100644
--- a/SD_ROOT/wz_mini/www/cgi-bin/config.cgi
+++ b/SD_ROOT/wz_mini/www/cgi-bin/config.cgi
@@ -179,7 +179,7 @@ echo ''
echo -ne ""
-echo -ne ''
+echo -ne ''
echo -ne "$title
";
diff --git a/SD_ROOT/wz_mini/www/config.js b/SD_ROOT/wz_mini/www/config.js
index b257aa0..bfb12a6 100644
--- a/SD_ROOT/wz_mini/www/config.js
+++ b/SD_ROOT/wz_mini/www/config.js
@@ -17,7 +17,7 @@ window.scrollTo({
}
-function compose_rtsp_block(stype)
+function compose_rtsp_block(stype,streams)
{
const formElement = document.querySelector("form");
var fdata = new FormData(formElement);
@@ -26,29 +26,30 @@ function compose_rtsp_block(stype)
if (fdata.get(stype + "_ENABLED") != "true") {
- console.log(stype + " not enabled");
+ console.log(stype + " not enabled");
return false;
- }
-
- var auth = "";
- if (fdata.get('RTSP_AUTH_DISABLE') != "true") {
- auth = fdata.get('RTSP_LOGIN') + ':';
- if (fdata.get('RTSP_PASSWORD') != '') {
- auth += fdata.get('RTSP_PASSWORD');
- } else {
- auth += document.body.getAttribute('mac');
- }
- auth += "@";
- }
-
-
- stream = "/unicast";
- if ((fdata.get('RTSP_HI_RES_ENABLED') == "true") && (fdata.get('RTSP_LOW_RES_ENABLED') == "true")) {
- if (stype == "RTSP_HI_RES") { stream = "/video1_unicast" } else { stream ="/video2_unicast" }
}
- var link = "rtsp://" + auth + document.body.getAttribute("ip") + ":" + fdata.get('RTSP_PORT') + stream;
+ var auth = "";
+ if (fdata.get('RTSP_AUTH_DISABLE') != "true") {
+ auth = fdata.get('RTSP_LOGIN') + ':';
+ if (fdata.get('RTSP_PASSWORD') != '') {
+ auth += fdata.get('RTSP_PASSWORD');
+ } else {
+ auth += document.body.getAttribute('mac');
+ }
+ auth += "@";
+ }
+
+
+ stream = "unicast";
+
+ if ((fdata.get('RTSP_HI_RES_ENABLED') == "true") && (fdata.get('RTSP_LOW_RES_ENABLED') == "true")) {
+ if (stype == "RTSP_HI_RES") { stream = streams['high']; } else { stream = streams['low']; }
+ }
+ var link = "rtsp://" + auth + document.body.getAttribute("ip") + ":" + fdata.get('RTSP_PORT') + '/' stream;
+
var vb = document.querySelectorAll('[block_name="VIDEOSTREAM"]')[0];
var url_block = document.createElement('DIV');
url_block.innerHTML = 'Stream ' + stype + ' URL: ' + '' + link + '' ;
@@ -64,9 +65,11 @@ function enable_submit()
window.addEventListener("load", function()
{
- compose_rtsp_block('RTSP_HI_RES');
- compose_rtsp_block('RTSP_LOW_RES');
-
+ var streams = {'low': 'video2_unicast', 'high':'video1_unicast'};
+ if (document.body.getAttribute('camtype') != 'T31') { streams = {'low': 'video7_unicast', 'high':'video6_unicast'}; }
+
+ compose_rtsp_block('RTSP_HI_RES',streams);
+ compose_rtsp_block('RTSP_LOW_RES',streams);
document.querySelector('[name="update_config"]').addEventListener('submit',
function(e){
const mac_addrs = document.getElementsByClassName('mac_addr');