add an auth field to request=stream results to give the client a new auth hash to use
This commit is contained in:
parent
66ae5c52ae
commit
4ce531099c
|
@ -106,8 +106,9 @@ switch ( $data['type'] )
|
||||||
$data = unpack( "ltype/imonitor/istate/dfps/ilevel/irate/ddelay/izoom/Cdelayed/Cpaused/Cenabled/Cforced", $msg );
|
$data = unpack( "ltype/imonitor/istate/dfps/ilevel/irate/ddelay/izoom/Cdelayed/Cpaused/Cenabled/Cforced", $msg );
|
||||||
$data['fps'] = sprintf( "%.2f", $data['fps'] );
|
$data['fps'] = sprintf( "%.2f", $data['fps'] );
|
||||||
$data['rate'] /= RATE_BASE;
|
$data['rate'] /= RATE_BASE;
|
||||||
$data['delay'] = sprintf( "%.2f", $data['delay'] );
|
$data['delay'] = round( $data['delay'], 2 );
|
||||||
$data['zoom'] = sprintf( "%.1f", $data['zoom']/SCALE_BASE );
|
$data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 );
|
||||||
|
$data['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS );
|
||||||
ajaxResponse( array( 'status'=>$data ) );
|
ajaxResponse( array( 'status'=>$data ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +117,8 @@ switch ( $data['type'] )
|
||||||
$data = unpack( "ltype/ievent/iprogress/irate/izoom/Cpaused", $msg );
|
$data = unpack( "ltype/ievent/iprogress/irate/izoom/Cpaused", $msg );
|
||||||
//$data['progress'] = sprintf( "%.2f", $data['progress'] );
|
//$data['progress'] = sprintf( "%.2f", $data['progress'] );
|
||||||
$data['rate'] /= RATE_BASE;
|
$data['rate'] /= RATE_BASE;
|
||||||
$data['zoom'] = sprintf( "%.1f", $data['zoom']/SCALE_BASE );
|
$data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 );
|
||||||
|
$data['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS );
|
||||||
ajaxResponse( array( 'status'=>$data ) );
|
ajaxResponse( array( 'status'=>$data ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,13 @@ function getCmdResponse( respObj, respText )
|
||||||
|
|
||||||
updateProgressBar();
|
updateProgressBar();
|
||||||
|
|
||||||
|
if ( streamStatus.auth ) {
|
||||||
|
// Try to reload the image stream.
|
||||||
|
var streamImg = document.getElementById('evtStream');
|
||||||
|
if ( streamImg )
|
||||||
|
streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth );
|
||||||
|
} // end if haev a new auth hash
|
||||||
|
|
||||||
streamCmdTimer = streamQuery.delay( streamTimeout );
|
streamCmdTimer = streamQuery.delay( streamTimeout );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,12 @@ function Monitor( index, monitorData )
|
||||||
$('alarmSound').addClass( 'hidden' );
|
$('alarmSound').addClass( 'hidden' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( this.status.auth ) {
|
||||||
|
// Try to reload the image stream.
|
||||||
|
if ( stream )
|
||||||
|
stream.src = stream.src.replace( /auth=\w+/i, 'auth='+this.status.auth );
|
||||||
|
console.log("Changed auth to " + this.status.auth );
|
||||||
|
} // end if haev a new auth hash
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,6 +209,12 @@ function getStreamCmdResponse( respObj, respText )
|
||||||
}
|
}
|
||||||
$('enableDisableAlarms').removeClass( 'hidden' );
|
$('enableDisableAlarms').removeClass( 'hidden' );
|
||||||
}
|
}
|
||||||
|
if ( streamStatus.auth ) {
|
||||||
|
// Try to reload the image stream.
|
||||||
|
var streamImg = document.getElementById('liveStream');
|
||||||
|
if ( streamImg )
|
||||||
|
streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth );
|
||||||
|
} // end if haev a new auth hash
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
checkStreamForErrors("getStreamCmdResponse",respObj);//log them
|
checkStreamForErrors("getStreamCmdResponse",respObj);//log them
|
||||||
|
|
Loading…
Reference in New Issue