Skip to content

Download Queue

21 endpoints.

GEThttp://localhost:3000/api/download_queue

Every item in the download queue, in whatever state it currently holds.

For live updates prefer /download_queue/stream, which pushes state changes as they happen rather than requiring a poll.

Responses

200The queue.
{
  "items": [
    {}
  ]
}

Your own instance address. Requests go from this browser straight to it.

POSThttp://localhost:3000/api/download_queue

Bulk add. The caller has already decided which download plugin’s url_pattern matched each URL; this endpoint’s only validation is that plugin_namespace resolves to an installed plugin.

Invalid entries are rejected individually rather than failing the whole batch, so one bad URL in a pasted list does not block the rest. Check rejected in the response.

Request body

application/json

Responses

200The items that were added, and the ones that were not.
{
  "added": [
    {}
  ],
  "rejected": [
    {
      "reason": "",
      "url": ""
    }
  ]
}

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

DELETEhttp://localhost:3000/api/download_queue/{id}

Removes one item from the queue.

An item that is currently downloading is refused with a 409 — deleting its record out from under the running background task would leave that task updating nothing, with no queue row left to show progress and no way to stop the transfer. Stop it first.

A queue item that has already been ingested into the library is also refused; remove the resulting archive instead.

Path parameters

idstringrequired

Responses

200Deleted.
{
  "error": "",
  "operation": "",
  "success": 0,
  "successMessage": ""
}
409The item is currently downloading; stop it before deleting.
{
  "error": "",
  "operation": "",
  "success": 0,
  "successMessage": ""
}

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

PATCHhttp://localhost:3000/api/download_queue/{id}

Partial update: a field omitted from the request body keeps its stored value rather than being cleared. Same convention as PUT /plugins/options.

Path parameters

idstringrequired

Request body

Any subset of the item's editable fields.

Responses

200Updated.
{
  "error": "",
  "operation": "",
  "success": 0,
  "successMessage": ""
}
404No such queue item.
{
  "error": "",
  "operation": "",
  "success": 0,
  "successMessage": ""
}

This endpoint accepts a browser session only — the cookie set when you log in to your own instance. API tokens are refused by the server, so there is no token field here and the command above carries no Authorization header.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/{id}/compare — issue #77’s AI quality-comparison judgment for a

Section titled “POST /download_queue/{id}/compare — issue #77’s AI quality-comparison judgment for a”
POSThttp://localhost:3000/api/download_queue/{id}/compare

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:1857), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/{id}/compare — issue #77’s AI quality-comparison judgment for a PendingFilenameConflict: page-aligns and sharpness-compares the freshly-staged download (temp_path, exposed to the response as [imgcompare::Side::A]) against the already-cataloged archive that owns the colliding filename (existing_id’s own file, exposed as [imgcompare::Side::B]) — read-only, resolves nothing on its own; the frontend still calls .../overwrite or .../rename afterward based on what the user (with or without this comparison’s help) decides. A/B are deliberately not labeled “new”/“old” in the response itself (see [lanrurugi_imgcompare::Side]’s own docs) — this handler is what actually assigns that meaning for this specific caller.

Kept alongside the streaming [compare_queue_item_stream] below (not replaced by it) as a plain request/response fallback for any caller that doesn’t want SSE — the frontend’s own ComparisonResultModal flow now goes through the stream endpoint instead (see that handler’s own docs for why).

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:44.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/{id}/compare/export-patch — builds a .patch.zip from a user-picked

