定制 texxasrulez/inline_previewer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

texxasrulez/inline_previewer

最新稳定版本:1.0.0

Composer 安装命令:

composer require texxasrulez/inline_previewer

包简介

Secure inline attachment previews for Roundcube message view

README 文档

README

Packagist Downloads Packagist Version Github License GitHub Stars GitHub Issues GitHub Contributors GitHub Forks Donate Paypal

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 all controls.
  • 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 tab via safe openable-type allowlist.
  • Keeps existing Roundcube attachment download behavior intact.

Installation

  1. Copy plugins/inline_previewer into your Roundcube plugins/ directory.
  2. Copy plugins/inline_previewer/config.inc.php.dist to plugins/inline_previewer/config.inc.php.
  3. Add inline_previewer to $config['plugins'] in Roundcube main config.
  4. 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-Policy
    • X-Content-Type-Options: nosniff
    • Referrer-Policy: no-referrer
  • No remote URL fetching is used; previews only target current message attachments.
  • Optional compatibility guard disables plugin vCard import when vcard_attach is 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

  1. Open a message with JPG/PNG/PDF attachments and verify each card shows Preview + Download + Open in new tab.
  2. Expand previews and confirm lazy-load behavior (content loads only after opening).
  3. Attach a file larger than configured max size and verify Too large to preview appears.
  4. Attach unsupported types (.html, .js, .zip) and verify no inline preview is offered.
  5. Enable media config and verify MP3/MP4 preview works; disable and verify it is blocked.
  6. Confirm direct Download links still work for all attachment types.
  7. Inspect preview response headers in browser devtools and verify CSP + nosniff are present.
  8. Test with vcard_attach enabled and verify inline_previewer Import button is hidden/disabled by config default.
  9. Enable inline_previewer_debug_log and confirm failures write [inline_previewer] entries in Roundcube error log.

Changelog

0.0.1

  • Added compatibility guard for vcard_attach overlap on vCard import.
  • Added optional debug logging for preview/import failure paths.
  • Added additional preview support for text and office file types.

Versioning

  • inline_previewer now keeps its canonical version in inline_previewer::PLUGIN_VERSION inside inline_previewer.php.
  • inline_previewer::info() exposes the plugin metadata array used for self-identification.
  • Development builds should use a +dev suffix such as 1.2.0+dev.
  • Release builds should use a clean tagged version such as 1.2.0.

For a release bump:

  1. Update inline_previewer::PLUGIN_VERSION in inline_previewer.php or run sh scripts/bump-version.sh 1.2.0.
  2. Update CHANGELOG.md.
  3. Create the matching release tag after verification.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2026-03-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固