mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-22 22:44:24 -04:00
fix: guard against empty auth_relay producing double && in zms URLs
When auth is disabled or auth_relay is empty, appending '&'+auth_relay produces a trailing '&' which results in double '&&' when the next parameter is appended (e.g. ?monitor=2&&scale=41&mode=single). Guard all 4 places in MonitorStream.js where auth_relay is concatenated into URLs, consistent with EventStream.js which already guards this. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
7c08e3157b
commit
692b77b4da
1 file changed
+6
-6
@@ -188,7 +188,7 @@ function MonitorStream(monitorData) {
|
||||
this.show = function() {
|
||||
const stream = this.getElement();
|
||||
if (!stream.src) {
|
||||
stream.src = this.url_to_zms+"&mode=single&scale="+this.scale+"&connkey="+this.connKey+'&'+auth_relay;
|
||||
stream.src = this.url_to_zms+"&mode=single&scale="+this.scale+"&connkey="+this.connKey+(auth_relay?'&'+auth_relay:'');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -605,9 +605,9 @@ function MonitorStream(monitorData) {
|
||||
this.streamCommand(CMD_PLAY);
|
||||
} else {
|
||||
let src = this.url_to_zms.replace(/mode=single/i, 'mode=jpeg');
|
||||
if (-1 == src.search('auth')) {
|
||||
if (-1 == src.search('auth') && auth_relay) {
|
||||
src += '&'+auth_relay;
|
||||
} else {
|
||||
} else if (-1 != src.search('auth')) {
|
||||
src = src.replace(/auth=\w+/i, 'auth='+auth_hash);
|
||||
}
|
||||
if (-1 == src.search('connkey')) {
|
||||
@@ -647,9 +647,9 @@ function MonitorStream(monitorData) {
|
||||
if (!imgInfoBlock) return null;
|
||||
|
||||
let src = this.url_to_zms.replace(/mode=jpeg/i, 'mode=single');
|
||||
if (-1 == src.search('auth')) {
|
||||
if (-1 == src.search('auth') && auth_relay) {
|
||||
src += '&'+auth_relay;
|
||||
} else {
|
||||
} else if (-1 != src.search('auth')) {
|
||||
src = src.replace(/auth=\w+/i, 'auth='+auth_hash);
|
||||
}
|
||||
if (-1 == src.search('scale=')) {
|
||||
@@ -1601,7 +1601,7 @@ function MonitorStream(monitorData) {
|
||||
}; // this.getStatusCmdResponse
|
||||
|
||||
this.statusCmdQuery = function() {
|
||||
$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)
|
||||
$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?'&'+auth_relay:''))
|
||||
.done(this.getStatusCmdResponse.bind(this))
|
||||
.fail(logAjaxFail);
|
||||
|
||||
|
||||
Reference in new issue
Block a user