texxasrulez / inline_previewer
Secure inline attachment previews for Roundcube message view
Package info
github.com/texxasrulez/inline_previewer
Type:roundcube-plugin
pkg:composer/texxasrulez/inline_previewer
0.0.1
2026-03-06 21:00 UTC
Requires
- php: >=8.0
- roundcube/plugin-installer: >=0.3.0
README
inline_previewer adds secure inline attachment previews in Roundcube message view.
Features
- Inline attachment cards rendered below message view content.
- Supported previews (strict whitelist): images, PDF, and optional audio/video.
- Collapsed-by-default lazy previews with optional
Preview all/Collapse allcontrols. - Consistent fallback cards for unsupported files (filename, size, MIME, Download button).
- vCard attachments can be imported into address book directly from the card action.
- Office/vCard card handlers support
Open in new tabvia safe openable-type allowlist. - Keeps existing Roundcube attachment download behavior intact.
Installation
- Copy
plugins/inline_previewerinto your Roundcubeplugins/directory. - Copy
plugins/inline_previewer/config.inc.php.disttoplugins/inline_previewer/config.inc.php. - Add
inline_previewerto$config['plugins']in Roundcube main config. - Clear Roundcube cache if needed.
Configuration
Main options in config.inc.php:
$config['inline_previewer_enabled']$config['inline_previewer_disable_vcard_import_when_vcard_attach']$config['inline_previewer_debug_log']$config['inline_previewer_collapsed_by_default']$config['inline_previewer_show_bulk_controls']$config['inline_previewer_enable_media']$config['inline_previewer_enable_text_preview']$config['inline_previewer_enable_office_preview']$config['inline_previewer_allow_svg']$config['inline_previewer_max_preview_size']$config['inline_previewer_allowed_mime_types']$config['inline_previewer_allowed_extensions']$config['inline_previewer_openable_mime_types']$config['inline_previewer_openable_extensions']
Security Notes
- HTML/XHTML attachments are never previewable by default whitelist.
- MIME type and extension are both checked before enabling preview.
- Preview size is capped (
inline_previewer_max_preview_size). - Preview responses are served through Roundcube's authenticated attachment action (
_action=get) only. - Preview requests apply stricter headers via
message_part_get:Content-Security-PolicyX-Content-Type-Options: nosniffReferrer-Policy: no-referrer
- No remote URL fetching is used; previews only target current message attachments.
- Optional compatibility guard disables plugin vCard import when
vcard_attachis active.
Hook Usage
message_load: reads message attachments and computes per-file preview eligibility.render_page: injects plugin CSS/JS and attachment metadata into the message page.message_part_get: enforces safe inline headers and keeps non-whitelisted requests as download.
Manual Test Plan
- Open a message with JPG/PNG/PDF attachments and verify each card shows
Preview+Download+Open in new tab. - Expand previews and confirm lazy-load behavior (content loads only after opening).
- Attach a file larger than configured max size and verify
Too large to previewappears. - Attach unsupported types (
.html,.js,.zip) and verify no inline preview is offered. - Enable media config and verify MP3/MP4 preview works; disable and verify it is blocked.
- Confirm direct Download links still work for all attachment types.
- Inspect preview response headers in browser devtools and verify CSP + nosniff are present.
- Test with
vcard_attachenabled and verify inline_previewerImportbutton is hidden/disabled by config default. - Enable
inline_previewer_debug_logand confirm failures write[inline_previewer]entries in Roundcube error log.
Changelog
0.0.1
- Added compatibility guard for
vcard_attachoverlap on vCard import. - Added optional debug logging for preview/import failure paths.
- Added additional preview support for text and office file types.