feat(phase-13): HLS auth with visibility and CDN cache - #37
Merged
Conversation
Add video_visibility enum and visibility column (default public) with index, update model/repository/handler to handle create/update and validate visibility, and extend fakeStore for tests.
Protect /hls/* via HLSAuth: private videos require owner access JWT or
1h hls JWT (?token= or X-HLS-Token), public/unlisted pass through.
Add GET /api/v1/videos/{id}/hls-token and set Cache-Control
private,max-age=10 for private, public for others. Fix errcheck.
Bump vod_response_cache 128m->512m and add perf counters, add X-Internal-Token to prod mapping, fix Dockerfile to handle both templates via ENV=prod and update compose prod volume to template.
Add visibility to Video type, getHlsUrl token param, getHlsToken and updateVideo helpers, VideoPlayer xhrSetup sends Authorization and handles token, watch page fetches signed URL for private owner videos and adds visibility selector.
This was referenced Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8
Closes #9
Closes #10
Phase 13 — P1: Доступ к HLS и CDN — реализация по
docs/PLAN.md:208.Summary
?token=1h)visibility: public|private|unlistedвvideos(migration 000002)HLSAuth+GET /api/v1/videos/{id}/hls-token+Cache-Control: private, max-age=10для privatevod_response_cache 128m→512m,perf_counters, фикс prod template сX-Internal-TokengetHlsToken,VideoPlayerотправляетAuthorization, watch page переключатель видимости и signed URLAcceptance criteria
curl /hls/{private}/master.m3u8без токена → 403curl /hls/{private}/master.m3u8?token=<hls>с валидным HLS JWT → 200,Cache-Control: private, max-age=10curl /hls/{public}/master.m3u8без токена → 200GET /api/v1/videos/{id}/hls-tokenowner 200 / other 403PATCH /api/v1/videos/{id}с visibility валидирует enum и владельцаGET /internal/videos/:id/vodчерез internal token (nginx) — без регрессии (adaptive ladder 1..3 renditions сохранён)Verification
make lint-go— 0 issues (metadata/gateway/upload)make lint-front— ✔ No ESLint warningsgo test ./...metadata — ok handlergo test ./...gateway middleware — pass (HLSAuth private/public/token cases)make up && make e2e— не запущено (no docker в CI), риск: полный upload→transcode→hls с private требует ручной проверкиcurl -ICache-ControlRisks
ENV=prod— проверено вDockerfile:35, но нужен реальныйdocker compose -f deploy/docker-compose.yml -f deploy/docker-compose.prod.yml up --buildтестCDN-Cache-Control: privateCommits: