2026-02-28 21:18:33 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
|
|
/// Info returned to the frontend about an available update.
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
|
pub struct UpdateInfo {
|
|
|
|
|
pub version: String,
|
|
|
|
|
pub tag_name: String,
|
|
|
|
|
pub release_url: String,
|
|
|
|
|
pub body: String,
|
|
|
|
|
pub assets: Vec<ReleaseAsset>,
|
|
|
|
|
pub published_at: String,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
|
pub struct ReleaseAsset {
|
|
|
|
|
pub name: String,
|
|
|
|
|
pub browser_download_url: String,
|
|
|
|
|
pub size: u64,
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-13 10:55:41 -07:00
|
|
|
/// GitHub API release response (internal).
|
2026-02-28 21:18:33 +00:00
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
2026-03-13 10:55:41 -07:00
|
|
|
pub struct GitHubRelease {
|
2026-02-28 21:18:33 +00:00
|
|
|
pub tag_name: String,
|
|
|
|
|
pub html_url: String,
|
|
|
|
|
pub body: String,
|
2026-03-13 10:55:41 -07:00
|
|
|
pub assets: Vec<GitHubAsset>,
|
2026-02-28 21:18:33 +00:00
|
|
|
pub published_at: String,
|
2026-08-27 10:11:35 -07:00
|
|
|
/// Whether GitHub itself has this release marked as a prerelease.
|
|
|
|
|
/// `#[serde(default)]` rather than required: every response GitHub sends
|
|
|
|
|
/// carries this, but nothing here should refuse to parse the rest of a
|
2026-08-27 10:24:24 -07:00
|
|
|
/// release over one missing field. Defaults to `false` (offered) rather
|
|
|
|
|
/// than `true` (excluded) — a missing field only happens if GitHub's API
|
|
|
|
|
/// shape changes, and "API changed, therefore updates silently stop
|
|
|
|
|
/// working forever" is the worse failure of the two.
|
|
|
|
|
///
|
|
|
|
|
/// `build-app.yml`'s own mirror never publishes a prerelease, but
|
|
|
|
|
/// `.gitea/workflows/backfill-releases.yml` forwards every Gitea release
|
|
|
|
|
/// unfiltered, `prerelease` included — so if it were ever dispatched
|
|
|
|
|
/// while a preview release existed, this field is what stops
|
|
|
|
|
/// `check_for_updates` from offering it (the `preview-<sha>` tag shape
|
|
|
|
|
/// already fails semver parsing independently, but this is real
|
|
|
|
|
/// defence-in-depth, not a no-op).
|
2026-08-27 10:11:35 -07:00
|
|
|
#[serde(default)]
|
|
|
|
|
pub prerelease: bool,
|
2026-02-28 21:18:33 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-13 10:55:41 -07:00
|
|
|
/// GitHub API asset response (internal).
|
2026-02-28 21:18:33 +00:00
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
2026-03-13 10:55:41 -07:00
|
|
|
pub struct GitHubAsset {
|
2026-02-28 21:18:33 +00:00
|
|
|
pub name: String,
|
|
|
|
|
pub browser_download_url: String,
|
|
|
|
|
pub size: u64,
|
|
|
|
|
}
|
2026-03-12 09:26:58 -07:00
|
|
|
|
|
|
|
|
/// Info returned to the frontend about an available container image update.
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
|
pub struct ImageUpdateInfo {
|
|
|
|
|
/// The remote digest (e.g. sha256:abc...)
|
|
|
|
|
pub remote_digest: String,
|
|
|
|
|
/// The local digest, if available
|
|
|
|
|
pub local_digest: Option<String>,
|
|
|
|
|
/// When the remote image was last updated (if known)
|
|
|
|
|
pub remote_updated_at: Option<String>,
|
|
|
|
|
}
|