Section titled “POST /download_queue/{id}/compare/export-patch — builds a .patch.zip from a user-picked”
POSThttp://localhost:3000/api/download_queue/{id}/compare/export-patch

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:2604), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/{id}/compare/export-patch — builds a .patch.zip from a user-picked selection of A’s own unique pages (ComparisonResult.a_unmatched_pages, issue #77’s own follow-on design) and returns its raw bytes for download, ready to be dropped next to the target archive on disk as <archive filename>.patch.zip (lanrurugi_scanner::patch) — this endpoint doesn’t write it there itself (confirmed design: “补丁不需要应用,只要放在漫画目录内” — a user-placed file, not one this server installs unprompted). The target is always B (the existing library archive this conflict is against) — a patch only ever adds A’s own extra pages on top of the version the user is keeping, never the other way around.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:61.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/{id}/compare/keep-b — the “keep the existing library archive, discard

Section titled “POST /download_queue/{id}/compare/keep-b — the “keep the existing library archive, discard”
POSThttp://localhost:3000/api/download_queue/{id}/compare/keep-b

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:2713), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/{id}/compare/keep-b — the “keep the existing library archive, discard this download” resolution (issue #77’s own follow-on design). Distinct from every other resolve action in this file: those all catalogue the staged file (A) as some archive, either replacing B (overwrite_queue_item) or coexisting with it (rename_queue_item) — this one catalogues nothing at all. B is already in the library and stays exactly where it is; the only two things that happen are (1) insertions, if any, get written straight to B’s own sidecar .patch.zip (not just returned for the user to place themselves, unlike [export_compare_patch] — this flow’s own frontend already walked the user through picking insertion points as part of choosing to keep B, so there’s no separate “now go place this file” step left for them to do), and (2) the queue item is deleted outright, same as a plain DELETE /download_queue/{id} — there’s nothing left for it to track (confirmed design: a patch’s own existence lives on disk next to B, not as a queue-item flag).

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:65.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

GET /download_queue/{id}/compare/page?side=a|b&index=N — the actual page image behind one

Section titled “GET /download_queue/{id}/compare/page?side=a|b&index=N — the actual page image behind one”
GEThttp://localhost:3000/api/download_queue/{id}/compare/page

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:2348), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


GET /download_queue/{id}/compare/page?side=a|b&index=N — the actual page image behind one PageComparison sample from .../compare’s own response, for the frontend’s overlay/shift-to-toggle comparison view. side=a reads from the still-uncatalogued staged download (temp_path — no archive ID exists yet, so this can’t reuse archives.rs’s own GET /archives/{id}/page); side=b reads from the existing archive’s own file. index is a natural-sort page position (matching lanrurugi_imgcompare::PageComparison’s own a_page_index/b_page_index), resolved to an entry name via list_pages fresh on every call rather than cached — this endpoint is only ever hit a handful of times per conflict (issue #77’s own confirmed sample size of 3-5), so re-listing isn’t worth adding a cache for.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:53.

This response carries no example body.

Your own instance address. Requests go from this browser straight to it.

GET /download_queue/{id}/compare/pages?side=a|b — the real entry-name list for one side of

Section titled “GET /download_queue/{id}/compare/pages?side=a|b — the real entry-name list for one side of”
GEThttp://localhost:3000/api/download_queue/{id}/compare/pages

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:2476), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


GET /download_queue/{id}/compare/pages?side=a|b — the real entry-name list for one side of the comparison, in natural-sort (page) order. The frontend’s own “pick where to insert an unmatched A page” UI (issue #77’s own follow-on design) needs B’s real entry names to send as after_filename/before_filename in .../export-patch — it otherwise only ever deals in numeric page indices (matching PageComparison.a_page_index/b_page_index), which patch.rs’s own JSON schema deliberately doesn’t use (see that module’s docs on why an entry name is the stable anchor, not an index that can drift if the archive is re-scanned).

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:57.

This response carries no example body.

Your own instance address. Requests go from this browser straight to it.

GET /download_queue/{id}/compare/stream — the SSE-streaming twin of [compare_queue_item]

Section titled “GET /download_queue/{id}/compare/stream — the SSE-streaming twin of [compare_queue_item]”
GEThttp://localhost:3000/api/download_queue/{id}/compare/stream

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:1988), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


GET /download_queue/{id}/compare/stream — the SSE-streaming twin of [compare_queue_item] above, per issue #77’s own confirmed two-phase design (see lanrurugi_imgcompare::compare_archives_streaming’s own docs for the full phase-1/phase-2 breakdown): opens an EventSource-compatible stream (GET, not POST — EventSource can’t send a request body or use any other HTTP method) that emits one event: sample per CompareEvent::Sample (coarse first, precise replacements streamed in afterward) and a single terminal event: done carrying the rest of ComparisonResult’s own fields — never relies on connection-close/timeout as an implicit end signal (“并且sse要有结束标记”). The frontend opens its result view the moment the FIRST sample event arrives rather than waiting for the whole comparison, which for a ~200-page archive pair is otherwise several seconds of dead time (“假设有6对结果(粗加工),可以用sse分6次发,发第一对的时候就开始显示modal,这样是一个很大的提速”).

