mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7829] [MERGED] feat(chat): load images from other websites on request #7956
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#7956
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/7829
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/harden-remote-images📝 Commits (2)
3358124feat(chat): load images from other websites on request94b0639fix(chat): approve a GIF only once it is sent, larger Load image tap target📊 Changes
22 files changed (+1020 additions, -203 deletions)
View changed files
📝
docs/appearance/card-css-theming.md(+1 -0)📝
docs/settings/settings-overview.md(+4 -0)➕
e2e/remote-message-images.e2e.ts(+232 -0)📝
packages/client/src/components/bot-browser/BotBrowserView.tsx(+6 -3)📝
packages/client/src/components/chat/ChatMessage.tsx(+27 -4)📝
packages/client/src/components/chat/ConversationInput.tsx(+2 -0)📝
packages/client/src/components/chat/ConversationMessageShared.tsx(+19 -16)📝
packages/client/src/components/panels/SettingsPanel.tsx(+9 -0)📝
packages/client/src/hooks/use-settings-sync.ts(+11 -0)📝
packages/client/src/lib/card-css.ts(+41 -151)📝
packages/client/src/lib/chat-html.ts(+19 -2)📝
packages/client/src/lib/chat-message-css.ts(+148 -19)📝
packages/client/src/lib/markdown.tsx(+3 -8)➕
packages/client/src/lib/remote-image-placeholder.tsx(+53 -0)➕
packages/client/src/lib/remote-image-policy.ts(+106 -0)➕
packages/client/src/lib/remote-images.ts(+66 -0)📝
packages/client/src/lib/settings-registry.ts(+11 -0)📝
packages/client/src/localization/locales/en.json(+7 -0)📝
packages/client/src/stores/ui.store.ts(+18 -0)📝
packages/client/src/styles/globals.css(+73 -0)...and 2 more files
📄 Description
Linked issue
No linked issue. This comes from a pre-release hardening pass of message rendering, following the maintainer's decision to make images from other websites click-to-load.
Why this change
Message content (model replies, greetings, card notes) can include images and CSS that point at any website. Until now the browser fetched those as soon as a message appeared, with nothing for the user to decide. A message could make Marinara contact a site the user never chose to visit, and whatever was in the image address went with it.
Now an image from another website waits behind a small Load image placeholder unless the user loads it or turns on a new setting. Once loaded, it stays loaded: the user is never asked again for that image, on any device.
The same pass tightens the CSS scoping for card creator notes and message styles, so their selectors can only match things inside their own box.
What changed
lib/remote-images.ts,lib/remote-image-policy.ts,lib/remote-image-placeholder.tsx):http(s)on a different origin than the app. The app's own files (/api/...uploads, gallery, generated images, sprites, avatars),data:andblob:URLs are unaffected.!importantso message or card CSS cannot hide, resize or relabel it.sanitizeChatHtmlholds images in its final pass (HTML messages, swipes, translations, greeting previews, Bot Browser notes).renderContentpasses the policy and handles the button click on the message box.lib/markdown.tsx) uses the same placeholder, so Conversation messages, Professor Mari, the omnibar, Game journal and character library notes follow it too. A message that is just an image link (Conversation) does as well.url(),image-set()andsrc()sources on other websites are dropped from inline styles and message<style>blocks.ui.store.ts,use-settings-sync.ts): approved image addresses are stored with the synced UI settings (the server-sideuiapp setting) and in the browser copy, so they apply immediately after a reload and arrive on other devices. Startup sync merges this browser's and the server's approvals instead of letting one side overwrite the other. The list is capped (1000 addresses, 200k characters) to stay well inside the settings size limit.extra: the same card image usually appears in many messages and in previews that have no message (greetings, Bot Browser), and the browser copy lets an approved image render on the first paint without a placeholder flash.lib/card-css.ts,lib/chat-message-css.ts):scopeCssRules), replacing the hand-written block splitter. The tokenizer now treats escaped characters the way browsers do.~,+or||, or:root ~ …,body:not(…) + …, Exclusive-mode[data-card-css] ~ …) are dropped. Child selectors (> …) stay.@property. A block left open at the end is closed the way browsers do.! importantis stripped like!important.settings/settings-overview.md(new Text Rules entry) andappearance/card-css-theming.md(nested rules and sibling selectors).remote-message-images-security: which addresses count as other websites, approval list limits, CSS sources held with the setting off and kept with it on.chat-message-css-security(extended): leading combinators, escaped quotes in card CSS, card sibling selectors in Chat and Exclusive scope, card at-rules, spaced! important.stagingand pass with this change.pnpm regression:securitypicks both up.remote-message-images.e2e.ts: sanitizer output with the setting off, approved and on. A roleplay chat with Markdown, HTML and broken images checks that nothing is requested before a click and that a click loads only that image and saves it to the server. It also checks that a failed load is not saved, that re-rendering never shows an approved image's placeholder, and that the image shows right away after a reload and in a second browser context. Turning the setting on shows everything.Behaviour changes users may notice:
@propertyor sibling selectors at the top of a rule no longer applies.Validation
pnpm checkpasses locallyCONTRIBUTING.mdCommands the agent ran on this branch:
pnpm check: passed (one existing lint warning inHomeProfessorMariChat.tsx, not touched here).pnpm regression:security: 24/24 in thesecuritygroup after rerunningmultiplayer-control-security, which first timed out at 30 s under machine load and passed alone in 28.6 s. Theruntime-integrity,shell-sandbox,extension-ipc,android-local-authanddocker-proxy-authgroups all passed.chat-message-css-securityandremote-message-images-securityfail against thestagingversions ofchat-message-css.ts,card-css.tsandremote-images.ts, and pass with this change.assigned-issue-sweep,roleplay-streaming,persona-client-contract,open-issues,chat-html-newlines,theme-css-securityandjanny-character-import.desktop-chromiumwith these specs, all passing:remote-message-images.e2e.ts.chat-open-bottom.e2e.ts. Its conversation case failed once on a cold dev server and passed when rerun.roleplay-commands.e2e.tscases for inline rolls, in-line illustrations and documents.core-flows.e2e.ts: "Downloaded cards use Marinara destination and lorebook choices" (Bot Browser notes).chat-insights.e2e.ts: "chat search, stats and story exports".Manual verification notes
shows the placeholder with that site's name. Check that the browser's network panel shows no request to that site until Load image is clicked.<img>tags and CSS backgrounds looks right after loading each image, and with the setting on.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)English docs changed:
docs/settings/settings-overview.mdanddocs/appearance/card-css-theming.md. The release translation sweep covers the language packs.UI evidence (if applicable)
The placeholder is a dashed, theme-coloured pill: the website's name, then a Load image button. The e2e saves a screenshot of held Markdown and HTML images as
held-images.pngin its test output.Summary by CodeRabbit
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.