From 13f8d5fcb3261d2ac889ff3896f42d8d39e03e0b Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Wed, 10 Jun 2015 14:27:44 +0300 Subject: [PATCH] localhost (127.0.0.1) simple mjpeg camera URLs are now replaced with the actual IP address --- static/js/frame.js | 2 +- static/js/main.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/static/js/frame.js b/static/js/frame.js index 8620922..81fa55a 100644 --- a/static/js/frame.js +++ b/static/js/frame.js @@ -82,7 +82,7 @@ function refreshCameraFrame() { if (cameraFrame.proto == 'mjpeg') { /* no manual refresh for simple mjpeg cameras */ - img.src = cameraFrame.url; + img.src = cameraFrame.url.replace('127.0.0.1', window.location.host); return; } diff --git a/static/js/main.js b/static/js/main.js index 015e633..05f23e0 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1571,6 +1571,7 @@ function dict2CameraUi(dict) { if (dict['proto'] == 'mjpeg') { mjpgUrl = dict['url']; + mjpgUrl = mjpgUrl.replace('127.0.0.1', window.location.host); embedUrl = cameraUrl + 'frame/'; } else { @@ -1588,7 +1589,7 @@ function dict2CameraUi(dict) { if (snapshotUrl) { snapshotUrl = addAuthParams('GET', snapshotUrl); } - if (mjpgUrl) { + if (mjpgUrl && dict['proto'] != 'mjpeg') { mjpgUrl = addAuthParams('GET', mjpgUrl); } } @@ -3797,7 +3798,7 @@ function refreshCameraFrames() { if (!this.img) { this.img = $(this).find('img.camera')[0]; if (this.config['proto'] == 'mjpeg') { - this.img.src = this.config['url']; + this.img.src = this.config['url'].replace('127.0.0.1', window.location.host); } } -- 2.39.5