feat: multi-directory gallery scan with folder filter (#126)#135
feat: multi-directory gallery scan with folder filter (#126)#135
Conversation
- Change _gallery_cache from None to {} (dict keyed by path string)
- Update invalidate_gallery_cache() to clear dict instead of setting None
- Add _get_all_output_dirs() helper as single source of truth for
resolving configured + fallback output directories
- Update _enrich_prompt_images() to iterate all output roots when
computing relative paths and thumbnail URLs
…ving - Extract _enrich_images() for flat image lists, used by get_prompt_images - get_prompt_images now adds url/thumbnail_url (fixes stuck "Loading images...") - serve_image checks all output dirs not just first (fixes 403 on multi-path) - Fix diagnostics monitor check to read current module attribute, not stale import
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d65abbc333
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if image_path.exists(): | ||
| response = web.FileResponse(image_path) | ||
| response.headers["Cache-Control"] = "public, max-age=3600" | ||
| return response |
There was a problem hiding this comment.
Include output-root identity before serving by filepath
When multiple scan roots are configured, different files can share the same relative path (for example, batch1/img.png under two roots). This handler returns the first existing match while callers provide only filepath, so those collisions will serve whichever root is iterated first and show the wrong media for some records. This is a correctness regression that appears whenever roots contain overlapping folder/file names; include a root discriminator in the URL (or serve by unique image id/absolute mapping) to avoid ambiguous resolution.
Useful? React with 👍 / 👎.
| root_dirs = list(GalleryConfig.MONITORING_DIRECTORIES) or None | ||
| subfolders = await self._run_in_executor( | ||
| self.db.get_prompt_subfolders, root_dirs |
There was a problem hiding this comment.
Resolve subfolders using detected roots when config is empty
This endpoint sends None for root_dirs whenever users leave gallery directories unset (auto-detect mode), which makes get_prompt_subfolders fall back to basename extraction instead of true relative paths. In that common setup, nested folders collapse into ambiguous leaf names (e.g., foo/bar and baz/bar both become bar), so the new folder filter cannot accurately target a specific subtree. Pass effective output roots (including auto-detected ones) so returned folder values remain unique and match filtering behavior.
Useful? React with 👍 / 👎.
Summary
Breaking Changes
Users need to rescan their images after updating so folder metadata is populated. The update notice popup guides them through this on first load.
Test plan
pm_update_notice_dismissedfrom localStorage brings the popup back