Skip to content

feat: multi-directory gallery scan with folder filter (#126)#135

Merged
vitosans merged 14 commits intomainfrom
feature/126-multi-paths-folder-filter
Apr 3, 2026
Merged

feat: multi-directory gallery scan with folder filter (#126)#135
vitosans merged 14 commits intomainfrom
feature/126-multi-paths-folder-filter

Conversation

@vitosans
Copy link
Copy Markdown
Contributor

@vitosans vitosans commented Apr 3, 2026

Summary

  • Multi-directory support: Configure multiple output directories for image scanning and gallery display
  • Folder filter: Dropdown filter in search bar to browse images by subfolder
  • Multi-root image serving: Images served correctly from any configured output directory
  • Update notice popup: Version-scoped popup on first load explaining the rescan requirement, with "Don't show again" checkbox
  • Version bump to 3.2.0

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

  • Verify update notice popup appears on first admin page load
  • Verify "Don't show again" checkbox + Dismiss suppresses the popup on reload
  • Verify "Scan Now" button opens the scan modal and suppresses future popups
  • Verify clearing pm_update_notice_dismissed from localStorage brings the popup back
  • Verify multiple scan directories can be added/removed in settings
  • Verify folder dropdown filter shows subfolders and filters results
  • Verify images from multiple output directories display correctly in gallery

vitosans added 14 commits April 3, 2026 06:23
- 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
@vitosans vitosans merged commit 6fc6e68 into main Apr 3, 2026
11 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +355 to +358
if image_path.exists():
response = web.FileResponse(image_path)
response.headers["Cache-Control"] = "public, max-age=3600"
return response
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +172 to +174
root_dirs = list(GalleryConfig.MONITORING_DIRECTORIES) or None
subfolders = await self._run_in_executor(
self.db.get_prompt_subfolders, root_dirs
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

1 participant