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['fps'] = sprintf( "%.2f", $data['fps'] );
|
||||
$data['rate'] /= RATE_BASE;
|
||||
$data['delay'] = sprintf( "%.2f", $data['delay'] );
|
||||
$data['zoom'] = sprintf( "%.1f", $data['zoom']/SCALE_BASE );
|
||||
$data['delay'] = round( $data['delay'], 2 );
|
||||
$data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 );
|
||||
$data['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS );
|
||||
ajaxResponse( array( 'status'=>$data ) );
|
||||
break;
|
||||
}
|
||||
|
@ -116,7 +117,8 @@ switch ( $data['type'] )
|
|||
$data = unpack( "ltype/ievent/iprogress/irate/izoom/Cpaused", $msg );
|
||||
//$data['progress'] = sprintf( "%.2f", $data['progress'] );
|
||||
$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 ) );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,13 @@ function getCmdResponse( respObj, respText )
|
|||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,12 @@ function Monitor( index, monitorData )
|
|||
$('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
|
||||
{
|
||||
|
|
|
@ -209,6 +209,12 @@ function getStreamCmdResponse( respObj, respText )
|
|||
}
|
||||
$('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 {
|
||||
checkStreamForErrors("getStreamCmdResponse",respObj);//log them
|
||||
|
|
Loading…
Reference in New Issue