OpenFetch relies heavily on a flexible plugin system. Plugins can intercept downloads, extract assets from complex web pages, and customize download behavior.
Plugins are standard Rust dynamic libraries (cdylib). They expose C FFI boundaries (currently wrapped by internal helpers) and provide simple interfaces.
- Create a new directory under
plugins/ - Define a
plugin.jsondescribing metadata. - Define a
Cargo.toml. - Create a
src/lib.rsexportinganalyzeanddownloadhandlers.
{
"id": "my-plugin",
"name": "My Plugin",
"version": "1.0.0",
"author": "Author",
"description": "...",
"permissions": ["network", "filesystem"],
"patterns": ["^https?://.*"]
}analyze(url: &str) -> Result<UrlAnalysisResult>: Extracts metadata from the URL.download(url: &str, output_path: &str, options: DownloadOptions) -> Result<()>: Downloads the file.
Currently, test by placing the plugin folder in the plugins directory. A marketplace is planned for publishing.