fix(api): redact error replies, lock segment url lookups, refuse unresolvable proxy hosts and recheck job proxies at start

This commit is contained in:
imSp4rky
2026-11-28 21:33:00 -07:00
parent 7713f8df3f
commit 0a791ad6e8
15 changed files with 348 additions and 20 deletions
+4 -3
View File
@@ -482,6 +482,7 @@ Make a download job. It requires `service` and `title_id`. Every other field is
| `workers` | int | `null` | Threads per track. |
| `adaptive_workers` | boolean | `false` | Scale segment workers to measured CDN throughput, up to the `workers` cap. |
| `download_processes` | int | `1` | Split a track's segments across this many processes. Only engages for large batches. |
| `continue_downloads` | boolean | `false` | Keep the completed segment files across runs and resume a download that failed before. |
| `downloads` | int | `1` | Concurrent tracks. |
| `worst` | boolean | `false` | Pick the lowest-bitrate video at each resolution in `quality`, or at the lowest resolution if `quality` is empty. |
| `best_available` | boolean | `false` | Fall back to best available. With `all_drm`, a DRM system that does not license is a warning. |
@@ -972,7 +973,7 @@ DELETE /api/session/{id} → tear down, harvest updated cache
### Slow responses
The `titles`, `tracks` and `license` routes can take minutes on a large catalogue. When the
The `titles`, `tracks`, `segments` and `license` routes can take minutes on a large catalogue. When the
answer is not ready after 30 seconds, the route sends status `200` and the headers. It then
sends a newline every 30 seconds until the JSON body is ready. JSON parsers ignore the leading
newlines. This keeps the connection open through a reverse proxy that closes an idle request.
@@ -994,7 +995,7 @@ Make a remote session for a service and title. Authentication runs asynchronousl
Service CLI options also travel in a nested `service_params` object. When the body has `service_params`, the server reads service options only from it, and a flat key with the same name stays a `dl` value. `profile` at the top level always means the credentials profile, never a service's own `--profile` option.
The `proxy` value must be a full proxy URI, unless the operator gives your API key `server_proxy` in the `serve.users` config. Without `server_proxy`, a proxy URI gets `INVALID_PROXY` when its host is not a public address or is not a plain host name or IP address. Without `server_proxy`, the server does not resolve country codes with its own proxy providers. It rejects the request with `INVALID_PROXY` when no `proxy` is set and the reported `client_region` differs from the server's region. A request that reports no `client_region` is not blocked. Pass `proxy` with your own proxy, or `no_proxy` to accept the server's own connection. With `server_proxy`, the server resolves a country code and picks a proxy for your `client_region` itself. A Control D resolver, `controld://<resolver>@dns.controld.com`, counts as a full proxy URI: the server runs a forwarder for it and needs no Control D configuration of its own. A proxy URI needs an `http`, `https` or `socks` scheme: the server answers `INVALID_PROXY` to a `host:port` value, also with `server_proxy`.
The `proxy` value must be a full proxy URI, unless the operator gives your API key `server_proxy` in the `serve.users` config. Without `server_proxy`, a proxy URI gets `INVALID_PROXY` when its host is not a public address, does not resolve, or is not a plain host name or IP address. Without `server_proxy`, the server does not resolve country codes with its own proxy providers. It rejects the request with `INVALID_PROXY` when no `proxy` is set and the reported `client_region` differs from the server's region. A request that reports no `client_region` is not blocked. Pass `proxy` with your own proxy, or `no_proxy` to accept the server's own connection. With `server_proxy`, the server resolves a country code and picks a proxy for your `client_region` itself. A Control D resolver, `controld://<resolver>@dns.controld.com`, counts as a full proxy URI: the server runs a forwarder for it and needs no Control D configuration of its own. A proxy URI needs an `http`, `https` or `socks` scheme: the server answers `INVALID_PROXY` to a `host:port` value, also with `server_proxy`.
=== "Response `200`"
@@ -1149,7 +1150,7 @@ Get tracks and chapters for a specific title within the remote session. Body: `{
### `POST /api/session/{session_id}/segments`
Get the download URL, DRM info, headers, cookies, and raw track data for the selected tracks. Body: `{ "track_ids": ["v-1", "a-1"] }` (required).
Get the download URL, DRM info, headers, cookies, and raw track data for the selected tracks. Body: `{ "track_ids": ["v-1", "a-1"] }` (required). A track that the tracks response sent with `resolve_url` gets its URL from the service here. The server makes one service call at a time per remote session, so parallel requests wait for each other. A slow answer arrives as described in [Slow responses](#slow-responses).
=== "Response `200`"
+8 -4
View File
@@ -362,10 +362,14 @@ pick a proxy for the client's region and for a service geofence. The client repo
region; a client that reports none is not blocked.
Without `server_proxy`, the server refuses a proxy URI whose host is not a public address:
loopback, private, link-local and other special-purpose addresses, and `localhost`. This also
applies to a server on a LAN, so a client proxy on that LAN needs `server_proxy` or an admin key.
The server checks the proxy values the job uses, including a `proxy` default from the server's
own config.
loopback, private, link-local and other special-purpose addresses, and `localhost`. It also
refuses a host name that does not resolve. This also applies to a server on a LAN, so a client
proxy on that LAN needs `server_proxy` or an admin key. The server checks the proxy values the
job uses, including a `proxy` default from the server's own config, when you submit the job and
again when the job starts. A job whose proxy host does not resolve at that time fails with
`INVALID_PROXY`; submit it again. The checks read the DNS answer at that time only, so a host
name that a client controls can still answer another address when the server connects. Give
`server_proxy` only to API keys you trust with your network.
```yaml
serve: