feat(remote): license each track locally with --cdm-only over remote

This commit is contained in:
imSp4rky
2026-11-25 12:31:44 -07:00
parent 65e9d1a8c5
commit 0fca1c5ea3
23 changed files with 758 additions and 31 deletions
+15 -1
View File
@@ -472,7 +472,7 @@ Make a download job. It requires `service` and `title_id`. Every other field is
| `skip_dl` | boolean | `false` | Only fetch keys, do not download. |
| `all_drm` | boolean | `false` | License each track with both Widevine and PlayReady. Needs a CDM for each DRM system. Key vaults are read first; `cdm_only: true` sends a challenge for each system. The server refuses it with `cdm`, which selects one device. |
| `export` | boolean | `false` | Export manifest/keys/subs to JSON. |
| `cdm_only` | boolean | `null` | Force CDM-only (`true`) or vault-only (`false`) key retrieval. |
| `cdm_only` | boolean | `null` | Force CDM-only (`true`) or vault-only (`false`) key retrieval. With `remote`, `true` licenses every track with the CDM of this server and uses no CDM or vault of the remote server. |
| `proxy` / `no_proxy` / `no_proxy_download` / `proxy_download` | string / bool / bool / string | `null` / `false` / `false` / `null` | Proxy controls. `proxy` and `proxy_download` must be full proxy URIs on a public host unless the API key has `server_proxy`. A Control D resolver, `controld://<resolver>@dns.controld.com`, counts as a full proxy URI: the server runs a forwarder for it. |
| `no_folder` / `no_source` / `no_mux` | boolean | `false` | Output/mux controls. |
| `sample` | boolean/string | `null` | Download a short sample and write it with a `SAMPLE` tag on the filename in a `Sample` folder inside the output folder. `true` is 60 seconds from 2 minutes in; `"0-60"` is a window in seconds. |
@@ -956,6 +956,7 @@ POST /api/session/{id}/segments → resolve segment URLs / DRM / headers per tra
POST /api/session/{id}/segment_filter → HLS segments the service drops (ads, bumpers)
POST /api/session/{id}/samples → decrypt cbcs samples of a track on the server
POST /api/session/{id}/license → proxy or server-CDM DRM licensing
POST /api/session/{id}/keys → store the content keys the client proved on a track
POST /api/session/{id}/keys/bad → report a server-vault content key that did not decrypt
DELETE /api/session/{id} → tear down, harvest updated cache
```
@@ -1245,6 +1246,19 @@ A slow answer arrives as a [slow response](#slow-responses).
| `404` | `NO_CONTENT` | Server CDM produced no keys. |
| `422` | `SERVICE_ERROR` | The service aborted during licensing. |
### `POST /api/session/{session_id}/keys`
Store the content keys that the client proved on a track and that the server did not serve to this remote session. The server stores a content key only for a KID that a track of the remote session names and that no local server vault holds a content key for. It never stores a pair flagged bad, and it never removes a flag. The server answers when its local vaults hold the pairs, and sends them to its other vaults after the answer. The client sends each key of a licence when the licence returns, and each vault key after its decode check passes.
```json
{ "track_id": "<track_id>", "keys": { "<kid_hex>": "<key_hex>" } }
```
| Status | Error code | Meaning |
| --- | --- | --- |
| `200` | - | `{}`, whatever the server stored. |
| `404` | `SESSION_NOT_FOUND` | Unknown remote session. |
### `POST /api/session/{session_id}/keys/bad`
Report a content key from `vault_keys` that did not decrypt the track. The server flags the pair in its local vaults and reports it to the vault that served it, and the next licence for that KID reaches the CDM. When the CDM returns the same pair, the server removes the flag. The client never learns the server vault names.
+1
View File
@@ -207,6 +207,7 @@ request and response in full.
| `POST` | `/api/session/{session_id}/segment_filter` | Server-side HLS segment filter results for one track. |
| `POST` | `/api/session/{session_id}/samples` | Server-side cbcs sample decryption for one track. |
| `POST` | `/api/session/{session_id}/license` | Proxy or server-side DRM licensing. |
| `POST` | `/api/session/{session_id}/keys` | Store the content keys the client proved on a track. |
| `POST` | `/api/session/{session_id}/keys/bad` | Report a server-vault content key that did not decrypt. |
| `GET` | `/api/session/{session_id}/channel` | WebSocket of the remote session channel: prompts, CDM calls, logs, login state. |
| `GET` | `/api/session/{session_id}/logs` | Drain the service's server-side log output. |
+1
View File
@@ -461,6 +461,7 @@ The server mounts all these routes, even in `--remote-only` mode. Paths use the
| `POST` | `/api/session/{id}/segment_filter` | Unwanted HLS segment URIs for one track (ads, bumpers) |
| `POST` | `/api/session/{id}/samples` | Decrypt the cbcs samples of a track the service decrypts itself |
| `POST` | `/api/session/{id}/license` | DRM licensing (proxy or server CDM) |
| `POST` | `/api/session/{id}/keys` | Store the content keys the client proved on a track |
| `POST` | `/api/session/{id}/keys/bad` | Report a server-vault content key that did not decrypt |
| `GET` | `/api/session/{id}/channel` | WebSocket of the [remote session channel](#the-remote-session-channel): the messages the server starts, and the client's answers; `?since=` is the last log `seq` the client has |
| `GET` | `/api/session/{id}/logs` | Drain the service's server-side log output (polling fallback) |
+1 -1
View File
@@ -962,7 +962,7 @@ unshackle dl -w S01 --slow 30-60 EXAMPLE 81234567
By default, unshackle checks your **key vaults** first and only asks a **CDM** to license
a content key when the vault misses. You can force one side or the other:
- `--cdm-only`: only use the CDM (skip vaults). Over a `server_cdm` remote session the flag does not reach the server, whose vault shortcut still runs; it only skips the client's decode check on a server key.
- `--cdm-only`: only use the CDM (skip vaults). Over `--remote`, your own CDM licenses each track, and the run uses neither the server CDM nor the server vault. It needs a local CDM, and a remote session on the server's device fails.
- `--cdm <name>`: use the named CDM device for this run, ignoring the `cdm` config mapping (including its quality and Widevine/PlayReady sub-entries). Over `--remote`, that device licenses the remote session, not the server CDM.
- `--vaults-only`: only use key vaults and never license through the CDM. A missing
content key fails.
+1 -1
View File
@@ -545,7 +545,7 @@ control this trade-off on the `dl` command:
| Flag | Effect |
|------|--------|
| `--vaults-only` | Never send a license request; use only cached/vault keys. Fails if a content key is missing. |
| `--cdm-only` | Ignore vaults for sourcing keys and always perform a fresh license request. Over a `server_cdm` remote session the server still reads its own vaults; the flag only skips the client's decode check on the key it gets back. |
| `--cdm-only` | Ignore vaults for sourcing keys and always perform a fresh license request. Over `--remote`, your own CDM licenses each track, and the run uses neither the server CDM nor the server vault. A remote session on the server's device fails, and so does a run with no local CDM. |
| `--cdm <name>` | Use the named CDM device for this run instead of the one the `cdm` config maps for the service. Over `--remote`, that device licenses the remote session, not the server CDM. |
See [key vaults](vaults.md) for how to configure vault backends.