* fix(sidebar): merge preset HEAD route into GET handler PR #68 shipped koolook_routes.py with @routes.get + @routes.head on the same path. aiohttp's add_get auto-registers HEAD by default, so the explicit @routes.head collided with the auto-synthesized HEAD and crashed ComfyUI startup with "Added route will never be executed, method HEAD is already registered". Trying allow_head=False on the GET to opt out triggered a second crash: ComfyUI's server.py mirrors every PromptServer route into a parallel /api/... table via api_routes.route(method, path)(handler, **kwargs), and RouteTableDef.route's inner closure rejects unknown kwargs with TypeError. So no kwarg-based opt-out is viable. Drop the dedicated HEAD handler. Aiohttp's auto-HEAD-from-GET delivers HEAD probes to get_preset; we branch on request.method to skip the file read for HEAD — preserving the cheap-existence optimization the client's presetExists relies on for multi-MB JSON over Dropbox / iCloud / NFS-mounted libraries. CHANGELOG [Unreleased] updated to match. This bug never reached users — koolook_routes.py was added in #68 (post-v0.2.0) and was never published to Comfy Registry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(sidebar): Tools row + starter preset replaces curated_defaults Two coordinated UX changes for fresh-install distribution + admin ergonomics — designed together and shipped as one unit. 1. New "Tools" row sits between the Snapshot row and the search field. Moves the Export and "Install missing for picks" buttons up out of the Nodes row (admin/advanced operations don't belong in the everyday + Add toolbar). Adds a new "Drop placeholders onto canvas" button — the security_level=normal escape hatch for installing missing packs: instantiates one placeholder per missing pack on a fresh canvas tab so ComfyUI/Manager's standard "Install Missing Custom Nodes" detection takes over via Manager's UI flow (which uses different gates than our programmatic /customnode/install/ git_url call). Nodes row keeps only the everyday + button. 2. curated_defaults.json retired in favor of starter_preset.json. Fresh installs no longer get picks seeded directly into localStorage on first load. Instead the bundled web/starter_preset.json (full snapshot format — picks + workflows + tags + archive) is copied into the user's snapshot library directory as starter.json. The user opens Snapshot -> Load -> starter to apply in one click. Unifies fresh-install distribution with the per-user snapshot library (#68); maintainer flow becomes "build state in ComfyUI -> click the (down-arrow) Tools-row button -> paste over web/starter_preset.json -> commit." Existing users with non-empty picks are explicitly skipped by the new seeder, so their state is untouched. Removed: seedDefaultsIfNeeded, exportPicks, web/curated_defaults.json, SEEDED_KEY, DEFAULTS_URL. Added: seedStarterPresetIfNeeded, exportStarterPreset (snapshot.js), STARTER_SEEDED_KEY, STARTER_URL, STARTER_PRESET_FILENAME, discoverMissingPacks (installer.js), dropPlaceholdersForPacks (canvas_io.js), web/starter_preset.json. Docs: CLAUDE.md "Curated Nodes sidebar — distributed defaults" -> "Kforge Labs sidebar — starter preset distribution". docs/maintainers/curated-sidebar.md rewritten. CHANGELOG.md [Unreleased] updated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(sidebar): picks priority — drag-link menu, spotlight on add, modal hardening Three coordinated UX features for curated picks plus two underlying bug fixes uncovered while wiring them. 1. Drag-link-release menu hoists curated picks. When a connection is dragged from a socket and released on empty canvas, ComfyUI's compat- filtered suggestion list now sorts items in the user's curated picks above everything else, with a "── from your picks ──" separator before the rest. Detection via the "Add Node" + "Add Reroute" sentinel pair in the menu's options (narrow enough that other ContextMenu uses are untouched). Purely additive — no compatible nodes are removed, only re-ordered. New `web/sidebar/connection_menu.js` exports a `patchConnectionMenu()` registered alongside `patchCanvasMenu()`. 2. Spotlight effect on add. Clicking the toolbar `+` (or the canvas right-click "Add to Kforge Labs") collapses every Nodes-section pack folder, then auto-expands the pack + subcategory the just-saved node lives in — pedagogical aid that helps users learn which pack each node belongs to. Multi-select adds light up every hit pack simultaneously. Duplicate adds get the spotlight too (the educational reminder still applies). New helper `findPackPathForType` mirrors the gather code's REPO-precedence-then-user-pick-fallback. New exported `spotlightAddedPicks(typeNames)` does the collapse + pin sequence. 3. Modal drag-out-of-input no longer dismisses the dialog. Shared modal shell `makeModalShell` gained a mousedown / click-intent check: a click on the overlay only fires dismiss when the gesture STARTED on the overlay too. Drag-selecting text inside an input that releases in the overlay's dark area used to dismiss the modal mid-edit. Affects every Koolook dialog. Snapshot Settings path field also gained a `title` tooltip so the full path is hover-readable. Bug fixes uncovered + carried in this PR: - `pinExpanded` paths now expand on the immediate render. buildFolder's resolution chain gained a `pinnedPaths` check between `forceExpanded` and `pathStates`. Phase 3 of `renderTree` writes pins into pathStates AFTER Phase 2 builds the DOM, so without this check the pin had no effect on the current render. Improves the existing workflow-save pinning (visibly correct now) and is load-bearing for the new spotlight feature. CHANGELOG [Unreleased] updated with all five entries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
2.2 KiB
JavaScript
55 lines
2.2 KiB
JavaScript
// =============================================================================
|
|
// Koolook curated-nodes sidebar — entry point.
|
|
//
|
|
// This file boots the sidebar; module bodies live in `web/sidebar/`. ComfyUI
|
|
// discovers the extension via `WEB_DIRECTORY = "./web"` (set in __init__.py)
|
|
// and calls `app.registerExtension(...).setup()` once during frontend startup.
|
|
// =============================================================================
|
|
import { app } from "../../../scripts/app.js";
|
|
|
|
import {
|
|
TAB_ID,
|
|
TAB_TITLE,
|
|
TAB_TOOLTIP,
|
|
TAB_ICON,
|
|
} from "./sidebar/constants.js";
|
|
import { seedStarterPresetIfNeeded } from "./sidebar/snapshot.js";
|
|
import {
|
|
loadWorkflowsStore,
|
|
seedWorkflowDefaultsIfNeeded,
|
|
} from "./sidebar/workflows_store.js";
|
|
import { renderPanel } from "./sidebar/tree.js";
|
|
import { patchCanvasMenu } from "./sidebar/canvas_menu.js";
|
|
import { patchConnectionMenu } from "./sidebar/connection_menu.js";
|
|
|
|
app.registerExtension({
|
|
name: "koolook.curated_sidebar",
|
|
async setup() {
|
|
if (!app.extensionManager || !app.extensionManager.registerSidebarTab) {
|
|
console.warn("[Koolook] extensionManager.registerSidebarTab not available; sidebar not registered.");
|
|
return;
|
|
}
|
|
// Seeds the bundled starter preset into the user's snapshot library
|
|
// on first run (replaces the legacy `curated_defaults.json` localStorage
|
|
// pick-seed). Async-fires server I/O — kept off the critical path so
|
|
// sidebar tab registration isn't blocked behind it on a slow server.
|
|
seedStarterPresetIfNeeded();
|
|
const loadResult = await loadWorkflowsStore();
|
|
// Skip workflow seeding when /userdata file is corrupt — we don't want
|
|
// to overwrite a recoverable-but-unparseable file with stock defaults.
|
|
if (!loadResult.corrupt) {
|
|
await seedWorkflowDefaultsIfNeeded();
|
|
}
|
|
app.extensionManager.registerSidebarTab({
|
|
id: TAB_ID,
|
|
title: TAB_TITLE,
|
|
tooltip: TAB_TOOLTIP,
|
|
icon: TAB_ICON,
|
|
type: "custom",
|
|
render: (el) => renderPanel(el),
|
|
});
|
|
patchCanvasMenu();
|
|
patchConnectionMenu();
|
|
},
|
|
});
|