A cache hit (same policy as compare_queue_item’s own) is replayed as a single burst of sample events (phase: coarse for all of them — a cached result has already gone through both phases, and the frontend only cares about “is this a display-final value”, which Coarse vs Precise doesn’t actually change once the value itself is final) immediately followed by done, so re-opening an already-computed comparison is still effectively instant.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:49.

This response carries no example body.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/{id}/confirm-older — answers the

Section titled “POST /download_queue/{id}/confirm-older — answers the”
POSThttp://localhost:3000/api/download_queue/{id}/confirm-older

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:707), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/{id}/confirm-older — answers the AwaitingRevisionConfirmation prompt raised when a download turned out to be an older revision than an archive already in the library (issue #107’s warn_then_conflict_menu).

proceed: true records the decision on the item and restarts it — the restart runs straight through the same version-history check instead of parking again, because revision_confirmed is now set. proceed: false moves the item to Cancelled, which is already the “user stopped this on purpose, still restartable” state, so no new terminal state is needed.

Deliberately separate from .../start: AwaitingRevisionConfirmation is not is_startable, so the ordinary Start button can’t skip the question by accident.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:45.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/{id}/fetch-metadata — the “Fetch Metadata” button’s backend path

Section titled “POST /download_queue/{id}/fetch-metadata — the “Fetch Metadata” button’s backend path”
POSThttp://localhost:3000/api/download_queue/{id}/fetch-metadata

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:148), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/{id}/fetch-metadata — the “Fetch Metadata” button’s backend path. Runs the same plugin-execMetadata + metadata_preview-cache logic the post-download auto-fetch uses (plugins::ensure_metadata_cached), so a manual preview and the automatic one share one code path (and one 10-min TTL) instead of the frontend calling POST /plugins/use itself.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:36.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/{id}/overwrite — resolves a PendingFilenameConflict by deleting the

Section titled “POST /download_queue/{id}/overwrite — resolves a PendingFilenameConflict by deleting the”
POSThttp://localhost:3000/api/download_queue/{id}/overwrite

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:1362), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/{id}/overwrite — resolves a PendingFilenameConflict by deleting the existing archive (B) and cataloguing the staged download (A) under its originally-intended filename.

body.insertions, when given, packages B’s own unique pages into a .patch.zip for the new A archive (issue #77’s own follow-on design: even when A wins overall, some of B’s pages might still be worth keeping) — this has to read B’s pages and resolve B’s own category/tag/progress metadata before calling resolve_conflict, since that call deletes B’s file and record as part of cataloguing A (pipeline.rs::delete_existing_archive) — there’s nothing left to read from afterward.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:42.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/{id}/rename — resolves a PendingFilenameConflict by cataloguing the

Section titled “POST /download_queue/{id}/rename — resolves a PendingFilenameConflict by cataloguing the”
POSThttp://localhost:3000/api/download_queue/{id}/rename

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:1649), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/{id}/rename — resolves a PendingFilenameConflict by cataloguing the staged download under body.filename instead, leaving the existing archive that owns the original filename untouched (a fresh, separate, coexisting archive). If filename itself also collides with some other archive, the item ends up with a new PendingFilenameConflict (still resolvable, just against a different existing archive/filename) rather than losing the already-downloaded bytes — see ingest::resolve_rename’s own docs.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:43.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POSThttp://localhost:3000/api/download_queue/{id}/start

Resolves the item’s own download plugin (chosen when it was added, not now), marks it as starting, and launches the real download in the background. The item’s state, job_id and error stay current as the transfer proceeds.

Path parameters

idstringrequired

Responses

200Started; the body carries the job id.
{
  "error": "",
  "operation": "",
  "success": 0,
  "successMessage": ""
}
409The item is not in a startable state.
{
  "error": "",
  "operation": "",
  "success": 0,
  "successMessage": ""
}

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/{id}/stop — cancels an in-flight (Starting/Downloading) item’s

