319eeb44ae9319f3e17e65725cb5d37bf7c8ad78
- src/gotify/reconnect.rs: ReconnectPolicy 按 §15 退避序列
1s/2s/4s/8s/16s/30s...record_success() 重置;inline #[cfg(test)]
3 个 backoff 测试
- src/gotify/websocket.rs: blocking tungstenite 0.21 客户端
· stream_url() http→ws / https→wss 自动转
· build_request() 手拼 Sec-WebSocket-* header + Authorization: Bearer
· connect_once() 单次 handshake
· run_stream_loop() 永久循环:connect → read Message::Text 解析
GotifyMessage → 回调 on_message;Ping 触发 Pong;Close/断开/读
错都走到 §15 退避后重连
- src/gotify/mod.rs: re-export 加 reconnect + websocket 子模块
- Cargo.toml: tungstenite 0.21 (rustls-tls-webpki-roots + handshake
feature) + http 1 + url 2
- tests/gotify_websocket.rs: 3 个 JSON envelope 解析测试
避坑:
- tungstenite 0.21 的 connect 在 handshake feature 后(默认不带),要
显式开
- WebSocketConfig 0.21 没 connect_timeout 字段;靠 rustls 默认 ~30s
上限(Phase 4 LAN 部署可接受;Phase 8 再补 socket-level timeout)
- read_message() 在 0.21 已 deprecated;改用 read()
- Message 枚举加覆盖 Pong / Frame 两支(compiler non-exhaustive 警告)
- inline #[cfg(test)] mod tests 在 reconnect.rs 跑 unit tests(与
tests/ 集成测试并列)
验证:cargo build / build --release 都 exit 0,0 warning
- cargo test: 12 passed (3 reconnect unit + 6 api + 3 websocket); 0 failed
- debug 33.36 MB, subsystem = WINDOWS_CUI
- release 9.43 MB, subsystem = WINDOWS_GUI(tungstenite + http 在 LTO
后几乎不增体积——和 Phase 3 C2 持平)
Windows-Gotify-Client-Rust
轻量、现代、Windows 原生体验良好的 Gotify 桌面客户端,使用 Rust + Slint 构建。
详细的产品定位、技术栈约束、架构、UI 规范与分阶段实施计划全部记录在
AGENTS.md。本文档只做项目导览。
状态
🚧 从 0 起步 —— 当前仓库只有目录骨架与占位 Cargo.toml,尚未进入 Phase 1(Bootstrap)。
完整 8 阶段路线图见 AGENTS.md §57。
目标平台
- Windows 10 x64
- Windows 11 x64(ARM64 条件允许时支持)
- 后台常驻、托盘型客户端
技术栈
| 层 | 选型 |
|---|---|
| 语言 | Rust stable |
| UI | Slint 1.17.x |
| HTTP | reqwest(blocking + rustls) |
| WebSocket | tungstenite |
| Windows 集成 | windows-rs focused crates(按需引入) |
| 配置 / 状态 | JSON 文件(%APPDATA%/WindowsGotify/) |
| 日志 | tracing + tracing-subscriber |
显式禁用:Tauri / Wails / Electron / WebView2 / WPF / WinUI 3 / Node 运行时。
理由见 AGENTS.md §2。
仓库布局
Windows-Gotify-Client-Rust/
├── Cargo.toml # 占位 — 见 AGENTS.md §44
├── AGENTS.md # AI Agent 实施计划(1363 行)
├── README.md
├── LICENSE # MIT(占位)
├── .gitignore
├── assets/ # 图标、字体等
├── ui/ # Slint 视图
├── src/ # Rust 业务代码
│ ├── gotify/ # HTTP + WebSocket
│ ├── storage/ # config.json / state.json
│ ├── windows/ # 托盘 / Toast / 启动 / 单实例 / URL
│ └── services/ # 生命周期
├── tests/ # 集成测试
└── scripts/ # PowerShell 构建脚本
开发环境
本仓库目前还没有源码,本节将在 Phase 1 完成后补全具体的
cargo run/cargo build --release步骤。
隐私与安全
- App Token 默认以 JSON 明文存储在
%APPDATA%/WindowsGotify/config.json,仅当前用户可访问 - 日志永不打印完整
Authorization头 - 通知点击的
click.url仅允许http:///https://,拒绝file:///javascript:/ 自定义 scheme - 详细策略见
AGENTS.md§13 / §20 / §38 / §51
License
MIT(见 LICENSE)。