From a291f90a0786d2a2c50c242d2192057fa0bf1cd7 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Tue, 14 Jul 2015 21:51:05 +0300 Subject: [PATCH] fixed bug when using a localhost simple mjpeg url --- static/js/frame.js | 2 +- static/js/main.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/frame.js b/static/js/frame.js index 0a91165..276e100 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 */ - var url = cameraFrame.url.replace('127.0.0.1', window.location.host); + var url = cameraFrame.url.replace('127.0.0.1', window.location.host.split(':')[0]); url += (url.indexOf('?') > 0 ? '&' : '?') + '_=' + new Date().getTime(); img.src = url; return; diff --git a/static/js/main.js b/static/js/main.js index d54264d..3709a5e 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1556,7 +1556,7 @@ function dict2CameraUi(dict) { if (dict['proto'] == 'mjpeg') { mjpgUrl = dict['url']; - mjpgUrl = mjpgUrl.replace('127.0.0.1', window.location.host); + mjpgUrl = mjpgUrl.replace('127.0.0.1', window.location.host.split(':')[0]); embedUrl = cameraUrl + 'frame/'; } else { @@ -3784,7 +3784,7 @@ function refreshCameraFrames() { if (!this.img) { this.img = $(this).find('img.camera')[0]; if (this.config['proto'] == 'mjpeg') { - var url = this.config['url'].replace('127.0.0.1', window.location.host); + var url = this.config['url'].replace('127.0.0.1', window.location.host.split(':')[0]); url += (url.indexOf('?') > 0 ? '&' : '?') + '_=' + new Date().getTime(); this.img.src = url; } -- 2.39.5