Skip to content

feat(videowidget): send Authorization header on raw-socket MJPEG stream - #142

Open
thusser wants to merge 1 commit into
developfrom
feat/basevideo-http-token-auth
Open

feat(videowidget): send Authorization header on raw-socket MJPEG stream#142
thusser wants to merge 1 commit into
developfrom
feat/basevideo-http-token-auth

Conversation

@thusser

@thusser thusser commented Aug 22, 2026

Copy link
Copy Markdown
Member

pyobs-gui half of specs/plans/2026-08-21-basevideo-http-token-auth.md (indexed in this repo at specs/).

What

VideoWidget opens the MJPEG video URL as an HttpFile in _init, but streams it over a raw QTcpSocket/QSslSocket with a hand-written GET that currently sends no auth. Once the server side (BaseVideo, pyobs-core PR #799) enforces a shared token, that request gets a 401 which the MJPEG parser never surfaces (it strips response headers and finds no --jpgboundary).

  • _init: after the HttpFile type check, store self._auth_header = video_file.headers.get("Authorization") (None when the VFS root configures no token).
  • _showEvent: append Authorization: <value>\r\n to the raw-socket GET when set; bytes written are unchanged when unset.

Depends on the new public HttpFile.headers property (pyobs-core PR #799).

Tests

tests/test_videowidget.py: with a token the written GET includes Authorization: Bearer <token>; without a token the written bytes are byte-identical to today.

⚠️ Coupling — land both halves together

  • This PR (pyobs-gui): the VideoWidget consumer change.
  • Companion PR pyobs/pyobs-core #799: server-side BaseVideo token/cookie auth + HttpFile.headers.

With token set on a webcam, the GUI live view breaks until this lands — merge both PRs together.

Once BaseVideo (pyobs-core PR #799) enforces a shared token, the live view
dies with a 401 that the MJPEG parser never surfaces. The widget already
opens the video URL as an HttpFile; keep its Authorization header and append
it to the raw-socket GET in _showEvent. Without a token the written bytes
are unchanged.

Companion to pyobs-core feat/basevideo-http-token-auth — land together.

Implements specs/plans/2026-08-21-basevideo-http-token-auth.md (pyobs-gui half).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant