[PR #2584] [MERGED] feat(gallery): persona and global image galleries #5672

Closed
opened 2026-10-22 04:18:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2584
Author: @kolacheee
Created: 6/15/2026
Status: ✅ Merged
Merged: 6/16/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/staging-persona-global-galleries


📝 Commits (8)

  • def5d0a feat(gallery): add persona + global gallery server (schema, storage, routes)
  • 50bf0f3 feat(gallery): persona gallery tab + global gallery panel (client)
  • 5307bfe fix(gallery): register persona/global gallery tables in the file-native store
  • 7e3182c fix(gallery): surface persona gallery upload errors with a toast
  • e51185c fix(gallery): responsive global gallery grid on small screens
  • 091bea0 fix(gallery): responsive persona + character gallery grids on mobile
  • cb5004e fix(gallery): address review — path-traversal guards, upload rollback, indexes
  • b8eb6be Merge staging into persona global galleries

📊 Changes

17 files changed (+1392 additions, -6 deletions)

View changed files

📝 packages/client/src/components/characters/CharacterEditor.tsx (+2 -2)
📝 packages/client/src/components/layout/RightPanel.tsx (+6 -1)
📝 packages/client/src/components/layout/TopBar.tsx (+14 -1)
➕ packages/client/src/components/panels/GlobalGalleryPanel.tsx (+434 -0)
📝 packages/client/src/components/personas/PersonaEditor.tsx (+164 -0)
📝 packages/client/src/hooks/use-characters.ts (+68 -0)
➕ packages/client/src/hooks/use-global-gallery.ts (+148 -0)
📝 packages/client/src/stores/ui.store.ts (+1 -0)
📝 packages/server/src/db/file-backed-store.ts (+4 -0)
📝 packages/server/src/db/migrate.ts (+34 -0)
📝 packages/server/src/db/schema/gallery.ts (+50 -1)
📝 packages/server/src/routes/characters.routes.ts (+133 -1)
➕ packages/server/src/routes/global-gallery.routes.ts (+186 -0)
📝 packages/server/src/routes/index.ts (+2 -0)
📝 packages/server/src/services/mari-db/mari-db.service.ts (+1 -0)
➕ packages/server/src/services/storage/global-gallery.storage.ts (+91 -0)
➕ packages/server/src/services/storage/persona-gallery.storage.ts (+54 -0)

📄 Description

Linked issue

Closes #2575

Why this change

  • Personas have no image gallery of their own — only characters do — and there is no profile-wide/global image library. This adds persona galleries (parity with character galleries) and a top-level global Gallery with flat folders + sort.
  • It is also the foundation the Conversation custom emoji/sticker feature builds on (those tag gallery images).
  • Ports the galleries feature (originally landed on refactor in #2361) to the Node/staging stack — a re-implementation, since the original relied on the Tauri/Rust storage layer.

What changed

Server

  • New tables persona_images, gallery_folders, global_images — registered in the Drizzle schema, the startup migrations (db/migrate.ts, libsql backend), and the file-native store (file-backed-store.ts FILE_BACKED_TABLES + a personas → persona_images cascade), which is the default backend.
  • Persona gallery storage + routes under /api/characters/personas/:id/gallery (list / upload / serve file / delete), mirroring the existing character gallery. Deleting a persona also removes its gallery directory and rows.
  • Global gallery storage + routes at /api/global-gallery:
    • Images: list (all / by folder / unfiled via ?folderId), upload (?folderId; a missing folder coerces to root, resolved before bytes are written so a bad id can't strand an orphan file), serve, delete (unlinks the file), and move (PATCH /:id).
    • Flat folders: list / create / rename / delete. Deleting a folder re-files its images to root.

Client

  • Persona editor: new Gallery tab (PersonaGalleryTab) mirroring the character gallery — upload dropzone, grid, lightbox, with upload-error toasts.
  • New top-level Global Gallery panel (GlobalGalleryPanel): 2-column grid, newest/oldest sort, flat folder chips (All / Unfiled / per-folder with counts + create / rename / delete), drag-an-image-onto-a-folder to move, and a lightbox with a folder-move dropdown + download + delete.
  • Mounted via the RightPanel registry + a TopBar toggle button; "gallery" added to the UI store Panel type.
  • Hooks: persona gallery hooks in use-characters.ts; new use-global-gallery.ts (image list / upload / delete / optimistic move + folder CRUD).

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Automated: pnpm check passes locally — full build (shared + server + client Vite/PWA bundle) and lint across all packages. Storage/migrations smoke-tested against both backends (in-memory libsql + a temp file-native store): tables create, inserts work, and deleting a folder re-files its image to root.

In-browser playtest (done): uploading to the global Gallery panel and the persona Gallery tab; folder create / rename / delete; drag-an-image-onto-a-folder; move via the lightbox dropdown; newest/oldest sort; and deleting a folder re-filing its images to Unfiled — all confirmed working.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Assessment: galleries are additive — no version bump, and no existing docs describe gallery scope, so I don't expect doc changes.

UI evidence (if applicable)

{8E7E0AE6-63E5-4A42-8B1D-F13C6B29406D} {2A4B1C1B-C3BE-4371-9D12-48A35EB51731} {DEDFC7A6-D7D2-429D-9CDF-4544A94826C5} {5F2CDA3A-16D5-46E9-8333-738E0621E4E7} {807669D9-4FCB-4887-85EC-714C370B49AE}

Summary by CodeRabbit

Release Notes

  • New Features
    • Added Gallery panel accessible from the right sidebar for managing profile-wide images
    • Introduced global gallery with folder-based organization, enabling drag-and-drop image movement and folder management (create, rename, delete)
    • Added persona-specific gallery support with image upload, download, and deletion
    • Implemented image lightbox viewer with folder assignment and download capabilities
    • Responsive grid layout for displaying images with loading and empty states

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2584 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 6/15/2026 **Status:** ✅ Merged **Merged:** 6/16/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/staging-persona-global-galleries` --- ### 📝 Commits (8) - [`def5d0a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/def5d0ab73a87d9a94a574be470370a1a4f7ab91) feat(gallery): add persona + global gallery server (schema, storage, routes) - [`50bf0f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/50bf0f37db69cd06351e3390baaa933641018dfe) feat(gallery): persona gallery tab + global gallery panel (client) - [`5307bfe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5307bfeb65a7c7c2b778c3491dfd534d09094d77) fix(gallery): register persona/global gallery tables in the file-native store - [`7e3182c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7e3182c311079d6c043a35d175d10fc4497cf049) fix(gallery): surface persona gallery upload errors with a toast - [`e51185c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e51185c02a5053718a2e6675a19f798be4d98603) fix(gallery): responsive global gallery grid on small screens - [`091bea0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/091bea0a7988117a4524360be197507039821440) fix(gallery): responsive persona + character gallery grids on mobile - [`cb5004e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cb5004efd60948f04d23940529c77b4c2c230cd4) fix(gallery): address review — path-traversal guards, upload rollback, indexes - [`b8eb6be`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b8eb6be8c4322a174318dc7bc3c0d0b99930d5fb) Merge staging into persona global galleries ### 📊 Changes **17 files changed** (+1392 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/characters/CharacterEditor.tsx` (+2 -2) 📝 `packages/client/src/components/layout/RightPanel.tsx` (+6 -1) 📝 `packages/client/src/components/layout/TopBar.tsx` (+14 -1) ➕ `packages/client/src/components/panels/GlobalGalleryPanel.tsx` (+434 -0) 📝 `packages/client/src/components/personas/PersonaEditor.tsx` (+164 -0) 📝 `packages/client/src/hooks/use-characters.ts` (+68 -0) ➕ `packages/client/src/hooks/use-global-gallery.ts` (+148 -0) 📝 `packages/client/src/stores/ui.store.ts` (+1 -0) 📝 `packages/server/src/db/file-backed-store.ts` (+4 -0) 📝 `packages/server/src/db/migrate.ts` (+34 -0) 📝 `packages/server/src/db/schema/gallery.ts` (+50 -1) 📝 `packages/server/src/routes/characters.routes.ts` (+133 -1) ➕ `packages/server/src/routes/global-gallery.routes.ts` (+186 -0) 📝 `packages/server/src/routes/index.ts` (+2 -0) 📝 `packages/server/src/services/mari-db/mari-db.service.ts` (+1 -0) ➕ `packages/server/src/services/storage/global-gallery.storage.ts` (+91 -0) ➕ `packages/server/src/services/storage/persona-gallery.storage.ts` (+54 -0) </details> ### 📄 Description ## Linked issue Closes #2575 ## Why this change - Personas have no image gallery of their own — only characters do — and there is no profile-wide/global image library. This adds **persona galleries** (parity with character galleries) and a top-level **global Gallery** with flat folders + sort. - It is also the foundation the Conversation custom emoji/sticker feature builds on (those tag gallery images). - Ports the galleries feature (originally landed on `refactor` in #2361) to the Node/`staging` stack — a re-implementation, since the original relied on the Tauri/Rust storage layer. ## What changed **Server** - New tables `persona_images`, `gallery_folders`, `global_images` — registered in the Drizzle schema, the startup migrations (`db/migrate.ts`, libsql backend), and the **file-native store** (`file-backed-store.ts` `FILE_BACKED_TABLES` + a `personas → persona_images` cascade), which is the default backend. - **Persona gallery** storage + routes under `/api/characters/personas/:id/gallery` (list / upload / serve file / delete), mirroring the existing character gallery. Deleting a persona also removes its gallery directory and rows. - **Global gallery** storage + routes at `/api/global-gallery`: - Images: list (all / by folder / unfiled via `?folderId`), upload (`?folderId`; a missing folder coerces to root, resolved before bytes are written so a bad id can't strand an orphan file), serve, delete (unlinks the file), and move (`PATCH /:id`). - Flat folders: list / create / rename / delete. Deleting a folder re-files its images to root. **Client** - Persona editor: new **Gallery** tab (`PersonaGalleryTab`) mirroring the character gallery — upload dropzone, grid, lightbox, with upload-error toasts. - New top-level **Global Gallery** panel (`GlobalGalleryPanel`): 2-column grid, newest/oldest sort, flat folder chips (All / Unfiled / per-folder with counts + create / rename / delete), drag-an-image-onto-a-folder to move, and a lightbox with a folder-move dropdown + download + delete. - Mounted via the `RightPanel` registry + a `TopBar` toggle button; `"gallery"` added to the UI store `Panel` type. - Hooks: persona gallery hooks in `use-characters.ts`; new `use-global-gallery.ts` (image list / upload / delete / optimistic move + folder CRUD). ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes Automated: `pnpm check` passes locally — full build (shared + server + client Vite/PWA bundle) and lint across all packages. Storage/migrations smoke-tested against **both** backends (in-memory libsql + a temp file-native store): tables create, inserts work, and deleting a folder re-files its image to root. In-browser playtest (done): uploading to the **global Gallery** panel and the **persona Gallery** tab; folder create / rename / delete; drag-an-image-onto-a-folder; move via the lightbox dropdown; newest/oldest sort; and deleting a folder re-filing its images to **Unfiled** — all confirmed working. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) Assessment: galleries are additive — no version bump, and no existing docs describe gallery scope, so I don't expect doc changes. ## UI evidence (if applicable) <img width="384" height="382" alt="{8E7E0AE6-63E5-4A42-8B1D-F13C6B29406D}" src="https://github.com/user-attachments/assets/cca394b2-195a-470f-a5e4-ec2e1b22311d" /> <img width="321" height="347" alt="{2A4B1C1B-C3BE-4371-9D12-48A35EB51731}" src="https://github.com/user-attachments/assets/4f7620ae-5f52-4ec9-ac17-399923f27b77" /> <img width="809" height="568" alt="{DEDFC7A6-D7D2-429D-9CDF-4544A94826C5}" src="https://github.com/user-attachments/assets/f0f9dfde-bc7a-4b1d-a7c4-46fdd8d98d70" /> <img width="336" height="356" alt="{5F2CDA3A-16D5-46E9-8333-738E0621E4E7}" src="https://github.com/user-attachments/assets/b49206d9-5f39-45a0-8dd5-5e46cd231a88" /> <img width="384" height="311" alt="{807669D9-4FCB-4887-85EC-714C370B49AE}" src="https://github.com/user-attachments/assets/d8e641df-e45c-4567-9ecb-43657e881df8" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added Gallery panel accessible from the right sidebar for managing profile-wide images * Introduced global gallery with folder-based organization, enabling drag-and-drop image movement and folder management (create, rename, delete) * Added persona-specific gallery support with image upload, download, and deletion * Implemented image lightbox viewer with folder assignment and download capabilities * Responsive grid layout for displaying images with loading and empty states <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:18:22 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5672
No description provided.