1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [Unreleased]
### Changed — 移除直接依赖(用纯 std 自实现)
本次升级将若干小型第三方 crate 替换为项目内自实现,减少供应链依赖、加快编译。
- **移除 6 个直接依赖**,全部改用项目内新增的 `doe::utils` 模块的纯标准库实现:
- `hex` → `doe::utils::hex`(`encode` / `encode_upper` / `decode`)
- `base64` → `doe::utils::base64`(`encode_standard` / `encode_standard_no_pad` / `encode_url_safe` / `decode_standard` / `decode_url_safe`,支持 Standard 与 UrlSafe 两种字母表及可选 padding)
- `percent-encoding` → `doe::utils::percent`(`encode` 配合 `EncodeSet::Controls` / `NonAlphanumeric`,`decode`)
- `temp-dir` → `doe::utils::temp::TempDir`(RAII 临时目录,`new` / `with_prefix` / `path` / `into_path`)
- `unicode-segmentation` → 移除未使用的 import(`ctf::unicode_to_chinese` 实际只用到 `std::str::split`,该 import 本就是多余的)
- `directories` → 移除(代码中从未被使用,纯属死依赖)
- `doe::crypto`(`sha1` / `sha2` / `blake3` / `rsa` 等哈希函数的十六进制输出)与 `doe::ctf`(`hex_encode` / `hex_decode` / `base64_*` / `url_*` / `CtfParty` trait)的内部实现已改用 `doe::utils::*`。**公开函数签名与返回行为保持不变。**
### Added
- 新增顶层公开模块 `doe::utils`,含 `hex`、`base64`、`percent`、`temp` 四个子模块,附带完整的单元测试(已知向量 + roundtrip + 边界情况)。
- `ctf` feature 现在显式声明 `anyhow` 依赖,修复了此前 `cargo build -F ctf` 无法编译 `ctf::packet`(DNS 解码器,用到了 `anyhow::Context`)的预先存在问题。
### Migration
- 如果你的代码直接依赖并通过 `doe` 转用了 `hex` / `base64` / `percent-encoding` / `temp-dir`,可改用 `doe::utils::*` 下的等价实现。
- `doe::crypto::*`、`doe::ctf::*` 中所有公开函数的行为保持一致,无需改动调用方代码。
### Fixed — Bug 修复(Windows 与 Linux 双环境)
- **`ctf` feature 此前无法编译**:`Cargo.toml` 中 `ctf` 未声明 `anyhow`,但 `ctf::packet`(DNS 解码器)用到了 `anyhow::Context`。已补充 `anyhow` 到 `ctf` feature。
- **email 正则在 clippy 下报 error**:`ctf::CtfParty::is_email(EmailMode::LightWithLength)` 的正则使用了 look-ahead `(?=...)`,标准 `regex` crate 不支持。已将长度约束(总长 6..=254、本地部分 ≤64)改写为代码前置校验,正则只保留结构匹配;同时修正了原正则中 `\\.` 的双重转义 bug。
- **`traits::Either` 的无效 serde cfg**:`#[cfg_attr(feature = "serde", derive(...))]` 引用了从未声明的 `serde` feature,导致 `unexpected_cfgs` 警告且该 derive 永不生效。已移除该死代码并补充文档说明。
- **`lib.rs` 中 `system` / `CommandHelper::run` 的冗余 `&command.to_string()`**:clippy 报 `needless_borrows_for_generic_args` / `unnecessary_to_string`。已统一为一次 `to_string()` + `&command`。
- **71 处空文档注释 + 65 处缺失文档**:清理了 `keyboard.rs`(KeyCode 常量)、`mouse.rs`(Point)、`process.rs`、`timer.rs`、`lib.rs` 中所有空 `///` 与缺失的文档,并为全部 KeyCode 常量补充了人类可读的说明。
- **`process.rs` 模块同名警告**:补充 `#![allow(clippy::module_inception)]` 与模块文档,保留 `doe::process::*` 的公开路径不变。
- **doctest 含 `#[test]` 警告**:`lib.rs` 中 sys_random 的示例 doctest 改为 `ignore`。
### Known Limitations — 均已修复
- ~~**Linux nightly + `full` feature 的 ICE**~~:`screenshots 0.8.10` 已被完全移除,改用项目内自实现的 `src/screens/` 模块(Windows GDI / macOS CoreGraphics / Linux x11+Wayland)。该 ICE 不再存在,**Linux nightly `cargo build -F full` 正常编译**。
### Changed — 移除 `screenshots` 依赖(三平台自实现截屏)
- **移除 `screenshots` crate**(含其 6 个传递依赖 `display_info`/`dbus`/`fxhash`/`widestring`/`xcb`/`libwayshot`),用项目内新增的 `src/screens/` 内部模块替代(三平台纯 Rust 实现,约 400 行)。
- **Windows**:GDI (`EnumDisplayMonitors` + `CreateCompatibleDC` + `StretchBlt` + `GetDIBits`),复用现有 `windows` crate(仅补 `Win32_Graphics_Gdi` feature),零新依赖。
- **macOS**:CoreGraphics (`CGDisplay::screenshot` + `active_online_displays`),复用现有 `core-graphics` crate,零新依赖。
- **Linux X11**:xlib (`XGetImage`),新增 1 个轻量 `x11` crate(无 dbus/portal 等重型依赖)。
- **Linux Wayland**:外部命令兜底(`grim` / `gnome-screenshot` / `spectacle`,按优先级 fallback),零新依赖,不满足时返回清晰错误。
- `doe::screenshot::*` 全部公开函数签名与行为保持不变。
## [1.1.88] - 2024
- 详见 git 历史。