KennethCheng 0cf7a4eaaa feat(gotify): Phase 3 C2 — UI 接线 + Connection status + 真实数据
- src/config.rs: AppConfig::placeholder() 硬编码 NAS 地址 + 假 token
  (§20 token 永不日志;Phase 5 接持久化前占位)
- src/models.rs: gotify_messages_to_items 把 GotifyMessage 列表转
  Slint MessageItem[];try_fetch_real_messages 一次完成 health →
  applications → messages(50);失败 None 让调用方 fallback mock
- src/gotify/mod.rs: re-export ServerConfig
- src/lib.rs: run() 启动时调 try_fetch_real_messages,成功用真实数
  据 + Connected + 服务端 URL,失败 fallback mock + Disconnected;
  on_test_connection_requested 重新跑同一路径
- Cargo.toml: 加 chrono 0.4 (RFC3339 解析)
- ui/app.slint: is-connected (绿/灰 dot) + status-text (顶部副标)
- ui/settings-page.slint: Connection section 加 Test Connection 按钮
  (in-progress 时禁用显示 "Testing...")

避坑:
- Gotify RFC3339 date 解析失败 silent fallback 到 unix=0(显示
  "just now" 而不是崩)
- Gotify priority 0..10 → Slint Priority 4 桶分桶:<=0 Low / <=3
  Normal / <=7 High / else Max
- ServerConfig 在 crate::gotify::model 子模块,mod.rs 必须 re-export

验证:cargo build / build --release 都 exit 0,0 warning
- cargo test --test gotify_api: 6 passed
- debug   33.36 MB, subsystem = WINDOWS_CUI
- release  9.43 MB, subsystem = WINDOWS_GUI(chrono +1.3 MB)
2026-09-19 05:18:26 +08:00

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)。

S
Description
No description provided
Readme MIT
637 KiB
2026-09-19 20:40:55 +08:00
Languages
Rust 73.7%
Slint 26.3%