mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-01 21:45:10 +00:00
fix(remote): end a remote session from before its create to after its DELETE
This commit is contained in:
@@ -987,7 +987,9 @@ the newlines must go out at once.
|
||||
|
||||
### `POST /api/session/create`
|
||||
|
||||
Make a remote session for a service and title. Authentication runs asynchronously in the background. This call returns immediately with `status: "authenticating"`, and you then poll the prompt endpoint. The body accepts `service` and `title_id` (both required). It also accepts a broad set of optional keys, because the body allows `additionalProperties`. These are `credentials` (`{username, password, extra?}`), `cookies` (base64 of zlib-compressed Netscape cookie file), `proxy`, `no_proxy`, `profile`, `cache` (map of forwarded cache files, keyed by the file path relative to the service cache directory with `/` separators and no `.json` suffix, so a nested key such as `session_web/<sha1>` lands in a subdirectory), `client_region`, `proxy_region`, `cdm_type`, `range_`, `vcodec`, `quality`, `best_available`, `dl_params`, `client`, and any service CLI options. `proxy_region` is the country code the client resolved `proxy` from; the server matches it against its own accounts. `client` is a freeform object the dashboard shows as sent (the CLI puts `version`, `code_hash`, `platform` and a redacted `argv` in it); the server ignores it above 4096 bytes of JSON.
|
||||
Make a remote session for a service and title. Authentication runs asynchronously in the background. This call returns immediately with `status: "authenticating"`, and you then poll the prompt endpoint. The body accepts `service` and `title_id` (both required). It also accepts a broad set of optional keys, because the body allows `additionalProperties`. These are `session_id`, `credentials` (`{username, password, extra?}`), `cookies` (base64 of zlib-compressed Netscape cookie file), `proxy`, `no_proxy`, `profile`, `cache` (map of forwarded cache files, keyed by the file path relative to the service cache directory with `/` separators and no `.json` suffix, so a nested key such as `session_web/<sha1>` lands in a subdirectory), `client_region`, `proxy_region`, `cdm_type`, `range_`, `vcodec`, `quality`, `best_available`, `dl_params`, `client`, and any service CLI options. `proxy_region` is the country code the client resolved `proxy` from; the server matches it against its own accounts. `client` is a freeform object the dashboard shows as sent (the CLI puts `version`, `code_hash`, `platform` and a redacted `argv` in it); the server ignores it above 4096 bytes of JSON.
|
||||
|
||||
`session_id` is the ID that you give the remote session, so that you can delete it before this call answers. It must be the canonical text of a version 4 UUID. Without it, the server makes the ID. A second create with the same ID from the same API key and IP ends the first one if the first one has not answered, and replaces its remote session when the new one is stored. A second create that fails leaves that remote session open.
|
||||
|
||||
`dl_params` is an object with the `dl` track selection: `lang`, `v_lang`, `a_lang` and `s_lang` (arrays of language strings), `acodec` (an array of audio codec names or `dl -a` aliases such as `ddp`), and `forced_subs` and `exact_lang` (booleans). The service reads these values from `ctx.parent.params`. The server uses the `dl` default for each absent value. It refuses a malformed value, an unknown codec, range or vcodec name, and a height of 0 or less with `INVALID_PARAMETERS`. The flat `range_`, `vcodec`, `quality`, `best_available` and `generate_dv` keys are `dl` values on this route. On the list and search routes they are `dl` values only when the body has `service_params`.
|
||||
|
||||
@@ -1011,8 +1013,10 @@ The `proxy` value must be a full proxy URI, unless the operator gives your API k
|
||||
| Status | Error code | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `200` | - | Session created; authentication in progress. |
|
||||
| `400` | `INVALID_INPUT` | Missing `service` or `title_id`. |
|
||||
| `400` | `INVALID_INPUT` | Missing `service` or `title_id`, or a `session_id` that is not the canonical text of a version 4 UUID. |
|
||||
| `400` | `INVALID_PARAMETERS` | Invalid `range_`, `vcodec`, `quality` or `dl_params` value. |
|
||||
| `403` | `FORBIDDEN` | Another API key or another IP has the `session_id`. |
|
||||
| `404` | `SESSION_NOT_FOUND` | A `DELETE` or a newer create with the same `session_id` ended this create. |
|
||||
| `400` | `INVALID_SERVICE` | Unknown or disallowed service. |
|
||||
|
||||
### `GET /api/session/{session_id}/channel`
|
||||
@@ -1307,7 +1311,7 @@ Return remote session metadata and validity.
|
||||
|
||||
### `DELETE /api/session/{session_id}`
|
||||
|
||||
Tear down a remote session. The server cancels its input bridge, harvests any updated cache files, and deletes the remote session and its cache directory.
|
||||
Tear down a remote session. The server cancels its input bridge, harvests any updated cache files, and deletes the remote session and its cache directory. A create of the same API key and IP that still runs under this ID ends too: it makes no remote session and answers `404 SESSION_NOT_FOUND`. If no remote session exists yet, the `DELETE` answers `200` with no `cache`.
|
||||
|
||||
=== "Response `200`"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user