mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-01 21:45:10 +00:00
Deployed 6e99812e with MkDocs version: 1.6.1
This commit is contained in:
@@ -3135,7 +3135,7 @@
|
||||
<li><strong>CORS.</strong> Every response carries permissive CORS headers, and the server answers <code>OPTIONS</code> preflight requests automatically.</li>
|
||||
<li><strong>Compression.</strong> JSON responses of 256 bytes or more are gzip-compressed when the client sends <code>Accept-Encoding: gzip</code>. A <a href="#slow-responses">slow response</a> is not compressed.</li>
|
||||
<li><strong>Service allowlist.</strong> The effective allowlist for your API key filters the service-facing endpoints (the intersection of the global <code>serve.services</code> list and your per-key list). The server treats services you cannot use as unknown.</li>
|
||||
<li><strong>Remote services.</strong> A full-mode server can run a service through one of its own <code>remote_services</code> servers (see <a href="../remote-sessions/">Remote sessions</a>). <code>GET /api/config</code> lists their names in <code>remote_services</code>, and <code>GET /api/services?remote=<name></code> lists that server's services, each with <code>remote</code> set to the name. Add <code>"remote": "<name>"</code> to <code>POST /api/search</code>, <code>/api/list-titles</code>, <code>/api/list-tracks</code> or <code>/api/download</code>, and the server opens a remote session with its own key for that server: the remote logs in and resolves titles, tracks and licences, and a download still runs, decrypts and muxes here. The tag may be any case or an alias, and your allowlist applies to it. An unknown name is <code>400 INVALID_PARAMETERS</code>, a server that does not answer is <code>SERVICE_UNAVAILABLE</code>, and a tag it does not offer is <code>INVALID_SERVICE</code>. List calls from the same API key for the same title, profile, proxy, client region and service options share one remote session, which closes after 120 seconds unused. An optional <code>client_name</code> names your client on the remote server's dashboard as <code>serve (<client_name>)</code>. A relayed search opens no remote session. The server sends its own credentials, cookies and cache for the <code>profile</code> with the search. A service that searches with no login gets none of them. A <code>--remote-only</code> server does not relay. A remote login that waits on you (a pair code or URL to approve on another device) cannot answer through a list call, so poll <code>GET /api/remote/logins</code> alongside it: each entry carries the login's <code>notice</code>, its <code>qr</code> (the text of a QR code to scan, or null), and its <code>prompt</code> when it asks a question (an OTP), which you answer with <code>POST /api/remote/logins/{id}/input</code> and <code>{"response": "..."}</code>. A remote download job shows the same text as its own <code>notice</code>, and asks a question (an OTP) through <code>input_prompt</code> as a local job does.</li>
|
||||
<li><strong>Remote services.</strong> A full-mode server can run a service through one of its own <code>remote_services</code> servers (see <a href="../remote-sessions/">Remote sessions</a>). <code>GET /api/config</code> lists their names in <code>remote_services</code>, and <code>GET /api/services?remote=<name></code> lists that server's services, each with <code>remote</code> set to the name. Add <code>"remote": "<name>"</code> to <code>POST /api/search</code>, <code>/api/list-titles</code>, <code>/api/list-tracks</code> or <code>/api/download</code>, and the server opens a remote session with its own key for that server: the remote logs in and resolves titles, tracks and licences, and a download still runs, decrypts and muxes here. The tag may be any case or an alias, and your allowlist applies to it. An unknown name is <code>400 INVALID_PARAMETERS</code>, a server that does not answer is <code>SERVICE_UNAVAILABLE</code>, and a tag it does not offer is <code>INVALID_SERVICE</code>. List calls from the same API key for the same title, profile, proxy, client region and service options share one remote session, which closes after 120 seconds unused. When the server stops, a list call that waits on the login of a new remote session, or starts one, gets <code>SERVER_DRAINING</code> (409). A call that opens a lost remote session again can be cut too: <code>list-titles</code> then gets <code>SERVER_DRAINING</code>, and <code>list-tracks</code> that or <code>SERVICE_ERROR</code> (422). An optional <code>client_name</code> names your client on the remote server's dashboard as <code>serve (<client_name>)</code>. A relayed search opens no remote session. The server sends its own credentials, cookies and cache for the <code>profile</code> with the search. A service that searches with no login gets none of them. A <code>--remote-only</code> server does not relay. A remote login that waits on you (a pair code or URL to approve on another device) cannot answer through a list call, so poll <code>GET /api/remote/logins</code> alongside it: each entry carries the login's <code>notice</code>, its <code>qr</code> (the text of a QR code to scan, or null), and its <code>prompt</code> when it asks a question (an OTP), which you answer with <code>POST /api/remote/logins/{id}/input</code> and <code>{"response": "..."}</code>. A remote download job shows the same text as its own <code>notice</code>, and asks a question (an OTP) through <code>input_prompt</code> as a local job does.</li>
|
||||
</ul>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Error responses have two shapes</p>
|
||||
@@ -4968,7 +4968,7 @@ answers the prompt within 10 minutes.</p>
|
||||
<p class="admonition-title">Developer feature</p>
|
||||
<p>The <code>/api/session/*</code> endpoints power unshackle's <strong>remote download</strong> mode. A thin local client authenticates once against a remote server, then fetches titles, tracks, and segments, and proxies DRM licensing back through it. The server mounts these endpoints in <code>--remote-only</code> mode, and they are what the built-in <code>RemoteService</code> client drives. Most end users never call them directly.</p>
|
||||
</div>
|
||||
<p>The server holds remote sessions in memory. They expire after <code>serve.session_ttl</code> (default 300s) without a request, except while the login runs, which can stay idle for the larger of <code>session_ttl</code> and 600s. A remote session binds to the IP that made it, so the server rejects a request from a different IP with <code>403 FORBIDDEN</code>.</p>
|
||||
<p>The server holds remote sessions in memory. They expire after <code>serve.session_ttl</code> (default 300s) without a request, except while the login runs, which can stay idle for the larger of <code>session_ttl</code> and 600s. A remote session whose client is gone ends sooner: see <a href="../remote-sessions/#client-presence">Client presence</a>. A remote session binds to the IP that made it, so the server rejects a request from a different IP with <code>403 FORBIDDEN</code>.</p>
|
||||
<h3 id="remote-session-lifecycle-overview">Remote session lifecycle overview<a class="headerlink" href="#remote-session-lifecycle-overview" title="Permanent link">¶</a></h3>
|
||||
<div class="language-text highlight"><pre><span></span><code><span id="__span-30-1"><a id="__codelineno-30-1" name="__codelineno-30-1" href="#__codelineno-30-1"></a>POST /api/session/create → returns session_id, status "authenticating"
|
||||
</span><span id="__span-30-2"><a id="__codelineno-30-2" name="__codelineno-30-2" href="#__codelineno-30-2"></a>GET /api/session/{id}/channel → WebSocket: prompts, CDM calls, logs, login state, drain
|
||||
@@ -4998,7 +4998,8 @@ Use <code>error_code</code> and <code>retryable</code> to decide what to do.</p>
|
||||
<p>A slow response is not gzip-compressed. Gzip output cannot start before the body is ready, and
|
||||
the newlines must go out at once.</p>
|
||||
<h3 id="post-apisessioncreate"><code>POST /api/session/create</code><a class="headerlink" href="#post-apisessioncreate" title="Permanent link">¶</a></h3>
|
||||
<p>Make a remote session for a service and title. Authentication runs asynchronously in the background. This call returns immediately with <code>status: "authenticating"</code>, and you then poll the prompt endpoint. The body accepts <code>service</code> and <code>title_id</code> (both required). It also accepts a broad set of optional keys, because the body allows <code>additionalProperties</code>. These are <code>credentials</code> (<code>{username, password, extra?}</code>), <code>cookies</code> (base64 of zlib-compressed Netscape cookie file), <code>proxy</code>, <code>no_proxy</code>, <code>profile</code>, <code>cache</code> (map of forwarded cache files, keyed by the file path relative to the service cache directory with <code>/</code> separators and no <code>.json</code> suffix, so a nested key such as <code>session_web/<sha1></code> lands in a subdirectory), <code>client_region</code>, <code>proxy_region</code>, <code>cdm_type</code>, <code>range_</code>, <code>vcodec</code>, <code>quality</code>, <code>best_available</code>, <code>dl_params</code>, <code>client</code>, and any service CLI options. <code>proxy_region</code> is the country code the client resolved <code>proxy</code> from; the server matches it against its own accounts. <code>client</code> is a freeform object the dashboard shows as sent (the CLI puts <code>version</code>, <code>code_hash</code>, <code>platform</code> and a redacted <code>argv</code> in it); the server ignores it above 4096 bytes of JSON.</p>
|
||||
<p>Make a remote session for a service and title. Authentication runs asynchronously in the background. This call returns immediately with <code>status: "authenticating"</code>, and you then poll the prompt endpoint. The body accepts <code>service</code> and <code>title_id</code> (both required). It also accepts a broad set of optional keys, because the body allows <code>additionalProperties</code>. These are <code>session_id</code>, <code>credentials</code> (<code>{username, password, extra?}</code>), <code>cookies</code> (base64 of zlib-compressed Netscape cookie file), <code>proxy</code>, <code>no_proxy</code>, <code>profile</code>, <code>cache</code> (map of forwarded cache files, keyed by the file path relative to the service cache directory with <code>/</code> separators and no <code>.json</code> suffix, so a nested key such as <code>session_web/<sha1></code> lands in a subdirectory), <code>client_region</code>, <code>proxy_region</code>, <code>cdm_type</code>, <code>range_</code>, <code>vcodec</code>, <code>quality</code>, <code>best_available</code>, <code>dl_params</code>, <code>client</code>, and any service CLI options. <code>proxy_region</code> is the country code the client resolved <code>proxy</code> from; the server matches it against its own accounts. <code>client</code> is a freeform object the dashboard shows as sent (the CLI puts <code>version</code>, <code>code_hash</code>, <code>platform</code> and a redacted <code>argv</code> in it); the server ignores it above 4096 bytes of JSON.</p>
|
||||
<p><code>session_id</code> 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 remote session with your ID ends when you send no request for it and open no channel within 150s of the create. 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.</p>
|
||||
<p><code>dl_params</code> is an object with the <code>dl</code> track selection: <code>lang</code>, <code>v_lang</code>, <code>a_lang</code> and <code>s_lang</code> (arrays of language strings), <code>acodec</code> (an array of audio codec names or <code>dl -a</code> aliases such as <code>ddp</code>), and <code>forced_subs</code> and <code>exact_lang</code> (booleans). The service reads these values from <code>ctx.parent.params</code>. The server uses the <code>dl</code> 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 <code>INVALID_PARAMETERS</code>. The flat <code>range_</code>, <code>vcodec</code>, <code>quality</code>, <code>best_available</code> and <code>generate_dv</code> keys are <code>dl</code> values on this route. On the list and search routes they are <code>dl</code> values only when the body has <code>service_params</code>.</p>
|
||||
<p>Service CLI options also travel in a nested <code>service_params</code> object. When the body has <code>service_params</code>, the server reads service options only from it, and a flat key with the same name stays a <code>dl</code> value. <code>profile</code> at the top level always means the credentials profile, never a service's own <code>--profile</code> option.</p>
|
||||
<p>The <code>proxy</code> value must be a full proxy URI, unless the operator gives your API key <code>server_proxy</code> in the <code>serve.users</code> config. Without <code>server_proxy</code>, a proxy URI gets <code>INVALID_PROXY</code> when its host is not a public address, does not resolve, or is not a plain host name or IP address. Without <code>server_proxy</code>, the server does not resolve country codes with its own proxy providers. It rejects the request with <code>INVALID_PROXY</code> when no <code>proxy</code> is set and the reported <code>client_region</code> differs from the server's region. A request that reports no <code>client_region</code> is not blocked. Pass <code>proxy</code> with your own proxy, or <code>no_proxy</code> to accept the server's own connection. With <code>server_proxy</code>, the server resolves a country code and picks a proxy for your <code>client_region</code> itself. A Control D resolver, <code>controld://<resolver>@dns.controld.com</code>, 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 <code>http</code>, <code>https</code> or <code>socks</code> scheme: the server answers <code>INVALID_PROXY</code> to a <code>host:port</code> value, also with <code>server_proxy</code>.</p>
|
||||
@@ -5033,7 +5034,7 @@ the newlines must go out at once.</p>
|
||||
<tr>
|
||||
<td><code>400</code></td>
|
||||
<td><code>INVALID_INPUT</code></td>
|
||||
<td>Missing <code>service</code> or <code>title_id</code>.</td>
|
||||
<td>Missing <code>service</code> or <code>title_id</code>, or a <code>session_id</code> that is not the canonical text of a version 4 UUID.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>400</code></td>
|
||||
@@ -5041,6 +5042,16 @@ the newlines must go out at once.</p>
|
||||
<td>Invalid <code>range_</code>, <code>vcodec</code>, <code>quality</code> or <code>dl_params</code> value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>403</code></td>
|
||||
<td><code>FORBIDDEN</code></td>
|
||||
<td>Another API key or another IP has the <code>session_id</code>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>404</code></td>
|
||||
<td><code>SESSION_NOT_FOUND</code></td>
|
||||
<td>A <code>DELETE</code> or a newer create with the same <code>session_id</code> ended this create.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>400</code></td>
|
||||
<td><code>INVALID_SERVICE</code></td>
|
||||
<td>Unknown or disallowed service.</td>
|
||||
@@ -5212,6 +5223,7 @@ A slow answer arrives as a <a href="#slow-responses">slow response</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p><code>collection</code> is present only when the service returned a music collection. It holds the facts of the collection itself: <code>kind</code>, <code>title</code>, <code>artist</code>, <code>year</code>, <code>total_tracks</code>, <code>total_discs</code>, <code>artwork_url</code>, <code>total_duration</code>, <code>owner</code> and <code>description</code>, for example <code>"collection": { "kind": "playlist", "title": "Example Playlist", "total_tracks": 93 }</code>. A fact that the collection does not have is absent.</p>
|
||||
<p>Requires an authenticated remote session. Otherwise it returns <code>404 SESSION_NOT_FOUND</code>.</p>
|
||||
<h3 id="post-apisessionsession_idtracks"><code>POST /api/session/{session_id}/tracks</code><a class="headerlink" href="#post-apisessionsession_idtracks" title="Permanent link">¶</a></h3>
|
||||
<p>Get tracks and chapters for a specific title within the remote session. Body: <code>{ "title_id": "..." }</code> (required). Unlike <code>list-tracks</code>, track objects here <strong>include</strong> download URLs, along with session headers/cookies and manifest data the client needs to download directly. A slow answer arrives as a <a href="#slow-responses">slow response</a>.</p>
|
||||
@@ -5580,7 +5592,7 @@ A slow answer arrives as a <a href="#slow-responses">slow response</a>.</p>
|
||||
</div>
|
||||
<p><code>404 SESSION_NOT_FOUND</code> if the remote session does not exist or has expired.</p>
|
||||
<h3 id="delete-apisessionsession_id"><code>DELETE /api/session/{session_id}</code><a class="headerlink" href="#delete-apisessionsession_id" title="Permanent link">¶</a></h3>
|
||||
<p>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.</p>
|
||||
<p>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 <code>404 SESSION_NOT_FOUND</code>. If no remote session exists yet, the <code>DELETE</code> answers <code>200</code> with no <code>cache</code>.</p>
|
||||
<div class="tabbed-set tabbed-alternate" data-tabs="31:1"><input checked="checked" id="__tabbed_31_1" name="__tabbed_31" type="radio" /><div class="tabbed-labels"><label for="__tabbed_31_1">Response <code>200</code></label></div>
|
||||
<div class="tabbed-content">
|
||||
<div class="tabbed-block">
|
||||
|
||||
Reference in New Issue
Block a user