Files
Windows-Gotify-Client-Rust/Cargo.toml
T
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

62 lines
2.0 KiB
TOML

# Cargo.toml — Phase 1 (Bootstrap).
#
# Dependency rationale lives in AGENTS.md §44. Only the crates actually used
# by Phase 1 are listed; the remaining crates (reqwest / tungstenite / serde /
# url / anyhow / ...) are added in later phases when their modules land.
[package]
name = "windows-gotify-client-rust"
version = "0.1.0"
edition = "2021"
rust-version = "1.75"
description = "Lightweight, modern, Windows-native Gotify desktop client (Rust + Slint)"
license = "MIT"
readme = "README.md"
authors = ["KennethCheng <a1478925630@163.com>"]
[[bin]]
name = "windows-gotify-client-rust"
path = "src/main.rs"
[dependencies]
# --- UI ---
# `slint` crate. The `slint!{}` macro is compiled in via the default feature
# set in 1.x (verified against 1.18.0 — `internal-interpreter` was removed in
# 1.x). The Windows GUI backend (`backend-winit`) is also part of defaults.
# Phase 2 will likely switch from the embedded macro to `include_slint!()`
# + standalone .slint files under `ui/`.
slint = "1"
# --- Logging ---
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# --- Error handling ---
thiserror = "2"
# --- Serialization (Phase 2 C3 storage) ---
serde = { version = "1", features = ["derive"] }
serde_json = "1"
# --- Networking (Phase 3 Gotify HTTP) ---
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
# --- Date/time (Phase 3 C2 convert Gotify RFC3339) ---
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
# Slint's `.slint` files are compiled by `build.rs`; see build.rs.
[build-dependencies]
slint-build = "1"
[profile.release]
# See AGENTS.md §42. The `release-balanced` profile below is the practical
# default after benchmarking — adjust if startup time regresses.
opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"
strip = true
[profile.release-balanced]
inherits = "release"
opt-level = 3