release: 0.1.1 — update channel, settings/UI trims, macOS + Windows x64 only
Update path
- `src-tauri/src/update.rs`: manifest fetch, semver compare, optional ed25519
signature check against a key baked in at build time, then a size + SHA256
gate before an installer can run. `UpdateStatus` now reports the artifact key
it resolved so the UI can name what it will install.
- Settings → Updates panel shows the feed, the check/download state machine, and
the local OS, architecture and release artifact for this machine.
- `scripts/publish-release.sh` + `scripts/release-key.py` publish installers and a
signed `shift-update.json` onto an orphan `releases` branch.
Scope trims requested for this release
- Settings: the Radial rings tab is gone, so ring orders are read from
`settings.json` with no in-app editor for now.
- Main window: the update entry in the header bar is gone; updates live in
Settings → Updates only.
- Release targets are macOS universal and Windows x64. ARM64 and Linux stay
buildable and are no longer published; `docs/RELEASE.md` records the decision.
Gates: cargo fmt --check clean, `cargo test --lib` 142 passed / 2 ignored,
`pnpm check` clean, `pnpm test` 34 passed, `pnpm build` ok.
2026-10-25 19:06:46 +00:00
|
|
|
//! Build-time wiring for the git-backed update channel.
|
|
|
|
|
//!
|
|
|
|
|
//! The update feed is this repository itself, so the manifest URL is derived from
|
|
|
|
|
//! the `origin` remote: `https://host/owner/repo/raw/branch/<release-branch>/
|
|
|
|
|
//! shift-update.json`. GitHub uses `/raw/<branch>/` and GitLab `/-/raw/<branch>/`;
|
|
|
|
|
//! everything else (Gitea, Forgejo) uses the Gitea form. A `SHIFT_UPDATE_URL`
|
|
|
|
|
//! environment variable at build time overrides the derivation, and a source tree
|
|
|
|
|
//! with no remote simply builds an app whose updater reports "no feed".
|
|
|
|
|
//!
|
|
|
|
|
//! The feed's *authenticity* comes from `SHIFT_UPDATE_PUBKEY`: a 64-byte hex ed25519
|
|
|
|
|
//! public key baked into the binary, against which the manifest's own signature is
|
|
|
|
|
//! checked. A build without it still verifies artifact integrity (size + SHA256) and
|
|
|
|
|
//! falls back to trusting the HTTPS connection, which is what it does today.
|
|
|
|
|
|
|
|
|
|
use std::{path::Path, process::Command};
|
|
|
|
|
|
|
|
|
|
const RELEASE_BRANCH: &str = "releases";
|
|
|
|
|
const MANIFEST: &str = "shift-update.json";
|
|
|
|
|
const PUBKEY_ENV: &str = "SHIFT_UPDATE_PUBKEY";
|
|
|
|
|
|
|
|
|
|
fn git(args: &[&str]) -> Option<String> {
|
|
|
|
|
let output = Command::new("git")
|
|
|
|
|
.args(args)
|
|
|
|
|
.current_dir(Path::new(env!("CARGO_MANIFEST_DIR")).parent()?)
|
|
|
|
|
.output()
|
|
|
|
|
.ok()?;
|
|
|
|
|
if !output.status.success() {
|
|
|
|
|
return None;
|
|
|
|
|
}
|
|
|
|
|
let text = String::from_utf8(output.stdout).ok()?;
|
|
|
|
|
let text = text.trim().to_string();
|
|
|
|
|
(!text.is_empty()).then_some(text)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// `owner/repo` plus the host scheme, from either ssh or https remote forms.
|
|
|
|
|
fn parse_remote(url: &str) -> Option<(String, String)> {
|
|
|
|
|
let url = url.trim().trim_end_matches('/').trim_end_matches(".git");
|
|
|
|
|
let (host, path) = if let Some(rest) = url.strip_prefix("ssh://") {
|
|
|
|
|
rest.split_once('/')?
|
|
|
|
|
} else if let Some(rest) = url.find("://").map(|index| &url[index + 3..]) {
|
|
|
|
|
rest.split_once('/')?
|
|
|
|
|
} else if let Some((host, path)) = url.split_once(':') {
|
|
|
|
|
(host.strip_prefix("git@")?, path)
|
|
|
|
|
} else {
|
|
|
|
|
return None;
|
|
|
|
|
};
|
|
|
|
|
(!host.is_empty() && !path.is_empty()).then(|| (format!("https://{host}"), path.to_string()))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn raw_directory(host: &str, path: &str) -> String {
|
|
|
|
|
let domain = host.replace("https://", "");
|
|
|
|
|
let segment = if domain.ends_with("github.com") {
|
|
|
|
|
format!("raw/{RELEASE_BRANCH}")
|
|
|
|
|
} else if domain.contains("gitlab") {
|
|
|
|
|
format!("-/raw/{RELEASE_BRANCH}")
|
|
|
|
|
} else {
|
|
|
|
|
format!("raw/branch/{RELEASE_BRANCH}")
|
|
|
|
|
};
|
|
|
|
|
format!("{host}/{path}/{segment}")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn manifest_url() -> Option<String> {
|
|
|
|
|
if let Ok(url) = std::env::var("SHIFT_UPDATE_URL") {
|
|
|
|
|
if !url.trim().is_empty() {
|
|
|
|
|
return Some(url.trim().to_string());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let (host, path) = parse_remote(&git(&["remote", "get-url", "origin"])?)?;
|
|
|
|
|
Some(format!("{}/{}", raw_directory(&host, &path), MANIFEST))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The baked publish key, normalised to 64 lowercase hex characters. Anything else
|
|
|
|
|
/// is a typo worth failing the build over rather than shipping an updater that
|
|
|
|
|
/// silently accepts an unsigned feed.
|
|
|
|
|
fn public_key() -> Result<String, String> {
|
|
|
|
|
let raw = match std::env::var(PUBKEY_ENV) {
|
|
|
|
|
Ok(value) => value,
|
|
|
|
|
Err(_) => return Ok(String::new()),
|
|
|
|
|
};
|
|
|
|
|
let value: String = raw
|
|
|
|
|
.trim()
|
|
|
|
|
.chars()
|
|
|
|
|
.filter(|character| !character.is_whitespace() && *character != ':')
|
|
|
|
|
.collect::<String>()
|
|
|
|
|
.to_ascii_lowercase();
|
|
|
|
|
if value.len() != 64 || !value.chars().all(|c| c.is_ascii_hexdigit()) {
|
|
|
|
|
return Err(format!("{PUBKEY_ENV} must be 64 hex characters (32 bytes)"));
|
|
|
|
|
}
|
|
|
|
|
Ok(value)
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-21 00:54:54 +00:00
|
|
|
fn main() {
|
2026-10-25 04:24:05 +00:00
|
|
|
println!("cargo:rerun-if-changed=../dist");
|
release: 0.1.1 — update channel, settings/UI trims, macOS + Windows x64 only
Update path
- `src-tauri/src/update.rs`: manifest fetch, semver compare, optional ed25519
signature check against a key baked in at build time, then a size + SHA256
gate before an installer can run. `UpdateStatus` now reports the artifact key
it resolved so the UI can name what it will install.
- Settings → Updates panel shows the feed, the check/download state machine, and
the local OS, architecture and release artifact for this machine.
- `scripts/publish-release.sh` + `scripts/release-key.py` publish installers and a
signed `shift-update.json` onto an orphan `releases` branch.
Scope trims requested for this release
- Settings: the Radial rings tab is gone, so ring orders are read from
`settings.json` with no in-app editor for now.
- Main window: the update entry in the header bar is gone; updates live in
Settings → Updates only.
- Release targets are macOS universal and Windows x64. ARM64 and Linux stay
buildable and are no longer published; `docs/RELEASE.md` records the decision.
Gates: cargo fmt --check clean, `cargo test --lib` 142 passed / 2 ignored,
`pnpm check` clean, `pnpm test` 34 passed, `pnpm build` ok.
2026-10-25 19:06:46 +00:00
|
|
|
println!("cargo:rerun-if-env-changed=SHIFT_UPDATE_URL");
|
|
|
|
|
println!("cargo:rerun-if-env-changed={PUBKEY_ENV}");
|
|
|
|
|
// The remote can change between builds, so the derived URL refreshes whenever
|
|
|
|
|
// git metadata moves. Cheap enough to re-check on every build.
|
|
|
|
|
println!("cargo:rerun-if-changed=../.git/config");
|
|
|
|
|
println!(
|
|
|
|
|
"cargo:rustc-env=SHIFT_UPDATE_URL={}",
|
|
|
|
|
manifest_url().unwrap_or_default()
|
|
|
|
|
);
|
|
|
|
|
match public_key() {
|
|
|
|
|
Ok(key) => println!("cargo:rustc-env=SHIFT_UPDATE_PUBKEY={key}"),
|
|
|
|
|
Err(error) => panic!("{error}"),
|
|
|
|
|
}
|
2026-10-21 00:54:54 +00:00
|
|
|
tauri_build::build()
|
|
|
|
|
}
|