- 自己调 Aptabase 的批量接口 POST /api/v0/events(没有纯 Rust SDK)。只发版本、系统名和版本、CPU 架构、设置快照(取值固定,主机等数量只报档位)和功能使用次数;不发主机、凭据、命令、文件名、路径,也没有任何标识 - 四种事件:app_installed(首次启动,送达后记进 analytics.json)、app_started、app_active(窗口到前台且当天 UTC 还没报过)、usage(43 项功能计数,从第一次使用起满 4 小时汇总一条) - 不用定时器:只在启动、窗口激活、用到功能、改设置时动作,满期的汇总和失败重试都等下一个信号;计数存盘,退出不等网络、不丢数据 - 内网断网不受影响:联网、系统检测、写文件都在后台线程,连接 5 秒、整体 15 秒超时,失败不提示,重试从 1 分钟起翻倍、最长 6 小时,4xx 不重试 - 「设置 › 关于」新增「隐私」组的「发送匿名使用统计」,默认开,关掉清空本机攒下的计数 - 只有发布构建发;开发构建设 SHELLRS_ANALYTICS_DEBUG=1 才发调试事件,汇总周期 1 分钟、失败 10 秒后重试 - 手册新增「隐私」一节列出全部上报内容,README 同步 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.8 KiB
Rust
36 lines
1.8 KiB
Rust
//! 匿名使用统计: how many installations, how many devices a day, which
|
|
//! versions, and which features get used, reported to Aptabase.
|
|
//!
|
|
//! What goes out: the version, the operating system and its version, the
|
|
//! CPU architecture, a few settings (each from a fixed set of values, the
|
|
//! saved hosts and such only counted, in bands), and how many times each
|
|
//! feature was used. Never a host, credential, command, file name, path or
|
|
//! anything that identifies the machine: Aptabase tells devices apart from
|
|
//! the address and the User-Agent, hashed with a salt it replaces daily.
|
|
//!
|
|
//! Aptabase has no Rust SDK beyond its Tauri plugin, so this posts to its
|
|
//! REST API itself, as its other SDKs do: batches of up to 25 events, the
|
|
//! network and its 5xx retried, any other refusal dropped. Unlike them,
|
|
//! nothing runs on a timer: the workspace sends signals (started, the
|
|
//! window came forward, a feature was used, the switch flipped) to one
|
|
//! thread, which counts, works out what is due and sends it then. Feature
|
|
//! uses are summed for four hours into one `usage` event and kept on disk
|
|
//! until it is sent, so quitting loses nothing and never waits.
|
|
//!
|
|
//! Only release builds report; a development build does with
|
|
//! `SHELLRS_ANALYTICS_DEBUG` set, as debug events, summed by the minute and
|
|
//! retried after ten seconds. The external CLI, a second copy passing its
|
|
//! links on, and the UI tests never start it.
|
|
|
|
mod client;
|
|
mod model;
|
|
mod system;
|
|
|
|
pub use client::{Analytics, AnalyticsServices, HttpTransport, Transport};
|
|
pub use model::{Counter, Delivery, Signal, Snapshot};
|
|
pub use system::SystemInfo;
|
|
|
|
/// The Aptabase app ShellRS reports to. Not a secret: every build carries
|
|
/// it, and all it allows is sending events.
|
|
pub const APP_KEY: &str = "A-US-1582708162";
|