Skip to content

withhold MJPEG stream URLs until authentication - #3405

Open
Marijn0 wants to merge 1 commit into
motioneye-project:devfrom
Marijn0:fix/unauthenticated-MJPEG-camera-stream-URL
Open

withhold MJPEG stream URLs until authentication#3405
Marijn0 wants to merge 1 commit into
motioneye-project:devfrom
Marijn0:fix/unauthenticated-MJPEG-camera-stream-URL

Conversation

@Marijn0

@Marijn0 Marijn0 commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator
  • main.html uses a Jinja if condition to render the URL only for authenticated users
  • doAuth() reloads the frame page after login, so the stream starts without a manual refresh
  • refreshCameraFrame() skips the refresh while the URL is empty
  • frame() marks its response uncacheable

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces information exposure by withholding MJPEG stream URLs from the rendered HTML until a user is authenticated, and ensures the stream starts automatically after login (especially for embedded frame/ pages).

Changes:

  • Conditionally render the MJPEG stream url attribute in main.html only when current_user is set.
  • Reload the frame page after successful login when it was initially rendered anonymously (so the stream URL becomes available without manual refresh).
  • Skip MJPEG refresh attempts when the stream URL is empty, and mark the frame() HTML response as uncacheable.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
motioneye/templates/main.html Withholds the url attribute value for MJPEG frames unless current_user is present.
motioneye/static/js/main.js Reloads the frame view after login when it was initially rendered without an authenticated user context.
motioneye/static/js/frame.js Avoids attempting MJPEG refresh when the withheld URL is empty.
motioneye/handlers/picture.py Adds cache-control headers to prevent cached anonymous frame() HTML from being reused after login.

Comment thread motioneye/handlers/picture.py
@Marijn0
Marijn0 requested review from MichaIng and zagrim August 1, 2026 16:51
@Marijn0
Marijn0 force-pushed the fix/unauthenticated-MJPEG-camera-stream-URL branch from 4bea979 to d19062e Compare August 2, 2026 17:56
- main.html uses a Jinja if condition to render the URL only for authenticated users
- doAuth() reloads the frame page after login, so the stream starts
  without a manual refresh
- refreshCameraFrame() skips the refresh while the URL is empty
- frame() marks its response uncacheable
@Marijn0
Marijn0 force-pushed the fix/unauthenticated-MJPEG-camera-stream-URL branch from d19062e to 1c67782 Compare August 18, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants