Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"canvas-confetti": "^1.9.4",
"chart.js": "^4.5.1",
"clsx": "^2.1.1",
"croner": "^9.1.0",
"echarts": "^6.1.0",
"echarts-wordcloud": "^2.1.0",
"elkjs": "^0.11.1",
Expand Down
1 change: 1 addition & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros", "time", "net",
axum = { version = "0.7", features = ["json", "macros", "ws"] }
tower-http = { version = "0.5", features = ["cors"] }
sqlx = { version = "0.8", features = ["runtime-tokio", "tls-rustls", "postgres", "sqlite", "mysql", "json", "chrono", "uuid", "rust_decimal"] }
flate2 = "1"
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls-webpki-roots", "stream"] }
futures = "0.3"
# Local agent CLIs (Claude Code, Codex, OpenCode), vendored from deck.
Expand Down Expand Up @@ -77,7 +78,7 @@ oracle = "0.6.3"
# startup (see `run`): tiberius 0.13 enables aws-lc-rs next to the ring the
# other drivers use, and rustls then has no default of its own.
rustls = { version = "0.23", default-features = false, features = ["ring", "std"] }
tokio-util = { version = "0.7.18", features = ["compat"] }
tokio-util = { version = "0.7.18", features = ["compat", "io"] }
# The SQL terminal: the engine's own CLI (psql, mysql, sqlite3...) in a
# pseudo-terminal. ConPTY on Windows, openpty everywhere else.
portable-pty = "0.9"
Expand Down
11 changes: 10 additions & 1 deletion src-tauri/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,16 @@ async fn me_text(req: reqwest::RequestBuilder) -> Result<String, ApiError> {
/// Asks for the v3 account trial: one fresh trial per account, separate from 2.x.
const TRIAL_SCHEME: (&str, &str) = ("X-Stroke-Trial", "account-v3");

/// This app's version, sent with every `/api/me` so the account's device list
/// shows what each computer runs now. Set on the first refresh.
static APP_VERSION: OnceLock<String> = OnceLock::new();

pub async fn fetch_me(base: &str, token: &str) -> Result<String, ApiError> {
me_text(http().get(format!("{base}/api/me")).bearer_auth(token).header(TRIAL_SCHEME.0, TRIAL_SCHEME.1)).await
let mut req = http().get(format!("{base}/api/me")).bearer_auth(token).header(TRIAL_SCHEME.0, TRIAL_SCHEME.1);
if let Some(v) = APP_VERSION.get() {
req = req.header("X-Stroke-Version", v.as_str());
}
me_text(req).await
}

pub async fn remote_sign_out(base: &str, token: &str) {
Expand Down Expand Up @@ -774,6 +782,7 @@ fn data_dir(app: &tauri::AppHandle) -> Result<PathBuf, String> {
/// failure keeps the cache (trusted until `valid_until`).
async fn refresh(app: &tauri::AppHandle, dir: &Path, token: &str) -> AccountStatus {
let base = base_url();
APP_VERSION.get_or_init(|| app.package_info().version.to_string());
match fetch_me(&base, token).await {
Ok(raw) => match save_me(dir, raw) {
Ok(_) => build_status(dir, true),
Expand Down
Loading
Loading