From 1af920eb6312a6e5fc656a0ae1d6eb489098e0fe Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Thu, 23 Jul 2026 20:12:22 +0200 Subject: [PATCH] feat: share videos to TV (Chromecast + AirPlay) (#33) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * server: add scoped media-token endpoint for Cast/AirPlay auth bypass Chromecast and Apple TV fetch media URLs as independent HTTP clients with no session cookie. The existing serve_artifact handler requires auth_user.require_auth(), so those devices always received 401. Changes: - MediaToken struct stored in AppState (Arc>), scoped to a single (archive_id, entry_uid, artifact_index) tuple with a 2-hour TTL - POST /api/archives/:id/entries/:uid/artifacts/:idx/media-token requires an authenticated session, verifies the artifact exists, prunes expired tokens, mints a 43-char URL-safe token, and returns { url, expires_in_secs } - serve_artifact now accepts an optional ?token= query param; a valid scoped token bypasses require_auth() while a missing/invalid/expired token falls through to the normal 401 path - CSP script-src extended to include https://www.gstatic.com so the Cast sender SDK script (injected lazily by VideoPreview) is not blocked - 4 new tests: bare-URL still 401, tokenized fetch succeeds without session cookie, bogus token 401, wrong-artifact-index 401 * frontend: Cast/AirPlay overlay in VideoPreview When the user opens a video archive entry, VideoPreview now: 1. Issues a signed media token (POST .../artifacts/:idx/media-token) and uses the returned signed URL as