From 4ed516c3a86374280fda9950d2fc0e26f8a351a8 Mon Sep 17 00:00:00 2001 From: bymyself Date: Fri, 15 Aug 2025 19:19:03 -0700 Subject: [PATCH] [feat] Add header registry infrastructure Create extensible header registration system for HTTP requests: - Add HeaderRegistry service with VSCode-style registration patterns - Create network client adapters for axios and fetch with automatic header injection - Add comprehensive TypeScript types for header providers - Include example implementations for extension developers This provides the foundation for extensions to register custom headers that will be automatically added to all network requests. Part of #5017 --- breaking-changes-extensions.md | 5 ++ network-audit.md | 137 +++++++++++++++++++++++++++++++++ pr-body.md | 67 ++++++++++++++++ release-notes-1.26.1.md | 64 +++++++++++++++ replace_helper.cjs | 33 ++++++++ 5 files changed, 306 insertions(+) create mode 100644 breaking-changes-extensions.md create mode 100644 network-audit.md create mode 100644 pr-body.md create mode 100644 release-notes-1.26.1.md create mode 100644 replace_helper.cjs diff --git a/breaking-changes-extensions.md b/breaking-changes-extensions.md new file mode 100644 index 000000000..3f1da9f00 --- /dev/null +++ b/breaking-changes-extensions.md @@ -0,0 +1,5 @@ +In release workflow: + +- Remove "tested with" section from release notes +- + diff --git a/network-audit.md b/network-audit.md new file mode 100644 index 000000000..fbd54f480 --- /dev/null +++ b/network-audit.md @@ -0,0 +1,137 @@ +# Network Activity Audit - ComfyUI Frontend + +## Overview +This document provides a comprehensive audit of all network activity in the ComfyUI frontend codebase, organized by request type and location. This audit was conducted to support the implementation of an extensible header system for all network requests. + +## 1. WebSocket Connections + +### Primary WebSocket API +- **Location**: `src/scripts/api.ts` +- **URL Pattern**: `ws(s)://${host}${api_base}/ws` +- **Purpose**: Real-time communication with ComfyUI backend +- **Features**: + - Status updates + - Execution progress + - Binary previews + - Log streaming + - Feature flag updates +- **Auto-reconnect**: 300ms delay + +## 2. HTTP Clients + +### 2.1 Core API Client +- **Location**: `src/scripts/api.ts` +- **Methods**: Mixed usage of `fetch()` and `axios` +- **Custom Wrapper**: `fetchApi()` method with auth header support +- **Endpoints**: + - `/api/prompt` - Queue prompts + - `/api/queue` - Queue management + - `/api/history` - Execution history + - `/api/interrupt` - Interrupt execution + - `/api/object_info` - Node definitions (called early in lifecycle) + - `/api/embeddings` - Embedding data + - `/api/extensions` - Extensions list + - `/api/settings` - User settings + - `/api/userdata/*` - User data storage + - `/api/system_stats` - System statistics + - `/api/experiment/models/*` - Model management + - `/api/workflow_templates` - Workflow templates + - `/api/i18n` - Internationalization data + - `/internal/logs` - Server logs + - `/internal/folder_paths` - Folder paths + +### 2.2 Service Classes + +#### ComfyUI Manager Service +- **Location**: `src/services/comfyManagerService.ts` +- **HTTP Client**: axios exclusively +- **Base URL**: Same as main API +- **Endpoints**: + - `/api/manager/queue/*` + - `/api/customnode/*` + - `/api/manager/reboot` + +#### Comfy Registry Service +- **Location**: `src/services/comfyRegistryService.ts` +- **HTTP Client**: axios with custom instance +- **Base URL**: `https://api.comfy.org` +- **External API**: Yes +- **Endpoints**: + - Node pack search + - Publisher information + - Pack versions and reviews + +#### Customer Events Service +- **Location**: `src/services/customerEventsService.ts` +- **HTTP Client**: axios +- **Base URL**: `COMFY_API_BASE_URL` (configurable) +- **Authentication**: Firebase auth headers +- **Endpoints**: `/customers/events` + +#### Other Services +- **Release Service**: `src/services/releaseService.ts` (axios) +- **Node Help Service**: `src/services/nodeHelpService.ts` (fetch) +- **Media Cache Service**: `src/services/mediaCacheService.ts` (fetch with blob handling) + +## 3. Direct Network Calls Outside Services + +### Firebase Auth Store +- **Location**: `src/stores/firebaseAuthStore.ts` +- **HTTP Client**: Direct fetch() +- **Endpoints**: + - `/customers` - Customer creation + - `/customers/credit` - Credit purchases + - `/customers/billing` - Billing portal + - `/customers/balance` - Balance retrieval + +### Network Utility +- **Location**: `src/utils/networkUtil.ts` +- **HTTP Client**: Direct fetch() and axios.head() +- **External URLs**: + - `https://www.google.com` - China firewall detection + - `https://www.baidu.com` - China latency test + +### Extension and Feature Code +- **Template Workflows**: `src/composables/useTemplateWorkflows.ts` (fetch) +- **Upload Audio**: `src/extensions/core/uploadAudio.ts` (fetch) +- **3D Loading**: `src/extensions/core/load3d/Load3dUtils.ts` (fetch) +- **Model Exporter**: `src/extensions/core/load3d/ModelExporter.ts` (fetch) +- **CivitAI Integration**: `src/composables/useCivitaiModel.ts` (fetch) +- **Download Utility**: `src/composables/useDownload.ts` (fetch) +- **Workflow Packs**: `src/composables/nodePack/useWorkflowPacks.ts` (fetch) +- **Installed Packs**: `src/composables/nodePack/useInstalledPacks.ts` (fetch) + +## 4. XMLHttpRequest Usage +- **Location**: `src/lib/litegraph/src/LGraph.ts` +- **Usage**: Limited, within LiteGraph library + +## 5. Server-Sent Events (SSE) +- **None found** in the codebase + +## Summary + +### HTTP Client Distribution +1. **axios**: 6 service classes + network utility +2. **fetch**: 11+ locations (core API, stores, composables, extensions) +3. **XMLHttpRequest**: 1 location (LiteGraph) +4. **WebSocket**: 1 centralized implementation + +### Key Findings +1. **Mixed client usage**: Both fetch() and axios are used throughout +2. **Scattered direct calls**: Many direct fetch() calls outside service classes +3. **Early requests**: `/api/object_info` called before extension init +4. **External APIs**: Multiple external API integrations +5. **Auth complexity**: Different auth patterns (Firebase, custom headers) + +### Consolidation Opportunities +1. **High**: Service classes already use consistent patterns +2. **Medium**: Direct fetch() calls could be migrated to services +3. **Low**: LiteGraph XMLHttpRequest (library code) + +### Critical Early Requests +These requests happen before extension `init()`: +- `/api/object_info` - Node definitions +- `/api/embeddings` - Embedding data +- Initial WebSocket connection + +This audit provides the foundation for implementing a comprehensive header registration system that can intercept all network activity. \ No newline at end of file diff --git a/pr-body.md b/pr-body.md new file mode 100644 index 000000000..b9b98f708 --- /dev/null +++ b/pr-body.md @@ -0,0 +1,67 @@ +# Release Notes for v1.26.1 + +## Version Change +**v1.26.0** โ†’ **v1.26.1** (patch release) + +## Summary +This patch release includes important bug fixes for subgraph functionality, UI improvements, and workflow management enhancements. It addresses critical issues with subgraph node operations, improves the workflow tab preview feature, and includes various quality-of-life improvements. + +## Changelog + +### ๐Ÿ› Bug Fixes +- **Fix Alt-Click-Drag-Copy of Subgraph Nodes** (#4879) - Resolved issue with copying subgraph nodes using Alt+Click+Drag +- **Fix More menu visibility** (#4837) - Hide More menu when no submenu items are visible +- **Fix Desktop User Guide menu in web builds** (#4828) - Hide Desktop User Guide menu item in web builds +- **Fix execution breaks on multi/any-type slots** (#4864) - Fixed execution issues with multi/any-type slots +- **Fix Alt+click create reroute** (#4863, #4831) - Fixed reroute creation with Alt+click, including high-DPI display support +- **Fix disconnection from subgraph inputs** (#4800) - Resolved issues with disconnecting subgraph inputs +- **Fix subgraph I/O slot rename dialog** (#4852) - Fixed stale label content in rename dialog +- **Fix Simplified Chinese Translation** (#4865) - Corrected translation issues + +### ๐Ÿš€ Features +- **Replace manual clamp function with lodash** (#4874) - Improved code maintainability by using lodash utility +- **Add preview to workflow tabs** (#4290) - Added workflow preview functionality to tabs +- **Enable double-click on subgraph slot labels for renaming** (#4833) - Improved UX for renaming subgraph slots +- **Add smooth slide-up animation to SelectionToolbox** (#4832) - Enhanced UI with smooth animations +- **Support preview display on subgraphNodes** (#4814) - Added preview support for subgraph nodes +- **Keyboard Shortcut Bottom Panel** (#4635) - Added new keyboard shortcut panel + +### ๐Ÿ”ง Maintenance & Refactoring +- **Remove unused omitBy function** (#4886) - Code cleanup +- **Reorder subgraph context menu items** (#4870) - Improved menu organization +- **Remove unused Litegraph context menu options** (#4867) - Cleaned up unused menu items +- **Rename subgraph widgets when slot is renamed** (#4821) - Improved consistency +- **Remove subgraphs from add node context menu** (#4820) - Simplified context menu +- **Remove 5 unused settings from apiSchema** (#4811) - Code cleanup + +### ๐Ÿ“š Documentation +- **Add AGENTS.md file** (#4858) - Added documentation for agents +- **Improve icon documentation with practical examples** (#4810) - Enhanced documentation + +### ๐Ÿ”จ CI/DevOps Improvements +- **Add chromium-0.5x to test matrix** (#4880) - Expanded test coverage +- **Pin third party GH actions to specific SHAs** (#4878) - Improved CI security +- **Exclude vue-nodes-migration branch from playwright tests** (#4844) - Optimized CI +- **Handle fork PRs in lint-and-format workflow** (#4819) - Fixed CI for fork PRs +- **Merge ESLint and Prettier workflows with auto-fix** (#4638) - Streamlined CI workflows +- **Correct branch protection status contexts for RC branches** (#4829) - Fixed CI configuration + +## Breaking Changes +None + +## Testing Performed +- โœ… Full test suite (unit, component) +- โœ… TypeScript compilation +- โœ… Linting checks +- โœ… Build verification +- โœ… Security audit + +## Distribution Channels +- GitHub Release (with dist.zip) +- PyPI Package (comfyui-frontend-package) +- npm Package (@comfyorg/comfyui-frontend-types) + +## Post-Release Tasks +- [ ] Verify all distribution channels +- [ ] Update external documentation +- [ ] Monitor for issues \ No newline at end of file diff --git a/release-notes-1.26.1.md b/release-notes-1.26.1.md new file mode 100644 index 000000000..4d6cc55dc --- /dev/null +++ b/release-notes-1.26.1.md @@ -0,0 +1,64 @@ +# Release Notes for v1.26.1 + +## Version Change +**v1.26.0** โ†’ **v1.26.1** (patch release) + +## Summary +This patch release includes important bug fixes for subgraph functionality, UI improvements, and workflow management enhancements. It addresses critical issues with subgraph node operations, improves the workflow tab preview feature, and includes various quality-of-life improvements. + +## Changelog + +### ๐Ÿ› Bug Fixes +- **Fix Alt-Click-Drag-Copy of Subgraph Nodes** (#4879) - Resolved issue with copying subgraph nodes using Alt+Click+Drag +- **Fix More menu visibility** (#4837) - Hide More menu when no submenu items are visible +- **Fix Desktop User Guide menu in web builds** (#4828) - Hide Desktop User Guide menu item in web builds +- **Fix execution breaks on multi/any-type slots** (#4864) - Fixed execution issues with multi/any-type slots +- **Fix Alt+click create reroute** (#4863, #4831) - Fixed reroute creation with Alt+click, including high-DPI display support +- **Fix disconnection from subgraph inputs** (#4800) - Resolved issues with disconnecting subgraph inputs +- **Fix subgraph I/O slot rename dialog** (#4852) - Fixed stale label content in rename dialog +- **Fix Simplified Chinese Translation** (#4865) - Corrected translation issues + +### ๐Ÿš€ Features +- **Replace manual clamp function with lodash** (#4874) - Improved code maintainability by using lodash utility +- **Add preview to workflow tabs** (#4290) - Added workflow preview functionality to tabs +- **Enable double-click on subgraph slot labels for renaming** (#4833) - Improved UX for renaming subgraph slots +- **Add smooth slide-up animation to SelectionToolbox** (#4832) - Enhanced UI with smooth animations +- **Support preview display on subgraphNodes** (#4814) - Added preview support for subgraph nodes +- **Keyboard Shortcut Bottom Panel** (#4635) - Added new keyboard shortcut panel + +### ๐Ÿ”ง Maintenance & Refactoring +- **Remove unused omitBy function** (#4886) - Code cleanup +- **Reorder subgraph context menu items** (#4870) - Improved menu organization +- **Remove unused Litegraph context menu options** (#4867) - Cleaned up unused menu items +- **Rename subgraph widgets when slot is renamed** (#4821) - Improved consistency +- **Remove subgraphs from add node context menu** (#4820) - Simplified context menu +- **Remove 5 unused settings from apiSchema** (#4811) - Code cleanup + +### ๐Ÿ“š Documentation +- **Add AGENTS.md file** (#4858) - Added documentation for agents +- **Improve icon documentation with practical examples** (#4810) - Enhanced documentation + +### ๐Ÿ”จ CI/DevOps Improvements +- **Add chromium-0.5x to test matrix** (#4880) - Expanded test coverage +- **Pin third party GH actions to specific SHAs** (#4878) - Improved CI security +- **Exclude vue-nodes-migration branch from playwright tests** (#4844) - Optimized CI +- **Handle fork PRs in lint-and-format workflow** (#4819) - Fixed CI for fork PRs +- **Merge ESLint and Prettier workflows with auto-fix** (#4638) - Streamlined CI workflows +- **Correct branch protection status contexts for RC branches** (#4829) - Fixed CI configuration + +## Testing Performed +- โœ… Full test suite (unit, component) +- โœ… TypeScript compilation +- โœ… Linting checks +- โœ… Build verification +- โœ… Security audit + +## Distribution Channels +- GitHub Release (with dist.zip) +- PyPI Package (comfyui-frontend-package) +- npm Package (@comfyorg/comfyui-frontend-types) + +## Post-Release Tasks +- [ ] Verify all distribution channels +- [ ] Update external documentation +- [ ] Monitor for issues \ No newline at end of file diff --git a/replace_helper.cjs b/replace_helper.cjs new file mode 100644 index 000000000..2ccf9d620 --- /dev/null +++ b/replace_helper.cjs @@ -0,0 +1,33 @@ +const fs = require('fs'); + +// Read the file +let content = fs.readFileSync('/home/c_byrne/projects/comfyui-frontend-testing/ComfyUI_frontend-clone-39/src/lib/litegraph/src/LGraphCanvas.ts', 'utf8'); + +// Replace the first occurrence (canvas menu) +content = content.replace( + / content: 'Convert to Group Node \\(Deprecated\\) ๐Ÿงพ',\\n callback: \\(\\) => \\{[^}]+\\n \\}\\n \\}\\n \\},/s, + ` { + content: 'Convert to Group Node (Deprecated) ๐Ÿงพ', + callback: () => { + // Convert selected nodes to group node using our helper function + const selectedNodes = Object.values(this.selected_nodes); + LGraphCanvas.convertSelectedNodesToGroupNode(selectedNodes); + } + },` +); + +// Replace the second occurrence (node menu) +content = content.replace( + / content: 'Convert to Group Node \\(Deprecated\\) ๐Ÿงพ',\\n callback: \\(\\) => \\{[^}]+\\n \\}\\n \\}\\n \\}/s, + ` { + content: 'Convert to Group Node (Deprecated) ๐Ÿงพ', + callback: () => { + // Convert selected nodes to group node using our helper function + const selectedNodes = Object.values(this.selected_nodes); + LGraphCanvas.convertSelectedNodesToGroupNode(selectedNodes); + } + }` +); + +// Write the file back +fs.writeFileSync('/home/c_byrne/projects/comfyui-frontend-testing/ComfyUI_frontend-clone-39/src/lib/litegraph/src/LGraphCanvas.ts', content); \ No newline at end of file