Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions motioneye/handlers/picture.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ async def list(self, camera_id):
raise HTTPError(400, 'unknown operation')

async def frame(self, camera_id):
self.set_header('Cache-Control', 'private, no-store, must-revalidate')

camera_config = config.get_camera(camera_id)

if (
Expand Down
4 changes: 4 additions & 0 deletions motioneye/static/js/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ function refreshCameraFrame() {

if (cameraFrame.proto == 'mjpeg') {
/* no manual refresh for simple mjpeg cameras */
if (!cameraFrame.url) {
return; /* the stream URL is withheld until login */
}

var url = cameraFrame.url.replace('127.0.0.1', window.location.host.split(':')[0]);
url += (url.indexOf('?') > 0 ? '&' : '?') + '_=' + new Date().getTime();
img.src = url;
Expand Down
4 changes: 4 additions & 0 deletions motioneye/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5494,6 +5494,10 @@ function doAuth() {
if (!frame) {
fetchCurrentConfig(endProgress);
}
else if (!currentUser && $('div.camera-frame').attr('proto') == 'mjpeg') {
/* for an mjpeg camera we reload after login, so the URL is fetched */
window.location.reload();
}
} else {
// Session invalid, show login dialog
runLoginDialog(function () {
Expand Down
2 changes: 1 addition & 1 deletion motioneye/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@
{% else %}
<div class="camera-frame" id="camera{{camera_id}}"
streaming_framerate="{{camera_config['stream_maxrate']}}" streaming_server_resize="{{camera_config['@webcam_server_resize']|string|lower}}"
proto="{{camera_config['@proto']}}" url="{{camera_config['@url']}}">
proto="{{camera_config['@proto']}}" url="{% if current_user %}{{camera_config['@url']}}{% endif %}">
<div class="camera-container">
<div class="camera-placeholder"><img class="no-camera" src="{{static_path}}img/no-camera.svg"></div>
<img class="camera">
Expand Down
Loading