Repository navigation
feat(saves): encode screenshots as bounded JPEGs - #289
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
状态存档和原生存档的新截图在创建持久草稿前统一转为 JPEG,质量 0.95、高度最多 540、宽度等比缩放,仅缩小。透明区域填黑。
截图处理失败仍可保存进度;覆盖存档时沿用原有的未提供截图语义。已有截图不批量转换,服务端图片接口和 runtime 契约不变。
Evidence
makeDraft直接接收 runtime 截图 Blob,保留其原始格式和尺寸。After: 浏览器真实编码验证 1920×1080 → 960×540、320×240 保持原尺寸、1080×1920 → 304×540,返回 JPEG。
After: 用例读取服务端截图并解码,断言 JPEG 且高度 ≤ 540;四视口共 40 项浏览器用例通过(RPG fixture 环境补齐后,重跑对应 4 项通过)。
Merge Danger
Door: two-way
可以回退代码;已经生成的有损 JPEG 不会还原成原截图。存档进度内容不受编码影响,无数据库迁移。
Blast Radius: Saves
影响新建或更新的持久存档截图;编码失败会省略本次截图,不阻止保存进度。