附件:支持视频 / 文档上传,可预览的浏览器直接看,预览不了的给下载

之前节点附件只能传图片和 PDF(accept 过滤 + 20MB 上限),视频传不上来。
本批放开:MP4 / MOV / PDF / Word / Excel / ZIP 都能作为附件上传,
仍走同一份 Uploads::handleFiles(MIME 白名单三层识别不变),存进已配置的 OSS。

大小分级:照片仍走 photo_max_mb(管理员可调),视频与文档放宽到 40MB
(Uploads::MAX_FILE_BYTES,给线上 post_max_size=50M 留余量),先 detect 再按
is_image 选上限。前端 form.php / attachments.php 同步拦截并按类型细分暂存区图标。

预览走灯箱四类型视图:图片(img)/ 视频(<video>,配合 media/show 新增的
HTTP Range 单区间 206/416,进度条可拖、Safari 也能播)/ PDF(iframe 内嵌
阅读器)/ 其它(Word / ZIP 等浏览器预览不了 → 灯箱里给下载按钮)。
dl=1 下载不接 Range;多区间回退 200 全量。

已验证:本地全链 11 步全绿(渲染检查 308 项、表单交互 73 项);
远端 e2e 0 失败(新增 mp4 上传落库 video/mp4、Range 206/416/后缀区间/
多区间回退/dl 不接 Range 专项断言);部署后双 PHP 渲染逐字节一致。
This commit is contained in:
2026-09-23 16:22:01 +08:00
parent c50bc7de2b
commit cbfdcb9d16
6 changed files with 231 additions and 47 deletions
+33
View File
@@ -1192,3 +1192,36 @@ input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; padding
}
.node-member-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-member-emotion { font-size: 13px; line-height: 1; }
/* ── 19. 灯箱的视频 / PDF / 下载视图 ──────────────────────────────────────── */
.lightbox-video {
max-width: min(1100px, 92vw);
max-height: 74vh;
border-radius: var(--radius);
background: #000;
box-shadow: var(--shadow-lg);
}
.lightbox-frame {
width: min(1000px, 92vw);
height: 78vh;
border: 0;
border-radius: var(--radius);
background: #fff;
box-shadow: var(--shadow-lg);
}
.lightbox-file {
display: flex; flex-direction: column; align-items: center; gap: 12px;
padding: 36px 28px;
background: var(--surface);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
max-width: min(420px, 88vw);
text-align: center;
}
.lightbox-file-icon { font-size: 52px; line-height: 1; }
.lightbox-file-text {
margin: 0; font-size: 15px; font-weight: 650; color: var(--text);
overflow-wrap: anywhere;
}
.lightbox-file-hint { margin: 0; font-size: 13px; color: var(--text-mute); }
.lightbox-file-dl { display: inline-block; }