mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-11-09 15:08:21 +00:00
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
This commit is contained in:
parent
9dc5e756e8
commit
c94a678467
@ -144,7 +144,7 @@ function ini_to_html_free
|
||||
classes=""
|
||||
printf '<div class="ii"><div class="ii_key_DIV">%s</div><div class="ii_value_DIV">' $1
|
||||
select_block $1 $3
|
||||
printf '<input class="ii_value'$classes'" type="text" name="%s" value="%s" default_value="%s" row="%s" /></div>' "row_$3[$1]" $2 $2 $3
|
||||
printf '<input disabled=TRUE class="ii_value'$classes'" type="text" name="%s" value="%s" default_value="%s" row="%s" /></div>' "row_$3[$1]" $2 $2 $3
|
||||
documentation_to_html $1
|
||||
printf '</div>'
|
||||
}
|
||||
@ -164,7 +164,7 @@ echo -ne "</head>"
|
||||
echo -ne '<body ip="'$ipaddr'" mac="'$macaddr'" >'
|
||||
echo -ne "<h1>$title</h1>";
|
||||
|
||||
echo -ne "<div>cam.cgi only lists values in your current configuration file. To add other values, edit manually! </div>"
|
||||
echo -ne "<div>cam.cgi only lists values in your current configuration file. <div style='font-weight:bold;color:red' >To Prevent Bricking This Form is Disabled!</div> </div>"
|
||||
|
||||
if [ "$updated" = true ];
|
||||
then
|
||||
@ -182,7 +182,7 @@ fi
|
||||
|
||||
|
||||
|
||||
echo -ne '<form name="update_config" method="POST" enctype="application/x-www-form-urlencoded" >'
|
||||
echo -ne '<form action="#" onsubmit="return false;" name="update_config" method="POST" enctype="application/x-www-form-urlencoded" >'
|
||||
|
||||
|
||||
CONFIG_BLOCK=0
|
||||
@ -212,9 +212,9 @@ done < $cam_config
|
||||
|
||||
|
||||
|
||||
echo -ne '<input type="submit" name="update" id="update" value="Update" disabled="disabled" />'
|
||||
#echo -ne '<input type="submit" name="update" id="update" value="Update" disabled="disabled" />'
|
||||
echo -ne '</form>'
|
||||
echo -ne '<button onclick="enable_submit();" >Enable Submit</button>';
|
||||
#echo -ne '<button onclick="enable_submit();" >Enable Submit</button>';
|
||||
|
||||
revert_menu $base_hack_ini $cam_config
|
||||
|
||||
|
@ -179,7 +179,7 @@ echo '<script type="text/javascript" src="/feed.js" ></script>'
|
||||
echo -ne "</head>"
|
||||
|
||||
|
||||
echo -ne '<body ip="'$ipaddr'" mac="'$macaddr'" >'
|
||||
echo -ne '<body ip="'$ipaddr'" mac="'$macaddr'" camtype="'$camtype'" >'
|
||||
echo -ne "<h1>$title</h1>";
|
||||
|
||||
|
||||
|
@ -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: ' + '<a href="' + link + '">' + link + '</a>' ;
|
||||
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user