Skip to content

feat: integrate to comfyui sidebar as custom node#47

Open
zioniony wants to merge 3 commits into
biagiomaf:mainfrom
zioniony:main
Open

feat: integrate to comfyui sidebar as custom node#47
zioniony wants to merge 3 commits into
biagiomaf:mainfrom
zioniony:main

Conversation

@zioniony

@zioniony zioniony commented Mar 7, 2026

Copy link
Copy Markdown
  • Serve SmartGallery via ComfyUI routes at /galleryout/* (without standalone server)
  • Add a ComfyUI sidebar “Gallery” tab that embeds /galleryout/view/root in an iframe
  • Update README and installation docs with plugin install/usage instructions

@zioniony

zioniony commented Mar 7, 2026

Copy link
Copy Markdown
Author

benefits:

  1. integrate this project as ComfyUI sidebar by non-intrusive code
  2. no need to start a new service if ComfyUI served.

preview:

screenshot

- Serve SmartGallery via ComfyUI routes at /galleryout/* (without standalone server)
- Add a ComfyUI sidebar “Gallery” tab that embeds /galleryout/view/_root_ in an iframe
- Update README and installation docs with plugin install/usage instructions
@biagiomaf

Copy link
Copy Markdown
Owner

Hello zioniony, interesting solution. We’ll run some internal tests on it. Thanks for the Pull Request!

@biagiomaf

Copy link
Copy Markdown
Owner

Interesting solution! It needs some tweaks to work better during the first launch with large galleries. Right now, if it's the first time using it, the app hangs for minutes without feedback while indexing (especially with 10k+ items).
Next steps: adding a notification for the initial wait time, some JS adjustments, and a Python core update to mention that FFmpeg is required for certain features. Thanks for sharing this custom node integration, it's really cool! Let me know if you plan on making any changes. In a few weeks, when I have the chance, I’ll try to contribute some improvements as well.

…dler

- Move main execution logic into setup_gallery function for better reusability
- Replace custom WSGI handler implementation with aiohttp-wsgi library
@zioniony

zioniony commented Mar 9, 2026

Copy link
Copy Markdown
Author

I'll try to resolve these issues.

@biagiomaf

biagiomaf commented Mar 10, 2026 via email

Copy link
Copy Markdown
Owner

Add more dependency for comfyui custom node.
Extract main initialization logic into setup_gallery function.
Replace aiohttp_wsgi with a2wsgi and aiohttp_asgi to support backend server-sent-events
@zioniony

zioniony commented Mar 10, 2026

Copy link
Copy Markdown
Author

Cool.
Suggest this comfyui plugin do just 3 things:

  1. Tell backend/frontend the current mode
  2. Embed backend apis to ComfyUI backend
  3. Embed frontend page to ComfyUI sidebar

@zioniony

Copy link
Copy Markdown
Author

Interesting solution! It needs some tweaks to work better during the first launch with large galleries. Right now, if it's the first time using it, the app hangs for minutes without feedback while indexing (especially with 10k+ items). Next steps: adding a notification for the initial wait time, some JS adjustments, and a Python core update to mention that FFmpeg is required for certain features. Thanks for sharing this custom node integration, it's really cool! Let me know if you plan on making any changes. In a few weeks, when I have the chance, I’ll try to contribute some improvements as well.

The first launch is now very quick by skipping full sync database.
When smart-gallery main page loaded, It will auto scan root dir, and progress bar showed the same as standalone server.

Shot-2026-03-10 212125

@biagiomaf

biagiomaf commented Mar 10, 2026 via email

Copy link
Copy Markdown
Owner

@biagiomaf

biagiomaf commented Mar 10, 2026

Copy link
Copy Markdown
Owner

Good idea,
To handle behavioral adjustments beyond the scan file initialization, I will add this variable to the core application.
Inside smartgallery.py:
IS_CUSTOM_NODE = os.environ.get('SG_CUSTOM_NODE', 'false').lower() == 'true'
Then, in your init.py:
os.environ["SG_CUSTOM_NODE"] = "true"
This way, I can customize the behavior of certain functions while running as a custom node (not just during the initial scan).
Thank you for the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants