mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #713] [MERGED] Round-trip persona & character native export/import (avatar, sprites, gallery) #4740
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4740
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/713
Author: @LukaTheHero
Created: 5/11/2026
Status: ✅ Merged
Merged: 5/11/2026
Merged by: @LukaTheHero
Base:
main← Head:fix/persona-export-import-roundtrip📝 Commits (3)
80cdb27fix: round-trip persona & character native export/import with avatar, sprites, and galleryf92894bfix: address CodeRabbit review on persona/character export round-trip93c38c2fix: drop unused parseFailure flag in handleMarinaraImport📊 Changes
8 files changed (+465 additions, -36 deletions)
View changed files
📝
packages/client/src/components/characters/CharacterEditor.tsx(+6 -9)📝
packages/client/src/components/modals/ImportCharacterModal.tsx(+40 -0)📝
packages/client/src/components/modals/ImportPersonaModal.tsx(+28 -0)📝
packages/client/src/components/panels/SettingsPanel.tsx(+36 -14)📝
packages/client/src/components/ui/ExportFormatDialog.tsx(+11 -3)📝
packages/server/src/routes/characters.routes.ts(+110 -9)📝
packages/server/src/routes/import.routes.ts(+72 -0)📝
packages/server/src/services/import/marinara.importer.ts(+162 -1)📄 Description
Why
Closes #709.
Exporting a persona or character as Marinara Native and re-importing the file was dropping the profile picture and several other tab contents. The native envelope only carried the row's plain text fields —
avatarPathwas stripped (and the file was never embedded), sprites lived in a separatedata/sprites/<id>/directory that the export ignored, and the character gallery was a whole separate table that nothing touched. On top of that, the persona importer was throwing awaycomment,personaStats,altDescriptions,tags, andsavedStatusOptionsbecause those fields weren't wired intocreatePersona.The user's expectation is that Marinara Native means "everything round-trips." This PR makes that true.
What changes
Native export now embeds binary data as base64 data URLs inside the JSON envelope:
data.avatar— the profile picture (personas and characters)data.sprites— every file indata/sprites/<id>/as{ filename, data }data.gallery— everycharacter_imagesrow + the file on disk as{ filename, prompt, provider, model, width, height, data }(characters only)Native import unpacks all three and writes them back: avatar to
data/avatars/, sprites todata/sprites/<newId>/(filenames sanitized), gallery binaries todata/gallery/characters/<newId>/plus matchingcharacter_imagesrows. Image bytes are validated throughisAllowedImageBufferbefore anything hits disk.Persona importer now also passes
comment,personaStats,altDescriptions,tags,savedStatusOptionsthrough tocreatePersonaso they survive the round-trip.Compatible JSON export/import is unchanged — it's still avatar-less and field-minimal, as expected by other tools.
Export dialog UX (characters only): a third "Compatible PNG Card" card joins Marinara Native and Compatible JSON, and the standalone PNG-card toolbar button is removed so the export menu isn't bloated. The PNG path still hits the existing
/characters/:id/export-pngendpoint.Backward compat: an earlier iteration shipped a
.marinarazip format briefly. The newPOST /import/marinara-packagemultipart endpoint accepts those zips (data.json + avatar.*) so anyone who already exported one can still import it. Client modals detect the PK zip signature on dropped files and route to that endpoint automatically.Files
packages/server/src/routes/characters.routes.ts— embed avatar/sprites/gallery in native envelopespackages/server/src/routes/import.routes.ts— new/import/marinara-packagemultipart route for legacy.marinarazip filespackages/server/src/services/import/marinara.importer.ts—restoreSprites,restoreCharacterGallery, persona field passthrough, shareddecodeImageDataUrlhelperpackages/client/src/components/ui/ExportFormatDialog.tsx— newcompatible-pngchoice +showPngOptionproppackages/client/src/components/characters/CharacterEditor.tsx— wire up PNG choice; drop the standalone toolbar buttonpackages/client/src/components/modals/ImportCharacterModal.tsx,ImportPersonaModal.tsx,panels/SettingsPanel.tsx— zip-signature detection so legacy.marinarazips still importValidation
pnpm checkpasses (impeccable-context + lint + build).Out of scope / known
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.