fix(hls): scope cookie name per-asset to prevent multi-video 403s

When a lesson has two or more uploaded videos each calls mintHlsCookie,
but all wrote to the same `cio_hls` cookie name. The last write won,
leaving every other video with a mismatched token and a 403 from the
CF Worker.

Cookie name is now `cio_hls_${assetId}` so each video owns its own
cookie. The tenant-router Worker, the Hono HLS fallback route, and the
transcripts route all read the per-asset name.
This commit is contained in:
Rotimi Best
2026-06-29 02:09:50 +01:00
parent a41cc38b7b
commit 513ab5e81f
4 changed files with 4 additions and 4 deletions
@@ -70,7 +70,7 @@ export const transcriptsRouter = new Hono()
if (!asset) return withCors(null, 404);
let authorized = false;
const token = getCookie(c, HLS_COOKIE_NAME);
const token = getCookie(c, `${HLS_COOKIE_NAME}_${assetId}`);
if (token) {
const verified = await verifyHlsToken(token);
if (verified?.assetId === assetId) authorized = true;