Section titled “POST /download_queue/{id}/stop — cancels an in-flight (Starting/Downloading) item’s”
POSThttp://localhost:3000/api/download_queue/{id}/stop

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:1253), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/{id}/stop — cancels an in-flight (Starting/Downloading) item’s download and reverts it to Queued so it can be restarted. Cooperative, not forceful: this only signals AppState::download_cancellations’ token for the item — the background task itself notices at its next tokio::select! poll (see download_manager::stream::download_one) and does its own partial-file cleanup before actually finishing, at which point start_download reverts the queue item’s state (see the cancel_for_task.is_cancelled() branch there). No token present means either the item was never actually downloading (nothing to stop) or it already finished on its own just before this request landed — both are NotRunning, not an error worth surfacing loudly, since the desired end state (“this item isn’t downloading”) is already true either way.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:41.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POST /download_queue/clear_completed — deletes every Done item, returns the count removed

Section titled “POST /download_queue/clear_completed — deletes every Done item, returns the count removed”
POSThttp://localhost:3000/api/download_queue/clear_completed

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:3092), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


POST /download_queue/clear_completed — deletes every Done item, returns the count removed. Deliberately excludes Error — unlike Done, an errored item is a restartable, still- actionable state (grouped with Queued/Cancelled everywhere else in this module: selectable, has a retry button, shows its own error text), not “completed” work a user is done looking at. A user wanting to discard a specific failed item can still do so individually via DELETE /download_queue/{id} (which does clean up a pending_filename_conflict’s own staged temp file — Done items never carry one, so this handler has nothing analogous to worry about).

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:69.

This response carries no example body.

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POSThttp://localhost:3000/api/download_queue/delete_selected

Bulk delete by ID, mirroring start_selected’s semantics: an ID that is missing or already deleted is a silent no-op, not an error, so a stale selection can be passed safely.

An ID that is currently downloading is likewise a silent no-op — the same safety rule the single-item delete enforces with a 409.

Request body

application/json

Responses

200The IDs that were actually removed.
{
  "deleted": [
    ""
  ]
}

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POSThttp://localhost:3000/api/download_queue/start_all

Starts every item in the queued state, concurrently. Each spawns its own background task; per-domain concurrency and rate limiting are enforced downstream by the download manager, so no extra throttling happens here.

Deliberately narrower than the single-item start: items in error or cancelled are retried one at a time on purpose, and an item parked awaiting a version-conflict answer is never swept up — bulk-starting it would answer, by omission, the very question it is parked on.

Responses

200Which items started, and which were skipped and why.
{
  "skipped": [
    {
      "id": "",
      "reason": ""
    }
  ],
  "started": [
    {
      "id": "",
      "job": ""
    }
  ]
}

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

POSThttp://localhost:3000/api/download_queue/start_selected

Like start_all, filtered to the IDs given.

An ID that is already in flight, already finished, or otherwise not startable is a silent no-op, not an error — so a client can pass a selection without re-checking each item’s current state first.

Request body

application/json

Responses

200Which items started, and which were skipped and why.
{
  "skipped": [
    {
      "id": "",
      "reason": ""
    }
  ],
  "started": [
    {
      "id": "",
      "job": ""
    }
  ]
}

This endpoint needs an administrator token — a guest (read-only) token is refused by the server.

Your own instance address. Requests go from this browser straight to it.

GET /download_queue/stream — SSE endpoint that pushes incremental queue-item state changes

Section titled “GET /download_queue/stream — SSE endpoint that pushes incremental queue-item state changes”
GEThttp://localhost:3000/api/download_queue/stream

Not yet described in this reference. This endpoint is listed because the server registers it, but its request and response shapes have not been written down yet.

The note below is the handler’s own documentation comment (crates/lanrurugi-api/src/download_queue.rs:75), quoted verbatim. It is written for maintainers of this codebase and may reference internal identifiers.


GET /download_queue/stream — SSE endpoint that pushes incremental queue-item state changes broadcast by update_queue_item_state after each successful Redis write. The first event is full with the current complete list so the client can bootstrap without a separate HTTP GET.

Responses

200The endpoint responded. Its exact shape is not documented yet — see the handler at crates/lanrurugi-api/src/download_queue.rs:31.

This response carries no example body.

Your own instance address. Requests go from this browser straight to it.