Serendipity
|
309c9429ea
|
refactor: ZXing对齐 — 容差50pct + 几何验证 + end-based中心 + 废弃代码清理
- detect.rs: 容差从40%提升到50% (对齐ZXing的moduleSize/2)
- detect.rs: 中心点改用ZXing end-based公式 (浮点精度, end - r4 - r3 - r2/2)
- detect.rs: 新增validate_finder_geometry()几何验证
module_size一致性<10% + 勾股定理偏差<15%
- detect.rs: compute_finder_deviation改用base=total/7
- detect.rs: 删除废弃的estimate_finder_size函数
- perspective.rs: count_finder_hits容差对齐 (base=total/7 + 50pct)
- web/main.rs + cli/main.rs: 修复Rust 1.96新版clippy规则
|
2026-06-21 23:01:46 +08:00 |
|
Serendipity
|
a03ab95ce5
|
fix: 解码器核心bug修复 — 容差计算+积分图像+Sauvola下溢
- detect.rs: finder比例容差改用 base=total/7 替代 avg=total/5
修复 1:1:3:1:1 模式匹配对任意module_size均正确工作
- detect.rs: finder尺寸估算改为5段总长度(完整28px)替代外圈暗环(4px)
修复版本号误判(原本将version 1误判为version 10)
- detect.rs: scan_row/scan_col 返回类型改为 (cx,cy,total_size) 三元组
- image.rs: 积分图像公式修正为 I(y+1,x+1)=I(y,x+1)+I(y+1,x)-I(y,x)+pixel
替换错误的 cumulative row_sum 公式
- image.rs: 积分和运算 u64→i64 避免 debug 模式溢出panic
- perspective.rs: count_finder_hits 应用相同容差修复
- mask.rs: test_score_rule2 改用 score_rule2_raw
- bch.rs: 测试适配 decode_format_info→3元组, decode_version_info→2元组
|
2026-06-21 22:19:00 +08:00 |
|
Serendipity
|
b053272825
|
fix: 安全漏洞修复 — CLI密码泄露 + margin上限 + 路径检查 + CSP/限速
CRITICAL:
- CLI --password 未提供时自动从 QRGEN_WIFI_PASSWORD 环境变量读取
避免密码出现在 ps aux / /proc/pid/cmdline 进程列表中
HIGH:
- unsafe from_utf8_unchecked SAFETY 注释增强, 详细解释为何有效
- CLI --margin 添加 value_parser range(0..=100), 防止 u8=255 导致内存爆炸
- Web CORS permissive 添加注释说明公开 API 设计理由
- GUI FS 权限收紧: 写权限从 /c/Users/33644/** 限制为 Downloads/Documents/Desktop/AppData
MEDIUM:
- 新增 QrError::InvalidEcLevel(String), 不再复用 InvalidVersion(0)
- --logo/--batch/--output_dir 均添加 check_path() 路径遍历检查
- Web 添加 tower::limit::ConcurrencyLimitLayer(10) 并发限制防 CPU 耗尽
- decode_image 添加 4096x4096 图片尺寸上限防解压炸弹
LOW:
- Web 添加 Content-Security-Policy 响应头
|
2026-06-21 16:09:08 +08:00 |
|
Serendipity
|
bd4ca718ac
|
feat: 解码器全面增强 — 多遍二值化 + 4点透视 + ECI/FNC1
Phase 1 — 二值化+检测增强:
- decoder/image.rs 重写: 中位数→Otsu→Sauvola 三遍自适应阈值
- 新增 load_gray() 公共 API 供调用方自定义预处理
- 反色QR码自动检测(5点采样法)
- 静区验证 + 包围盒(BoundingBox) + 解码置信度评分
- 定位图案比例偏差计算
Phase 2 — 4点透视变换+多QR码:
- decoder/perspective.rs 重写: DLT求解3x3单应矩阵
- 用3个定位图案+推算第4点构建4点对应
- 双线性插值替换最近邻采样
- 多角度旋转回退(7个预设角度)
- decode_all() 返回图像中所有QR码(按置信度降序)
Phase 3 — ISO合规:
- decoder/bch.rs: decode_format_info/version_info 返回汉明距离
- decoder/format.rs: 副本冲突时选汉明距离更小者
- decoder/mode_decode.rs: ECI指派号识别, FNC1/GS1检测(0101/1001)
- 结构化追加(0011)头部提取: position/total/parity
- DecodeResult 扩展: is_gs1, eci_designator, structured_append
验证: cargo check+clippy通过, 81+24测试全部通过
|
2026-06-21 16:00:11 +08:00 |
|
Serendipity
|
cd75141037
|
refactor: P0-P5 全面架构重构
P1 thiserror 类型化错误:
新增 core/src/error.rs QrError 枚举, 全链 String -> QrError,
包括 EmptyInput/InvalidVersion/DataTooLong/DecodeFail 等 8 种变体
P2 text_builder Tauri 统一:
新增 build_qr_text Tauri command, 删除前端 qrText.ts,
所有 mode 组件改为 invoke 调用 Rust 端构建文本
P3 QrConfig 颜色字段移除:
从 QrConfig/QrCode 移除 fg_color/bg_color,
改为 to_svg/to_image_bytes 参数传递
P4 前端 4 项合并:
Context 拆分为 StateContext+DispatchContext (H10),
新建 useModeForm 通用 hook (M11),
VCardMode grid-cols-2 网格布局 (M13),
persistHistory/loadHistory 迁至 utils/storage.ts (L9)
P5 算法优化:
MaskedView 懒计算替代 8 次 Matrix 克隆 (H9),
encoding_rs 精确 Kanji Shift JIS 映射 (H12)
验证: cargo check+clippy 通过, 81+24+7 全部测试通过
|
2026-06-21 15:09:10 +08:00 |
|
Serendipity
|
86d788e57c
|
feat: vCard 扩展 + 格式扩展 + 解码透视矫正 — v0.3.0
Phase 1: 格式扩展
- png.rs → image.rs,OutputFormat 枚举 (PNG/BMP/JPEG/WebP)
- CLI -f/--format,Web fmt 参数扩展,image crate +bmp feature
Phase 2: 解码增强
- 新增 decoder/perspective.rs — 旋转矫正(MVP)
- auto_correct: finder 检测→计算旋转角→仿射变换→再解码
- decode_image 自动重试矫正流水线
Phase 3: vCard 扩展
- 新增 5 字段:TITLE/URL/BDAY/NOTE/PHOTO
- Rust text_builder + TS qrText + VCardMode UI 同步
- CLI 新增 --title --vcard-url --birthday --note --photo
- 中/英 i18n 翻译
测试: 81 Rust + 19 前端全部通过
|
2026-06-19 21:38:58 +08:00 |
|
Serendipity
|
b41f6ee7df
|
feat: 格式扩展 — 支持 BMP/JPEG/WebP 输出
- png.rs 重命名为 image.rs,新增 OutputFormat 枚举
- QrCode::to_image_bytes 支持 PNG/BMP/JPEG/WebP
- CLI 新增 -f/--format 参数(png/bmp/jpeg/webp)
- Web API fmt 参数扩展至全部 4 种图像格式
- core/Cargo.toml: image crate 新增 bmp feature
|
2026-06-19 21:34:21 +08:00 |
|
Serendipity
|
b5bc944d71
|
fix: clippy manual_div_ceil → .div_ceil()
|
2026-06-19 21:16:42 +08:00 |
|
Serendipity
|
c7d5252651
|
feat: CLI 编码模式 + 批量生成 + text_builder
- 新增 core/src/text_builder.rs — Rust 版文本构造(WiFi/vCard/Email/Phone/SMS)
- CLI 新增 --mode 模式参数(wifi/vcard/email/phone/sms/url/batch)
- CLI 新增 --ssid/--password/--name/--phone/--to 等模式专属参数
- CLI 新增 --batch <file> 批量生成(JSON 数组 / CSV)
- 批量支持自动检测 JSON/CSV 格式并自动编号输出
- 新增 6 个 text_builder 单元测试(80 tests total)
|
2026-06-19 21:15:55 +08:00 |
|
Serendipity
|
38be82973e
|
feat: Logo 嵌入 — QR 码中央叠加自定义图片
- PNG 渲染:RgbaImage 上使用 imageops::overlay 叠加 logo
- SVG 渲染:base64 编码 logo 嵌入 <image> 标签
- QrCode::to_png_bytes / to_svg 新增 Option<logo_bytes> 参数
- Logo 默认占 QR 区域 25%,建议配合 H 级纠错使用
|
2026-06-19 21:12:44 +08:00 |
|
Serendipity
|
23ccb37b52
|
feat: 彩色 QR 码 — 自定义前景色/背景色
- QrConfig 新增 fg_color/bg_color 字段(CSS 十六进制格式)
- QrCode 存储解析后的 [u8;3] RGB
- PNG 渲染 Luma→Rgba,支持 RGBA 颜色
- SVG 渲染使用 QrCode 颜色字段
- CLI 新增 --fg/--bg 参数
- 新增 parse_hex_color 支持 #RRGGBB 和 #RGB
- 新增 2 个颜色测试(74 tests total)
|
2026-06-19 21:10:56 +08:00 |
|
Serendipity
|
effc88c6d7
|
feat: QR 码解码器 — 从零手写的完整解码流水线
新增 core/src/decoder/ 模块(9 文件,~1500 行):
- bch.rs: BCH(15,5)+BCH(18,6) 查表解码(32+64 有效码字,t≤3)
- format.rs: 从矩阵读取格式信息(EC+掩码)+版本信息(2 副本容错)
- extract.rs: 逆向蛇形排列提取数据码字
- deinterleave.rs: 逆向 RS 数据交错
- rs_decode.rs: RS 纠错流水线(伴随式→BM→Chien→Forney)
- mode_decode.rs: 逆向 4 种编码模式(数字/字母/字节/汉字 Shift JIS)
- detect.rs: 定位图案检测(1:1:3:1:1 比例+交叉验证+聚类)
- image.rs: 图像加载+灰度二值化(PNG/JPEG/WebP)
- mod.rs: 顶层 API(decode_image + decode_matrix)
修改已有文件:
- core: galois.rs 表 pub(crate), 新增 poly_eval(); reed_solomon 公开内部函数
- cli: 新增 --decode <file> 解码模式
- web: 新增 POST /api/decode(multipart file upload)
测试: 72 passed (58 原有 + 14 新增 decoder 测试)
|
2026-06-19 20:36:12 +08:00 |
|
Serendipity
|
ce8063431e
|
docs: 开源规范化 — doc comments + 社区文件 + 示例代码 + crates.io 就绪
- 为 core 公开 API 添加完整 doc comments(rustdoc 可用)
- 新增 .editorconfig / CONTRIBUTING / CODE_OF_CONDUCT / SECURITY
- 新增 Issue 模板(bug + feature)+ PR 模板
- 新增 3 个代码示例(examples/)
- 更新 Cargo.toml 元数据(description/repository/keywords/categories/MSRV)
- 更新 README + CHANGELOG
|
2026-06-19 18:56:28 +08:00 |
|
Serendipity
|
05b1714628
|
fix: QR 扫描失败 + GUI 导出失败 — PNG margin + separator + fs 插件
🔴 QR 扫描失败根因 (2项):
- render/png: saturating_sub 导致 margin 区域映射到 finder 黑角,
quiet zone 全黑,扫描器无法定位 QR
- matrix/patterns: 缺少右上 finder 左侧 + 左下 finder 顶部
隔离带预留,数据模块破坏 finder 检测比率(1:1:3:1:1)
🔴 GUI 导出失败 (2项):
- gui/Cargo.toml + gui/lib.rs: 注册 tauri-plugin-fs 后端插件
(前端 writeFile 调用缺少 Rust handler)
- capabilities: fs:allow-write-file + $HOME/** 路径 scope
(ACL 默认不给 fs 写权限,需显式声明)
🔧 其他:
- ExportPanel: 导出失败显示红色错误信息(替代静默吞错)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-18 11:21:27 +08:00 |
|
Serendipity
|
1e9c94eff9
|
fix: 全面代码审查修复 — 安全/类型/持久化/代码质量 (28项)
🔴 CRITICAL (1):
- tauri.conf.json: CSP 从 null 改为最小权限策略
🟠 HIGH (6):
- 新建 capabilities/default.json: Tauri v2 权限约束(store/dialog/clipboard)
- cli: 路径遍历防护 — 拒绝含 ParentDir 组件的输出路径
- HistoryList: 删除/清空同步持久化到 store,历史点击用 formData 回填
- ExportPanel: 移除 console.warn,getCurrentText any→QrState
- useQrEncode: WiFi 密码在历史中脱敏显示(P:***),Store 实例缓存
🟡 MEDIUM (10):
- mode.rs: Kanji fallback 从 UTF-8 字节改为 13-bit 零值占位(段内模式一致)
- mode.rs: Shift JIS 第二字节跳过 0x7F 空洞,修正行内索引
- mode.rs: encode_numeric/alphanumeric 添加 debug_assert! 前置条件
- mask.rs: best_matrix.unwrap()→expect() 附错误信息
- version.rs: ec_info 仅返回 count>0 的 BlockInfo,EcInfo/BlockInfo 加 Debug+Clone
- types/index.ts: HistoryEntry.mode string→ModeType,新增 formData 字段
- qrContext.tsx: 使用缓存 Store 加载历史
🟢 LOW (11):
- cargo fmt 全部文件
- svg.rs: String::new()→with_capacity() 预分配
- patterns.rs: encode_format_info 拆分为两行提高可读性
- png.rs: 提取 fill_module() 辅助函数降低嵌套
- ErrorBoundary: 添加 componentDidCatch 错误日志入口
- QrPreview: dangerouslySetInnerHTML→<img>+data URL(安全),loading 状态指示
- galois.rs/version.rs: 5 处 #[allow(clippy::indexing_slicing)]+安全文档
- 新建 utils/qrText.ts: 集中管理 6 种模式的文本构造,消除 ExportPanel/mode 间重复
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-17 14:10:13 +08:00 |
|
Serendipity
|
3f1b9901b5
|
fix: 格式信息 BCH 编码运算符优先级 — | 低于 ^ 导致 XOR 未覆盖数据位
Bug: ((data << 10) | (val & 0x3FF)) ^ 0x5412 被解析为 (data << 10) | ((val & 0x3FF) ^ 0x5412)
导致格式信息的 XOR mask 未覆盖前 5 个数据位,扫码器读到错误的 EC 级别和掩码编号
|
2026-06-17 09:26:09 +08:00 |
|
Serendipity
|
d4da3b4277
|
fix: placement.rs — actual_col==0 时下溢保护
|
2026-06-17 09:06:18 +08:00 |
|
Serendipity
|
43926888c9
|
test: Kanji 编码单元测试
- 添加 4 个 Kanji 编码单元测试到 encoder/mode.rs
- 修复 unicode_to_shift_jis 中 Shift JIS 间隙区域 (0xA0-0xDF)
导致的整数下溢 bug
- 修复 png.rs 返回类型与函数签名不匹配的问题
- 修复 qr.rs to_png_bytes 返回值类型不匹配的问题
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-06-17 09:04:05 +08:00 |
|
Serendipity
|
91bdf9ecc3
|
fix: 前端 HIGH/MEDIUM — timer 清理 + 历史持久化 + Error Boundary + console 移除
|
2026-06-17 09:03:38 +08:00 |
|
Serendipity
|
feb5ae709f
|
fix: 4 个 CRITICAL bug 修复
- C1: placement.rs 删除列偏移特殊处理 (col==6→5),place_bit 已自动跳过保留区
- C2: version.rs V5-H 纠错表 h_g1: 4→2 (总码字数 200→134)
- C3: mode.rs Kanji 编码删除冗余 if/else 重复分支
- C4: galois.rs div() 返回 Option<u8> 替代 panic!
|
2026-06-17 08:58:29 +08:00 |
|
Serendipity
|
95e3cc91ff
|
chore: workspace 加 gui 成员,qr-core 加 serde
|
2026-06-17 00:10:18 +08:00 |
|
Serendipity
|
30af4ff607
|
style: cargo fmt + clippy fix 全项目格式化
|
2026-06-16 23:58:15 +08:00 |
|
Serendipity
|
9201cd820c
|
chore: 修复 clippy 警告 — doc comment 空行
|
2026-06-16 23:54:35 +08:00 |
|
Serendipity
|
b75630f055
|
test: 集成测试 + 端到端验证
|
2026-06-16 23:53:58 +08:00 |
|
Serendipity
|
41ef43f038
|
feat: 顶层 API + PNG/SVG/ASCII 渲染器
|
2026-06-16 23:51:55 +08:00 |
|
Serendipity
|
778b0ee1fa
|
feat: 格式信息 BCH(15,5) + 版本信息 BCH(18,6)
|
2026-06-16 23:48:53 +08:00 |
|
Serendipity
|
6e1980696d
|
feat: 蛇形数据排列 + 8 掩码 + 评分
|
2026-06-16 23:47:21 +08:00 |
|
Serendipity
|
1adb7e41e4
|
feat: QR 矩阵 + 功能图案绘制
|
2026-06-16 23:44:21 +08:00 |
|
Serendipity
|
f6a349882d
|
feat: 字符串分段 + 比特流编码
|
2026-06-16 23:43:04 +08:00 |
|
Serendipity
|
db9c930359
|
feat: 四种编码模式(数字/字母/字节/汉字)
|
2026-06-16 23:41:52 +08:00 |
|
Serendipity
|
c6c80c906c
|
feat: Reed-Solomon 纠错编码 + 数据交错
|
2026-06-16 23:40:52 +08:00 |
|
Serendipity
|
fb091bfb87
|
fix: 移除多余引用 — clippy 警告
|
2026-06-16 23:40:06 +08:00 |
|
Serendipity
|
f42f883cf1
|
feat: 版本参数表 — 40 版本容量 + 自动选择
|
2026-06-16 23:37:50 +08:00 |
|
Serendipity
|
a6f3c23901
|
fix: galois — 添加 #[inline] 和 div_by_zero 测试
|
2026-06-16 23:35:19 +08:00 |
|
Serendipity
|
b292cec088
|
feat: GF(2^8) Galois 域运算 + 预计算 exp/log 表
|
2026-06-16 23:31:26 +08:00 |
|
Serendipity
|
ad77b3ac1b
|
feat: workspace 骨架 — core + cli 模块结构
|
2026-06-16 23:27:58 +08:00 |
|