[PR #2585] [MERGED] feat(gallery): custom emoji and sticker tagging #5674

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/2585
Author: @kolacheee
Created: 6/16/2026
Status: ✅ Merged
Merged: 6/16/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/staging-custom-emoji-tagging


📝 Commits (10+)

  • 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
  • 1bd3f9c feat(gallery): custom emoji/sticker tagging columns + endpoints
  • 0a2d3e2 feat(gallery): custom emoji/sticker tag UI on gallery images
  • e26276d fix(gallery): address review — error toasts, persona key, server tag length cap

📊 Changes

20 files changed (+1887 additions, -6 deletions)

View changed files

📝 packages/client/src/components/characters/CharacterEditor.tsx (+6 -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 (+452 -0)
📝 packages/client/src/components/personas/PersonaEditor.tsx (+168 -0)
➕ packages/client/src/components/ui/CustomEmojiTagButton.tsx (+158 -0)
📝 packages/client/src/hooks/use-characters.ts (+95 -0)
➕ packages/client/src/hooks/use-global-gallery.ts (+162 -0)
➕ packages/client/src/lib/custom-emoji.ts (+59 -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 (+70 -0)
📝 packages/server/src/db/schema/gallery.ts (+62 -1)
📝 packages/server/src/routes/characters.routes.ts (+206 -1)
➕ packages/server/src/routes/global-gallery.routes.ts (+228 -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/character-gallery.storage.ts (+16 -0)
➕ packages/server/src/services/storage/global-gallery.storage.ts (+107 -0)
➕ packages/server/src/services/storage/persona-gallery.storage.ts (+70 -0)

📄 Description

Linked issue

Closes #2576

Why this change

  • Lets users tag any gallery image (character / persona / global) as a custom emoji or sticker and give it a name — the data-model + UI layer the Conversation custom emoji/sticker feature builds on.
  • Ports the tagging feature (originally landed on refactor in #2362) to the Node/staging stack. The refactor stored galleries as arbitrary JSON, so it needed no schema change; staging has fixed columns, so this adds real columns + tag endpoints.

What changed

Server

  • New nullable custom_kind / custom_name columns on character_images, persona_images, global_images (Drizzle schema + libsql CREATE TABLE/COLUMN_MIGRATIONS; the file-native backend derives columns from the schema).
  • A PATCH .../tag endpoint + storage setTag for each gallery (/api/characters/:id/gallery/:imageId/tag, /api/characters/personas/:id/gallery/:imageId/tag, /api/global-gallery/:id/tag). Tag, rename, switch-kind, and untag are all the same write; measured width/height ride along and are persisted opportunistically. Light validation: customKind ∈ emoji|sticker|null, name required when tagging.

Client

  • New CustomEmojiTagButton corner overlay on every gallery image (character, persona, global): a Tag badge that opens a context menu — Make emoji / Make sticker, or when tagged Rename / Switch kind / Remove.
  • New lib/custom-emoji.ts: client-side dimension gating (emoji ≤256×256, sticker ≤512×512 — over-size flashes the card red + toasts, and an over-size emoji that fits as a sticker says so), name slugifying (lowercase, a-z0-9→_, max 32), and an image-dimension reader.
  • Tag mutation hooks in use-characters.ts (character + persona) and use-global-gallery.ts (global); customKind/customName added to the gallery image types.

Scope note

Faithful to refactor #2362, this is the tagging model + UI only — it does not include emoji rendering in messages, pickers, or :name: prompt tokens (those are the later full-emoji work). Also matching #2362, there is no name-uniqueness rule at this stage (uniqueness becomes relevant when rendering needs deterministic resolution, in the later work).

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

  • pnpm check passes (full build + lint). Tag persistence smoke-tested against the file-native backend: tag sets custom_kind/custom_name (+ measured dims), switch-kind and untag work.
  • Tag an image as emoji and as sticker in each gallery (character, persona, global); confirm the corner badge shows the name.
  • Rename, switch kind, and remove a tag.
  • Over-size rejection: a >256px image refused as an emoji (red flash + toast; "fits as a sticker" hint), accepted as a sticker if ≤512px.
  • Light/dark mode + mobile.

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: additive feature — no version bump expected.

UI evidence (if applicable)

{901A40EC-2990-45BB-B3DC-CB966377429B} {79999068-F28F-4841-8ABC-F9F528F50D3E} {933033B0-9570-479B-A316-D6287A1225AC} {ACAE6725-FCDE-4BF1-A113-CE6B19D99F02} {EB060A25-D63F-4438-8091-03095D25E31B}

Summary by CodeRabbit

Release Notes

  • New Features
    • Added gallery management for character and persona reference images with upload and delete functionality
    • Introduced global gallery with folder organization, drag-and-drop file movement, and image filtering
    • Enabled tagging gallery images as custom emoji or stickers with automatic dimension validation
    • Added lightbox modal for viewing, downloading, and managing individual gallery images
    • New Gallery panel accessible from the top bar and right sidebar

🔄 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/2585 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 6/16/2026 **Status:** ✅ Merged **Merged:** 6/16/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/staging-custom-emoji-tagging` --- ### 📝 Commits (10+) - [`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 - [`1bd3f9c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1bd3f9cad9c5df4d51715f411e1c973890b278bf) feat(gallery): custom emoji/sticker tagging columns + endpoints - [`0a2d3e2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0a2d3e28f61cb007952cd3cbd4a671a61a305a3d) feat(gallery): custom emoji/sticker tag UI on gallery images - [`e26276d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e26276d7631c27214ef1292c07854697acb8067d) fix(gallery): address review — error toasts, persona key, server tag length cap ### 📊 Changes **20 files changed** (+1887 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/characters/CharacterEditor.tsx` (+6 -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` (+452 -0) 📝 `packages/client/src/components/personas/PersonaEditor.tsx` (+168 -0) ➕ `packages/client/src/components/ui/CustomEmojiTagButton.tsx` (+158 -0) 📝 `packages/client/src/hooks/use-characters.ts` (+95 -0) ➕ `packages/client/src/hooks/use-global-gallery.ts` (+162 -0) ➕ `packages/client/src/lib/custom-emoji.ts` (+59 -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` (+70 -0) 📝 `packages/server/src/db/schema/gallery.ts` (+62 -1) 📝 `packages/server/src/routes/characters.routes.ts` (+206 -1) ➕ `packages/server/src/routes/global-gallery.routes.ts` (+228 -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/character-gallery.storage.ts` (+16 -0) ➕ `packages/server/src/services/storage/global-gallery.storage.ts` (+107 -0) ➕ `packages/server/src/services/storage/persona-gallery.storage.ts` (+70 -0) </details> ### 📄 Description ## Linked issue Closes #2576 ## Why this change - Lets users tag any gallery image (character / persona / global) as a **custom emoji** or **sticker** and give it a name — the data-model + UI layer the Conversation custom emoji/sticker feature builds on. - Ports the tagging feature (originally landed on `refactor` in #2362) to the Node/`staging` stack. The refactor stored galleries as arbitrary JSON, so it needed no schema change; staging has fixed columns, so this adds real columns + tag endpoints. ## What changed **Server** - New nullable `custom_kind` / `custom_name` columns on `character_images`, `persona_images`, `global_images` (Drizzle schema + libsql `CREATE TABLE`/`COLUMN_MIGRATIONS`; the file-native backend derives columns from the schema). - A `PATCH .../tag` endpoint + storage `setTag` for each gallery (`/api/characters/:id/gallery/:imageId/tag`, `/api/characters/personas/:id/gallery/:imageId/tag`, `/api/global-gallery/:id/tag`). Tag, rename, switch-kind, and untag are all the same write; measured `width`/`height` ride along and are persisted opportunistically. Light validation: `customKind` ∈ `emoji|sticker|null`, name required when tagging. **Client** - New `CustomEmojiTagButton` corner overlay on every gallery image (character, persona, global): a Tag badge that opens a context menu — **Make emoji / Make sticker**, or when tagged **Rename / Switch kind / Remove**. - New `lib/custom-emoji.ts`: client-side dimension gating (**emoji ≤256×256, sticker ≤512×512** — over-size flashes the card red + toasts, and an over-size emoji that fits as a sticker says so), name slugifying (lowercase, `a-z0-9`→`_`, max 32), and an image-dimension reader. - Tag mutation hooks in `use-characters.ts` (character + persona) and `use-global-gallery.ts` (global); `customKind`/`customName` added to the gallery image types. ## Scope note Faithful to refactor #2362, this is the **tagging model + UI only** — it does **not** include emoji rendering in messages, pickers, or `:name:` prompt tokens (those are the later full-emoji work). Also matching #2362, there is **no name-uniqueness rule** at this stage (uniqueness becomes relevant when rendering needs deterministic resolution, in the later work). ## 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 - `pnpm check` passes (full build + lint). Tag persistence smoke-tested against the file-native backend: tag sets `custom_kind`/`custom_name` (+ measured dims), switch-kind and untag work. - Tag an image as emoji and as sticker in each gallery (character, persona, global); confirm the corner badge shows the name. - Rename, switch kind, and remove a tag. - Over-size rejection: a >256px image refused as an emoji (red flash + toast; "fits as a sticker" hint), accepted as a sticker if ≤512px. - Light/dark mode + mobile. ## 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: additive feature — no version bump expected. ## UI evidence (if applicable) <img width="333" height="298" alt="{901A40EC-2990-45BB-B3DC-CB966377429B}" src="https://github.com/user-attachments/assets/322354e0-f1a0-4dfb-ac5f-4590645aef74" /> <img width="174" height="111" alt="{79999068-F28F-4841-8ABC-F9F528F50D3E}" src="https://github.com/user-attachments/assets/9b1e077b-29a3-4b95-ad62-9f6b49a7dfce" /> <img width="165" height="122" alt="{933033B0-9570-479B-A316-D6287A1225AC}" src="https://github.com/user-attachments/assets/3b5fcc9c-9919-4bc3-8777-98a8aa39c7dc" /> <img width="332" height="219" alt="{ACAE6725-FCDE-4BF1-A113-CE6B19D99F02}" src="https://github.com/user-attachments/assets/986893fe-3d3c-4012-83e3-5a714826163d" /> <img width="668" height="255" alt="{EB060A25-D63F-4438-8091-03095D25E31B}" src="https://github.com/user-attachments/assets/640e495c-41f1-4b6d-89e4-92583bf32d5f" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added gallery management for character and persona reference images with upload and delete functionality * Introduced global gallery with folder organization, drag-and-drop file movement, and image filtering * Enabled tagging gallery images as custom emoji or stickers with automatic dimension validation * Added lightbox modal for viewing, downloading, and managing individual gallery images * New Gallery panel accessible from the top bar and right sidebar <!-- 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#5674
No description provided.