@@ -5,8 +5,6 @@ const streaming = [];
5
5
function MonitorStream ( monitorData ) {
6
6
this . id = monitorData . id ;
7
7
this . connKey = monitorData . connKey ;
8
- this . auth_relay = auth_relay ;
9
- this . auth_hash = auth_hash ;
10
8
this . url = monitorData . url ;
11
9
this . url_to_zms = monitorData . url_to_zms ;
12
10
this . width = monitorData . width ;
@@ -85,7 +83,7 @@ function MonitorStream(monitorData) {
85
83
this . show = function ( ) {
86
84
const stream = this . getElement ( ) ;
87
85
if ( ! stream . src ) {
88
- stream . src = this . url_to_zms + "&mode=single&scale=" + this . scale + "&connkey=" + this . connKey + this . auth_relay ;
86
+ stream . src = this . url_to_zms + "&mode=single&scale=" + this . scale + "&connkey=" + this . connKey + '&' + auth_relay ;
89
87
}
90
88
} ;
91
89
@@ -311,7 +309,7 @@ function MonitorStream(monitorData) {
311
309
stream . setAttribute ( 'loading' , 'eager' ) ;
312
310
}
313
311
let src = stream . src . replace ( / m o d e = s i n g l e / i, 'mode=jpeg' ) ;
314
- src = src . replace ( / a u t h = \w + / i, 'auth=' + this . auth_hash ) ;
312
+ src = src . replace ( / a u t h = \w + / i, 'auth=' + auth_hash ) ;
315
313
if ( - 1 == src . search ( 'connkey' ) ) {
316
314
src += '&connkey=' + this . connKey ;
317
315
}
@@ -650,10 +648,11 @@ function MonitorStream(monitorData) {
650
648
} // end if canEdit.Monitors
651
649
652
650
if ( this . status . auth ) {
653
- if ( this . status . auth != this . auth_hash ) {
651
+ if ( this . status . auth != auth_hash ) {
654
652
// Don't reload the stream because it causes annoying flickering. Wait until the stream breaks.
655
- console . log ( "Changed auth from " + this . auth_hash + " to " + this . status . auth ) ;
656
- this . streamCmdParms . auth = auth_hash = this . auth_hash = this . status . auth ;
653
+ console . log ( "Changed auth from " + auth_hash + " to " + this . status . auth ) ;
654
+ auth_hash = this . status . auth ;
655
+ auth_relay = this . status . auth_relay ;
657
656
}
658
657
} // end if have a new auth hash
659
658
} // end if has state
@@ -663,7 +662,7 @@ function MonitorStream(monitorData) {
663
662
if ( stream . src ) {
664
663
console . log ( 'Reloading stream: ' + stream . src ) ;
665
664
let src = stream . src . replace ( / r a n d = \d + / i, 'rand=' + Math . floor ( ( Math . random ( ) * 1000000 ) ) ) ;
666
- src = src . replace ( / a u t h = \w + / i, 'auth=' + this . auth_hash ) ;
665
+ src = src . replace ( / a u t h = \w + / i, 'auth=' + auth_hash ) ;
667
666
// Maybe updated auth
668
667
if ( src != stream . src ) {
669
668
stream . src = '' ;
@@ -756,20 +755,20 @@ function MonitorStream(monitorData) {
756
755
this . setAlarmState ( monitorStatus ) ;
757
756
758
757
if ( respObj . auth_hash ) {
759
- if ( this . auth_hash != respObj . auth_hash ) {
758
+ if ( auth_hash != respObj . auth_hash ) {
760
759
// Don't reload the stream because it causes annoying flickering. Wait until the stream breaks.
761
- console . log ( "Changed auth from " + this . auth_hash + " to " + respObj . auth_hash ) ;
762
- this . streamCmdParms . auth = this . auth_hash = respObj . auth_hash ;
763
- this . auth_relay = respObj . auth_relay ;
760
+ console . log ( "Changed auth from " + auth_hash + " to " + respObj . auth_hash ) ;
761
+ auth_hash = respObj . auth_hash ;
762
+ auth_relay = respObj . auth_relay ;
764
763
}
765
764
} // end if have a new auth hash
766
765
} else {
767
766
checkStreamForErrors ( 'getStatusCmdResponse' , respObj ) ;
768
767
}
769
768
} ; // this.getStatusCmdResponse
770
769
771
- this . statusCmdQuery = function ( ) {
772
- $j . getJSON ( this . url + '?view=request&request=status&entity=monitor&element[]=Status&element[]=CaptureFPS&element[]=AnalysisFPS&element[]=Analysing&element[]=Recording&id=' + this . id + '&' + this . auth_relay )
770
+ this . statusCmdQuery = function ( ) {
771
+ $j . getJSON ( this . url + '?view=request&request=status&entity=monitor&element[]=Status&element[]=CaptureFPS&element[]=AnalysisFPS&element[]=Analysing&element[]=Recording&id=' + this . id + '&' + auth_relay )
773
772
. done ( this . getStatusCmdResponse . bind ( this ) )
774
773
. fail ( logAjaxFail ) ;
775
774
} ;
@@ -805,7 +804,7 @@ function MonitorStream(monitorData) {
805
804
806
805
this . alarmCommand = function ( command ) {
807
806
if ( this . ajaxQueue ) {
808
- console . log ( " Aborting in progress ajax for alarm" ) ;
807
+ console . log ( ' Aborting in progress ajax for alarm' ) ;
809
808
// Doing this for responsiveness, but we could be aborting something important. Need smarter logic
810
809
this . ajaxQueue . abort ( ) ;
811
810
}
@@ -818,7 +817,7 @@ function MonitorStream(monitorData) {
818
817
url : this . url + ( auth_relay ?'?' + auth_relay :'' ) ,
819
818
xhrFields : { withCredentials : true } ,
820
819
data : alarmCmdParms ,
821
- dataType : " json"
820
+ dataType : ' json'
822
821
} )
823
822
. done ( this . getStreamCmdResponse . bind ( this ) )
824
823
. fail ( this . onFailure . bind ( this ) ) ;
@@ -832,7 +831,7 @@ function MonitorStream(monitorData) {
832
831
url : this . url + ( auth_relay ?'?' + auth_relay :'' ) ,
833
832
xhrFields : { withCredentials : true } ,
834
833
data : streamCmdParms ,
835
- dataType : " json"
834
+ dataType : ' json'
836
835
} )
837
836
. done ( this . getStreamCmdResponse . bind ( this ) )
838
837
. fail ( this . onFailure . bind ( this ) ) ;
0 commit comments