URLs¶
URL handlers (urls[]) intercept matching web addresses when a user drops a link into Curio, pastes URLs with Ctrl+V, sends a link from the Send to Curio browser extension or calls item.add.fromUrls.
See Action and URL handler declarations for every key and default.
Patterns¶
Declare URL matchers in plugin.json:
{
"urls": [
{
"id": "video-dl",
"title": "Download video",
"patterns": [
"https://www.youtube.com/watch*",
"https://youtu.be/*",
"https://vimeo.com/*"
],
"opens": "downloader"
}
]
}
- Whole-URL patterns (
patterns): Each pattern matches the entire URL, with*matching any run of characters. - Mixed batches: When multiple URLs arrive in one batch, Curio sends matching URLs to their handlers and routes non-matching URLs through the built-in downloader and bookmark pipeline.
Entry points¶
URL handlers activate across every URL ingestion channel:
- Dragging a URL from a browser onto Curio's window or a sidebar folder
- Pasting one or more URLs with Ctrl+V
- Saving a page or stream link (
as: "link") from the Send to Curio browser extension - Calling
item.add.fromUrlsunlesshandlers: falseis passed
Receivers¶
Each urls[] entry specifies either opens or run:
- Page receiver (
opens): Opens your plugin window ("<windowId>") or tab ("tab:<tabId>"), reusing an existing single-instance window, and sends{ handler, urls, place }viaplugin.run. Use a page receiver when the user needs to choose quality, format or files before downloading. - Program receiver (
run): Requiresexec. Runs in the background with{ api: 1, event: "url", handler, urls, place, assets: [] }onstdin. Use a program receiver for non-interactive downloaders such asyt-dlporgallery-dl.
Place payload¶
Both page and program receivers receive a place object containing the destination metadata chosen by the user or browser extension:
{
"folders": [3],
"tags": ["tutorials", "video"],
"annotation": "Blender lighting breakdown",
"sourceUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"rating": 4,
"fields": { "topic": "Lighting" }
}
Pass these properties to item.add.fromPaths or item.add.fromUrls when importing downloaded files so Curio preserves the user's chosen folders, tags, notes, rating and custom fields.
Dispatch¶
- API reporting: When
item.add.fromUrlshands URLs to a plugin, itsAddedresponse includes"handed": [{ "url": "...", "plugin": "<id>", "handler": "<handlerId>" }]. - Recursion prevention: Curio never routes URLs sent to
item.add.fromUrlsby a plugin back into that same plugin's URL handlers. - Explicit bypass: Any caller can pass
"handlers": falsetoitem.add.fromUrlsto run Curio's built-in downloader and bookmark handler directly.
Background¶
- Program handlers (
run): Run even when a library is open only in a background holder (for example when Send to Curio saves into an unopened library). - Page handlers (
opens): Require an open desktop window to display their UI. If a library may run in the background without a window, provide a headlessrunprogram or check window availability.