From 014b29e425a3d7ea7351e33c18f1ec67f01e510d Mon Sep 17 00:00:00 2001 From: jimpi-dev Date: Tue, 24 Feb 2026 20:30:26 +0100 Subject: [PATCH] Update README.md --- README.md | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2666ab9..660a836 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,88 @@ -# WorkflowUIPlugin -A plugin for ComfyUI to provide even more features to WorkflowUI! +# WorkflowUI Plugin + +A **ComfyUI custom node** that adds HTTP API endpoints for media (output/input/temp) so the WorkflowUI application can delete files on the ComfyUI server, browse media, and serve images with optional previews—without adding any graph nodes to the ComfyUI UI. + +> **Core application:** [WorkflowUI](https://github.com/your-org/WorkflowUI) — *Replace this link with your core repository URL.* + +--- + +## Features + +- **Delete media** — Remove output/input/temp files by filename and subfolder (used when deleting remote run images from WorkflowUI). +- **View media** — Serve image, video, and audio files with caching; optional compressed image previews (WebP/JPEG or custom size). +- **List & browse** — Flat file list or one-level folder tree (JSON metadata only, no binary data) for building file-manager UIs. +- **Capabilities & version info** — Endpoints to detect the plugin and report installed custom node modules/versions for run metadata. + +No new nodes appear in ComfyUI; the plugin only registers routes. + +--- + +## Installation + +1. Copy the `WorkflowUIPlugin` folder into your ComfyUI `custom_nodes` directory: + + ``` + ComfyUI/custom_nodes/WorkflowUIPlugin/ + ├── __init__.py + ├── routes.py + ├── version_info.py + └── README.md + ``` + +2. Restart ComfyUI. A startup banner confirms the plugin loaded. + +No extra dependencies; ComfyUI’s existing stack (aiohttp, Pillow) is used. + +--- + +## API Reference + +| Method | Path | Description | +|--------|------|-------------| +| `POST` | `/delete` | Delete a file by `filename` / `subfolder` / `type`. Same as namespaced path below. | +| `POST` | `/workflowui/media/delete` | Delete a file (JSON body: `filename`, optional `subfolder`, `type`). | +| `GET` | `/workflowui/media/view` | Serve file bytes (images, video, audio). Query: `filename`, `subfolder`, `type`; optional `preview=webp` \| `jpeg` \| `256` for image previews. | +| `GET` | `/workflowui/media/list` | Flat list of files in a folder (JSON: `filename`, `size`, `mtime`). Query: `type`, `subfolder`. | +| `GET` | `/workflowui/media/tree` | One-level tree: `folders` and `files` for browsing. Query: `type`, `subfolder`. | +| `GET` | `/workflowui/media/capabilities` | Returns supported features (e.g. `workflowui_plugin`, `delete`, `list`, `tree`, `view`, `view_preview`). | +| `GET` | `/workflowui/version_info` | Plugin version and list of installed custom node modules/versions for run metadata. | + +### Delete (POST) + +**Request body (JSON):** + +- `filename` (required) — e.g. `ComfyUI_00001_.png` +- `subfolder` (optional) — e.g. `""` or `"audio"` +- `type` (optional) — `"output"` (default), `"input"`, or `"temp"` + +**Response:** `200` with `{"ok": true}` on success; `400` / `404` / `500` with `{"ok": false, "error": "..."}` on failure. + +### View & preview + +- **View** — Serves the file from disk with `Cache-Control: public, max-age=3600`. +- **Preview** (images only) — Add `&preview=webp`, `&preview=jpeg`, or `&preview=256` (or any size 64–2048) for a resized/compressed image. Non-image files ignore `preview` and return the original. + +### List & tree + +- **List** — Flat list of files with `filename`, `size`, `mtime` (newest first). +- **Tree** — One level: `folders` (subfolder names) and `files` (with `filename`, `size`, `mtime`). Use for file-manager style browsing. + +--- + +## Security + +- Paths are restricted to ComfyUI’s output/input/temp roots via `folder_paths.get_directory_by_type()`. +- `subfolder` and `filename` are validated to prevent directory traversal (`..`, path separators in filename). + +--- + +## Compatibility + +- **ComfyUI** — Uses `folder_paths.get_directory_by_type()` and `PromptServer.instance.routes`. +- **WorkflowUI** — Works with the existing backend that calls `POST /delete` with the same JSON shape; no backend change required when the plugin is installed. + +--- + +## License + +See repository license. This plugin is intended for use with the WorkflowUI application.