diff --git a/Cargo.lock b/Cargo.lock index 98e1290c29..3b27597011 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4673,6 +4673,7 @@ dependencies = [ "ron", "serde_json", "tempfile", + "ureq", "winit", "winresource", "winsafe", @@ -4837,6 +4838,7 @@ dependencies = [ "rayon", "roxmltree 0.20.0", "same-file", + "semver", "serde", "serde_json", "tempfile", @@ -6053,12 +6055,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.45" +version = "0.23.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" dependencies = [ "aws-lc-rs", + "log", "once_cell", + "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -7454,6 +7458,35 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde93ff05758a36a851a398a772b0b79a82fbe3c186a46f2696baaeaf84c966b" +dependencies = [ + "base64 0.23.1", + "log", + "percent-encoding", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "ureq-proto", + "utf8-zero", + "webpki-roots", +] + +[[package]] +name = "ureq-proto" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841583fc36089d7d59419568ae157f43a5a03a2e5a81ba87c77d1596ef46e922" +dependencies = [ + "base64 0.23.1", + "http", + "httparse", + "log", +] + [[package]] name = "url" version = "2.5.8" @@ -7493,6 +7526,12 @@ dependencies = [ "xmlwriter", ] +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + [[package]] name = "utf8_iter" version = "1.0.4" @@ -7932,6 +7971,15 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "webpki-roots" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c1c8e20c8a38fc7d65abfe74eb7280e4aa667e8eec8bc84996d2874810748d9" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weezl" version = "0.1.12" diff --git a/apps/photocraft/Cargo.toml b/apps/photocraft/Cargo.toml index 4ba562db68..e5726222bc 100644 --- a/apps/photocraft/Cargo.toml +++ b/apps/photocraft/Cargo.toml @@ -41,6 +41,8 @@ arboard = { version = "3.6", features = ["wayland-data-control"] } open = "5" # Reads the saved window layout (eframe persistence) to drop values that would abort startup. ron = "0.12" +# Background release checks; HTTPS with Rust TLS, no async runtime. +ureq = { version = "3.4", default-features = false, features = ["rustls", "platform-verifier"] } [target.'cfg(target_os = "macos")'.dependencies] # Safe CoreGraphics bindings, compatible with the existing macOS 11 deployment target. diff --git a/apps/photocraft/src/main.rs b/apps/photocraft/src/main.rs index 1b58e89f03..fc896494a4 100644 --- a/apps/photocraft/src/main.rs +++ b/apps/photocraft/src/main.rs @@ -74,6 +74,7 @@ mod single_instance; // Tablet support (macOS AppKit monitor, Linux X11/Wayland, Windows barrel button). mod tablet; mod ui_state; +mod updates; mod window_frame; use photocraft_engine::Session; diff --git a/apps/photocraft/src/services.rs b/apps/photocraft/src/services.rs index 3a189207a4..51cf217faf 100644 --- a/apps/photocraft/src/services.rs +++ b/apps/photocraft/src/services.rs @@ -561,6 +561,12 @@ fn shell_word(s: &str) -> String { if s.bytes().all(|b| b.is_ascii_alphanumeric() || b"/._-+:,@".contains(&b)) { s.to_string() } else { format!("'{}'", s.replace('\'', r"'\''")) } } +/// The release-check transport, or `None` inside Flatpak: the sandbox has no network (see the +/// manifest's finish-args) and `flatpak update` owns updates there. +fn update_transport(flatpak_id: Option<&std::ffi::OsStr>) -> Option { + flatpak_id.is_none().then(crate::updates::service) +} + pub fn native(automation: Option) -> Services { let clip: Rc>> = Rc::default(); let clip_unreadable: Rc> = Rc::default(); @@ -625,6 +631,7 @@ pub fn native(automation: Option) -> inbox: None, open_url: Some(Box::new(|url: &str| open::that(url).map_err(|e| e.to_string()))), beep: Some(platform_beep), + check_updates: update_transport(std::env::var_os("FLATPAK_ID").as_deref()), clipboard_set_image: Some({ let clip = clip.clone(); guarded_clipboard_set(move |w: u32, h: u32, px: &[u8]| { @@ -904,6 +911,12 @@ mod tests { ); } + #[test] + fn flatpak_builds_have_no_update_transport() { + assert!(update_transport(Some(std::ffi::OsStr::new("ai.storyteller.photocraft"))).is_none()); + assert!(update_transport(None).is_some()); + } + #[test] fn xwayland_command_matches_how_photocraft_was_installed() { // Flatpak: WAYLAND_DISPLAY doesn't reach the sandbox's socket choice; flatpak's flags do. diff --git a/apps/photocraft/src/updates.rs b/apps/photocraft/src/updates.rs new file mode 100644 index 0000000000..bbe4a9f3dc --- /dev/null +++ b/apps/photocraft/src/updates.rs @@ -0,0 +1,126 @@ +//! Native HTTPS transport for release checks. Only public release metadata is requested. + +use photocraft_engine::updates_cmds::{CheckFn, CheckResult, parse_release}; +use std::time::Duration; + +const LATEST: &str = "https://api.github.com/repos/storytold/photocraft/releases/latest"; +const MAX_RESPONSE: u64 = 1024 * 1024; + +pub fn service() -> CheckFn { + Box::new(|| { + let (tx, rx) = std::sync::mpsc::channel(); + std::thread::Builder::new() + .name("update check".into()) + .spawn(move || { + let result = fetch(LATEST, Duration::from_secs(15)); + if let Err(e) = &result { + log::warn!("Update check: {e}"); + } + let _ = tx.send(result); + }) + .map_err(|e| format!("Could not start update check: {e}"))?; + Ok(rx) + }) +} + +fn fetch(url: &str, timeout: Duration) -> CheckResult { + // Respect the OS trust store (including managed-network certificates), while still + // validating the certificate chain and server name. + let agent = ureq::Agent::config_builder() + .tls_config(ureq::tls::TlsConfig::builder().root_certs(ureq::tls::RootCerts::PlatformVerifier).build()) + .timeout_global(Some(timeout)) + .max_redirects(0) + .build() + .new_agent(); + let mut response = match agent + .get(url) + .header("User-Agent", "PhotoCraft-update-check") + .header("Accept", "application/vnd.github+json") + .header("X-GitHub-Api-Version", "2026-03-10") + .call() + { + Ok(response) => response, + // The repository may not have published a stable release yet. + Err(ureq::Error::StatusCode(404)) => return Ok(None), + Err(ureq::Error::StatusCode(403 | 429)) => return Err("GitHub is limiting update checks. Please try again later.".into()), + Err(e) => return Err(format!("Could not contact the release server: {e}")), + }; + if response.status() != 200 { + return Err(format!("Unexpected release server status: {}", response.status())); + } + let bytes = response.body_mut().with_config().limit(MAX_RESPONSE).read_to_vec().map_err(|e| format!("Could not read release response: {e}"))?; + parse_release(&bytes, photocraft_engine::build_info::VERSION) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::io::{Read, Write}; + use std::net::TcpListener; + + fn server(status: &str, body: &str, extra: &str) -> (String, std::thread::JoinHandle) { + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + let url = format!("http://{}/latest", listener.local_addr().unwrap()); + let response = format!("HTTP/1.1 {status}\r\nContent-Length: {}\r\n{extra}Connection: close\r\n\r\n{body}", body.len()); + let worker = std::thread::spawn(move || { + let (mut stream, _) = listener.accept().unwrap(); + stream.set_read_timeout(Some(Duration::from_secs(5))).unwrap(); + let mut request = Vec::new(); + let mut chunk = [0; 1024]; + while !request.windows(4).any(|w| w == b"\r\n\r\n") { + let n = stream.read(&mut chunk).unwrap(); + if n == 0 { + break; + } + request.extend_from_slice(&chunk[..n]); + } + let _ = stream.write_all(response.as_bytes()); + String::from_utf8(request).unwrap() + }); + (url, worker) + } + + #[test] + fn fetches_release_metadata_with_generic_headers() { + let (url, worker) = server("200 OK", r#"{"tag_name":"v99.0.0","draft":false,"prerelease":false}"#, ""); + let result = fetch(&url, Duration::from_secs(5)).unwrap().unwrap(); + assert_eq!(result.version, "99.0.0"); + let request = worker.join().unwrap().to_ascii_lowercase(); + assert!(request.contains("user-agent: photocraft-update-check\r\n")); + assert!(request.contains("accept: application/vnd.github+json")); + assert!(!request.contains("authorization:") && !request.contains("cookie:")); + } + + #[test] + fn handles_missing_release_rate_limits_and_bad_responses() { + for (status, body, extra, expected_none) in [ + ("404 Not Found", "", "", true), + ("403 Forbidden", "", "", false), + ("429 Too Many Requests", "", "", false), + ("500 Internal Server Error", "", "", false), + ("200 OK", "invalid JSON", "", false), + ("302 Found", "", "Location: https://untrusted.example/\r\n", false), + ] { + let (url, worker) = server(status, body, extra); + let result = fetch(&url, Duration::from_secs(5)); + if expected_none { + assert_eq!(result, Ok(None)); + } else { + assert!(result.is_err(), "{status}"); + } + worker.join().unwrap(); + } + } + + #[test] + fn caps_response_size_and_times_out() { + let (url, worker) = server("200 OK", &" ".repeat(MAX_RESPONSE as usize + 1), ""); + assert!(fetch(&url, Duration::from_secs(5)).is_err()); + worker.join().unwrap(); + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + let url = format!("http://{}/latest", listener.local_addr().unwrap()); + let start = std::time::Instant::now(); + assert!(fetch(&url, Duration::from_millis(100)).is_err()); + assert!(start.elapsed() < Duration::from_secs(2)); + } +} diff --git a/crates/automation/src/server.rs b/crates/automation/src/server.rs index 46905daf38..afeb094c75 100644 --- a/crates/automation/src/server.rs +++ b/crates/automation/src/server.rs @@ -336,7 +336,8 @@ pub struct UiSetParams { /// "mode"), kinds (a list of layer kinds), name (matches part of the layer name) and mode (a /// blend mode name) for the Layers panel filter). strokeTrace (true, false, "stderr" or "off": /// the stroke latency trace at runtime; a CSV file is set at launch with --stroke-trace, not - /// over this channel). Other fields are an error. + /// over this channel). updatesOpen (bool, the Help › Check for Updates window). Other fields + /// are an error. pub fields: Value, } diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index ec5b4ac075..0a12ff7ff5 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -39,6 +39,8 @@ craft-print = { workspace = true } # Photoshop `.kys` shortcut sets (`edit.keyboardShortcuts` `importKys`); already in the tree # through photocraft-ui-egui and usvg. roxmltree = "0.20" +# Release tags use the same semantic versions as Cargo. +semver = "1" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] tempfile = "3" diff --git a/crates/engine/src/commands.rs b/crates/engine/src/commands.rs index 7c2577f4b6..3f59449ffc 100644 --- a/crates/engine/src/commands.rs +++ b/crates/engine/src/commands.rs @@ -1533,6 +1533,7 @@ fn build() -> Vec { v.extend(crate::layer_multi_cmds::specs()); v.extend(crate::layer_copy_cmds::specs()); v.extend(crate::prefs::specs()); + v.extend(crate::updates_cmds::specs()); v.extend(crate::edit_menu_cmds::specs()); v.extend(crate::fill_key_cmds::specs()); v.extend(crate::sample_cmds::specs()); diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index af69eb043f..29d1234d6a 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -130,6 +130,7 @@ pub mod type_extra_cmds; pub mod type_mask_cmds; pub mod type_spell_cmds; pub mod type_styles_cmds; +pub mod updates_cmds; mod variables_cmds; pub use variables_cmds::{export_data_sets_with, import_data_sets_text}; pub mod vector_cmds; @@ -493,6 +494,8 @@ pub struct Session { color_restrict: Option, /// Edit › Preferences, keyboard shortcuts, menu and toolbar customisation (see `prefs`). pub prefs: prefs::PrefsStore, + /// Release checks use an injected platform transport; no network I/O in the engine. + pub updates: updates_cmds::Updates, /// Edit menu state: Fade source, custom shape library (see `edit_menu_cmds`). pub edit_state: edit_menu_cmds::EditState, /// The pattern library (Window › Patterns; see `pattern.*`). diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs index a34bda68e9..600b015ee3 100644 --- a/crates/engine/src/prefs.rs +++ b/crates/engine/src/prefs.rs @@ -227,6 +227,8 @@ pub struct General { pub zoom_resizes_windows: bool, pub use_legacy_free_transform: bool, pub auto_show_home_screen: bool, + /// Desktop: check published stable releases once in the background at launch. + pub automatically_check_updates: bool, } impl Default for General { @@ -243,6 +245,7 @@ impl Default for General { zoom_resizes_windows: false, use_legacy_free_transform: false, auto_show_home_screen: true, + automatically_check_updates: true, } } } diff --git a/crates/engine/src/updates_cmds.rs b/crates/engine/src/updates_cmds.rs new file mode 100644 index 0000000000..76dbd91b6c --- /dev/null +++ b/crates/engine/src/updates_cmds.rs @@ -0,0 +1,221 @@ +//! Release-check state and commands. The desktop injects a non-blocking transport; the engine +//! owns the result so CLI, MCP and the GUI query the same state without network dependencies. + +use std::sync::mpsc::{Receiver, TryRecvError}; + +use semver::Version; +use serde::{Deserialize, Serialize}; +use serde_json::{Value, json}; + +use crate::commands::{CommandSpec, always}; +use crate::{EngineError, Result, Session}; + +pub const RELEASES: &str = "https://github.com/storytold/photocraft/releases"; +pub type CheckResult = std::result::Result, String>; +/// Starts background work and returns immediately. No document or personal data is sent. +pub type CheckFn = Box std::result::Result, String> + Send>; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Release { + pub version: String, + pub url: String, +} + +#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] +#[serde(tag = "status", rename_all = "camelCase")] +pub enum Status { + #[default] + Idle, + Checking, + UpToDate, + Available { + release: Release, + }, + Failed { + message: String, + }, +} + +#[derive(Default)] +pub struct Updates { + pub check: Option, + pub status: Status, + pending: Option>, +} + +impl Updates { + /// Consume a completed check; a disconnected worker becomes an actionable error. + pub fn poll(&mut self) -> bool { + let Some(rx) = &self.pending else { return false }; + let result = match rx.try_recv() { + Ok(r) => r, + Err(TryRecvError::Empty) => return false, + Err(TryRecvError::Disconnected) => Err("The update check stopped before returning a result".into()), + }; + self.pending = None; + self.status = match result { + Ok(Some(release)) => Status::Available { release }, + Ok(None) => Status::UpToDate, + Err(message) => Status::Failed { message }, + }; + true + } +} + +/// Interpret GitHub's latest-release response. Never trust a remote URL: construct the release +/// page from a validated tag in our own repository. Build metadata doesn't affect precedence. +pub fn parse_release(bytes: &[u8], current: &str) -> CheckResult { + #[derive(Deserialize)] + struct GithubRelease { + tag_name: String, + draft: bool, + prerelease: bool, + } + let release: GithubRelease = serde_json::from_slice(bytes).map_err(|e| format!("Invalid release response: {e}"))?; + if release.draft || release.prerelease { + return Ok(None); + } + let tag = &release.tag_name; + if tag.len() > 128 || !tag.bytes().all(|b| b.is_ascii_alphanumeric() || matches!(b, b'.' | b'-' | b'+')) { + return Err("Invalid release tag".into()); + } + let version = Version::parse(tag.strip_prefix('v').unwrap_or(tag)).map_err(|e| format!("Invalid release version: {e}"))?; + let current = Version::parse(current).map_err(|e| format!("Invalid installed version: {e}"))?; + if !version.pre.is_empty() || !version.cmp_precedence(¤t).is_gt() { + return Ok(None); + } + Ok(Some(Release { version: version.to_string(), url: format!("{RELEASES}/tag/{tag}") })) +} + +fn empty_params(p: &Value) -> Result<()> { + if p.as_object().is_some_and(|p| p.is_empty()) { Ok(()) } else { Err(EngineError::Other("update commands take an empty object".into())) } +} + +fn enabled(s: &Session) -> std::result::Result<(), String> { + s.updates.check.as_ref().map(|_| ()).ok_or_else(|| "Update checks are unavailable in this frontend".into()) +} + +fn check(s: &mut Session, p: &Value) -> Result { + empty_params(p)?; + // Repeated automation requests must not spawn an unbounded number of network workers. + if s.updates.pending.is_none() { + let start = s.updates.check.as_mut().ok_or_else(|| EngineError::Other("Update checks are unavailable in this frontend".into()))?; + match start() { + Ok(rx) => { + s.updates.pending = Some(rx); + s.updates.status = Status::Checking; + } + Err(message) => { + s.updates.status = Status::Failed { message: message.clone() }; + return Err(EngineError::Other(message)); + } + } + } + Ok(json!(s.updates.status)) +} + +pub fn specs() -> Vec { + vec![ + CommandSpec { + id: "help.checkForUpdates", + label: "Check for Updates…", + menu: &["Help"], + shortcut: None, + params: "{}", + enabled, + run: check, + journal: false, + }, + CommandSpec { + id: "updates.status", + label: "Update Check Status", + menu: &[], + shortcut: None, + params: "{}", + enabled: always, + run: |s, p| { + empty_params(p)?; + s.updates.poll(); + Ok(json!({"supported": s.updates.check.is_some(), "currentVersion": crate::build_info::VERSION, "result": s.updates.status})) + }, + journal: false, + }, + ] +} + +#[cfg(test)] +mod tests { + use super::*; + + fn response(tag: &str) -> Vec { + serde_json::to_vec(&json!({"tag_name": tag, "draft": false, "prerelease": false, "html_url": "https://untrusted.example"})).unwrap() + } + + #[test] + fn semantic_versions_and_trusted_links() { + let release = parse_release(&response("v0.10.0"), "0.9.0").unwrap().unwrap(); + assert_eq!(release.version, "0.10.0"); + assert_eq!(release.url, format!("{RELEASES}/tag/v0.10.0")); + for tag in ["v0.9.0", "v0.8.9", "v0.9.0+build.2", "v1.0.0-rc.1"] { + assert_eq!(parse_release(&response(tag), "0.9.0").unwrap(), None, "{tag}"); + } + assert!(parse_release(&response("0.9.0"), "0.9.0-rc.1").unwrap().is_some()); + } + + #[test] + fn unpublished_and_hostile_responses() { + for flag in ["draft", "prerelease"] { + let mut v: Value = serde_json::from_slice(&response("v1.0.0")).unwrap(); + v[flag] = json!(true); + assert_eq!(parse_release(&serde_json::to_vec(&v).unwrap(), "0.7.0").unwrap(), None); + } + for tag in ["", "latest", "v1.0.0/../evil", "v1.0.0?next=evil", "v1.0.0\n", "版本1.0.0", "999999999999999999999.0.0"] { + assert!(parse_release(&response(tag), "0.7.0").is_err(), "{tag}"); + } + for bytes in [b"not JSON".as_slice(), b"{}", b"null", b"{\"tag_name\":42}"] { + assert!(parse_release(bytes, "0.7.0").is_err()); + } + } + + #[test] + fn commands_are_nonblocking_deduplicated_and_queryable_without_a_document() { + let mut s = Session::new(); + let (tx, rx) = std::sync::mpsc::channel(); + let mut rx = Some(rx); + s.updates.check = Some(Box::new(move || Ok(rx.take().expect("only one worker")))); + for _ in 0..3 { + assert_eq!(s.execute("help.checkForUpdates", json!({})).unwrap()["status"], "checking"); + } + tx.send(Ok(Some(Release { version: "1.0.0".into(), url: format!("{RELEASES}/tag/v1.0.0") }))).unwrap(); + let status = s.execute("updates.status", json!({})).unwrap(); + assert_eq!(status["result"]["status"], "available"); + assert_eq!(status["result"]["release"]["version"], "1.0.0"); + assert!(s.journal.is_empty()); + } + + #[test] + fn graceful_failures_and_preference_compatibility() { + let mut s = Session::new(); + assert!(s.execute("help.checkForUpdates", json!({})).is_err()); + for p in [Value::Null, json!([]), json!({"url": "evil"}), json!("bad")] { + assert!(s.execute("updates.status", p.clone()).is_err()); + assert!(check(&mut s, &p).is_err()); + } + s.updates.check = Some(Box::new(|| Err("Could not start worker".into()))); + assert!(s.execute("help.checkForUpdates", json!({})).is_err()); + assert!(matches!(s.updates.status, Status::Failed { .. })); + s.updates.check = Some(Box::new(|| { + let (_tx, rx) = std::sync::mpsc::channel(); + Ok(rx) + })); + s.execute("help.checkForUpdates", json!({})).unwrap(); + assert_eq!(s.execute("updates.status", json!({})).unwrap()["result"]["status"], "failed"); + s.load_prefs_json("{}").unwrap(); + assert!(s.prefs().general.automatically_check_updates); + s.execute("prefs.set", json!({"path": "general.automaticallyCheckUpdates", "value": false})).unwrap(); + let saved = s.prefs_to_json(); + let mut restored = Session::new(); + restored.load_prefs_json(&saved).unwrap(); + assert!(!restored.prefs().general.automatically_check_updates); + } +} diff --git a/crates/ui-egui/examples/snapshot.rs b/crates/ui-egui/examples/snapshot.rs index 3a461040f6..7fa07a10bc 100644 --- a/crates/ui-egui/examples/snapshot.rs +++ b/crates/ui-egui/examples/snapshot.rs @@ -11,6 +11,7 @@ //! `--safe-gpu` draws the canvas on the CPU path, like the app's `--safe-gpu` launch. //! `--hardware-filtering` respects texture samplers; the default predictable renderer forces bilinear filtering. //! `--wayland-notice` previews the native file drag-and-drop guidance shown in Wayland sessions. +//! `--update-notice` previews a newer release without contacting the network. //! `--custom-titlebar` draws the Windows/Linux title bar (caption buttons in the top bar). //! //! `--monitor 1366x768 --window-top 31` simulates the display the window is on (in points) and @@ -38,6 +39,7 @@ fn main() { .unwrap_or((1440.0, 900.0)); let scale: f32 = arg(&args, "--scale").and_then(|s| s.parse().ok()).unwrap_or(2.0); let wayland_notice = args.iter().any(|a| a == "--wayland-notice"); + let update_notice = args.iter().any(|a| a == "--update-notice"); let script: Vec<(String, Value)> = arg(&args, "--script").map(|s| serde_json::from_str::>(&s).expect("--script must be [[method, params], …]")).unwrap_or_default(); @@ -83,6 +85,14 @@ fn main() { services.is_wayland = wayland_notice; services.xwayland_command = wayland_notice.then(|| "WAYLAND_DISPLAY= photocraft".into()); let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), services); + if update_notice { + app.session.updates.status = photocraft_engine::updates_cmds::Status::Available { + release: photocraft_engine::updates_cmds::Release { + version: "99.0.0".into(), + url: "https://github.com/storytold/photocraft/releases/tag/v99.0.0".into(), + }, + }; + } app.background_jobs = background_jobs; app.custom_titlebar = custom_titlebar; // `--safe-gpu`: the CPU canvas, as the desktop app's `--safe-gpu` launch. diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index c30ed4b8f1..61e5690bd2 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -133,7 +133,8 @@ pub enum Outcome { /// field's value is validated before the first one is applied, so a typo, an unknown field, a /// bad value or a bad nested key can't reply with success while nothing — or only half of it — /// changed (#412). -pub const UI_SET_FIELDS: [&str; 38] = [ +pub const UI_SET_FIELDS: [&str; 39] = [ + "updatesOpen", "tool", "strokeTrace", "panels", @@ -581,6 +582,7 @@ fn dispatch(app: &mut PhotocraftApp, ctx: &egui::Context, req: &ControlRequest) } let panels = merged_object(&app.ui.panels, p.get("panels"), "panels")?; let mask_target = bool_field(p, "maskTarget")?; + let updates_open = bool_field(p, "updatesOpen")?; let vector_mask_target = bool_field(p, "vectorMaskTarget")?; let selection_mode = uint_field(p, "selectionMode")?; let dock_tabs = merged_object(&app.ui.dock_tabs, p.get("dockTabs"), "dockTabs")?; @@ -747,6 +749,9 @@ fn dispatch(app: &mut PhotocraftApp, ctx: &egui::Context, req: &ControlRequest) app.ui.vector_mask_target &= !m; app.sync_mask_targets(); } + if let Some(open) = updates_open { + app.ui.updates_open = open; + } if let Some(m) = vector_mask_target { app.ui.vector_mask_target = m; app.ui.mask_target &= !m; @@ -1384,6 +1389,8 @@ pub fn inspect(app: &PhotocraftApp, ctx: &egui::Context) -> Value { "status": app.ui.status, "statusError": app.ui.status_error, "notices": app.ui.notices, + "updatesOpen": app.ui.updates_open, + "updates": {"supported": app.session.updates.check.is_some(), "currentVersion": photocraft_engine::build_info::VERSION, "result": app.session.updates.status}, "gpuFallbackNotice": app.ui.gpu_fallback_notice, "kysOffer": app.ui.kys_offer, "frame": app.frame, diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 53991f62c6..e33b82c541 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3846,6 +3846,19 @@ navigator Zoom Zvětšení Sent to {printer} Odesláno do {printer} set in Print Settings… nastavuje se v nastavení tisku… ICO is limited to 256 × 256 pixels ICO je omezen na 256 × 256 pixelů +# PhotoCraft release checks. + Check for Updates… Zkontrolovat aktualizace… + PhotoCraft Updates Aktualizace PhotoCraft + Checking for updates… Kontrola aktualizací… + Open the release page to choose an installer for your system. Otevřete stránku vydání a vyberte instalační program pro svůj systém. + Open Download Page Otevřít stránku ke stažení + PhotoCraft is up to date. PhotoCraft je aktuální. + Could not check for updates. Aktualizace se nepodařilo zkontrolovat. + Updates have not been checked yet. Aktualizace ještě nebyly zkontrolovány. + Check Again Zkontrolovat znovu + Automatically Check for Updates Automaticky kontrolovat aktualizace + Installed version: {version} Nainstalovaná verze: {version} + PhotoCraft {version} is available. PhotoCraft {version} je k dispozici. # History panel › History Brush source (#2966) Paints from the History panel's source state Maluje ze zdrojového stavu panelu Historie Sets the source for the history brush Nastaví zdroj pro štětec historie diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 9e0a1e5341..c454af9b36 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3248,6 +3248,19 @@ curves Smooth Glätten Sent to {printer} An {printer} gesendet set in Print Settings… in den Druckeinstellungen festlegen… ICO is limited to 256 × 256 pixels ICO ist auf 256 × 256 Pixel begrenzt +# PhotoCraft release checks. + Check for Updates… Nach Updates suchen… + PhotoCraft Updates PhotoCraft-Updates + Checking for updates… Suche nach Updates… + Open the release page to choose an installer for your system. Öffnen Sie die Versionsseite und wählen Sie ein Installationspaket für Ihr System. + Open Download Page Downloadseite öffnen + PhotoCraft is up to date. PhotoCraft ist auf dem neuesten Stand. + Could not check for updates. Updates konnten nicht geprüft werden. + Updates have not been checked yet. Es wurde noch nicht nach Updates gesucht. + Check Again Erneut prüfen + Automatically Check for Updates Automatisch nach Updates suchen + Installed version: {version} Installierte Version: {version} + PhotoCraft {version} is available. PhotoCraft {version} ist verfügbar. # History panel › History Brush source (#2966) Paints from the History panel's source state Malt aus dem Quellzustand des Protokollbedienfelds Sets the source for the history brush Legt die Quelle für den Protokollpinsel fest diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 67bc765392..aecded2b6f 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3932,6 +3932,19 @@ curves Smooth Εξομάλυνση Sent to {printer} Στάλθηκε στον {printer} set in Print Settings… ορίζεται στις ρυθμίσεις εκτύπωσης… ICO is limited to 256 × 256 pixels Το ICO περιορίζεται σε 256 × 256 εικονοστοιχεία +# PhotoCraft release checks. + Check for Updates… Έλεγχος ενημερώσεων… + PhotoCraft Updates Ενημερώσεις PhotoCraft + Checking for updates… Έλεγχος για ενημερώσεις… + Open the release page to choose an installer for your system. Ανοίξτε τη σελίδα της έκδοσης για να επιλέξετε πρόγραμμα εγκατάστασης για το σύστημά σας. + Open Download Page Άνοιγμα σελίδας λήψης + PhotoCraft is up to date. Το PhotoCraft είναι ενημερωμένο. + Could not check for updates. Δεν ήταν δυνατός ο έλεγχος ενημερώσεων. + Updates have not been checked yet. Δεν έχει γίνει ακόμη έλεγχος ενημερώσεων. + Check Again Νέος έλεγχος + Automatically Check for Updates Αυτόματος έλεγχος ενημερώσεων + Installed version: {version} Εγκατεστημένη έκδοση: {version} + PhotoCraft {version} is available. Το PhotoCraft {version} είναι διαθέσιμο. # History panel › History Brush source (#2966) Paints from the History panel's source state Βάφει από την κατάσταση πηγής του πίνακα Ιστορικό Sets the source for the history brush Ορίζει την πηγή για το πινέλο ιστορικού diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 469dec92a1..56548b1ec1 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4195,6 +4195,19 @@ navigator Zoom Zoom Sent to {printer} Enviado a {printer} set in Print Settings… se establece en Ajustes de impresión… ICO is limited to 256 × 256 pixels ICO está limitado a 256 × 256 píxeles +# PhotoCraft release checks. + Check for Updates… Buscar actualizaciones… + PhotoCraft Updates Actualizaciones de PhotoCraft + Checking for updates… Buscando actualizaciones… + Open the release page to choose an installer for your system. Abra la página de la versión para elegir un instalador para su sistema. + Open Download Page Abrir página de descarga + PhotoCraft is up to date. PhotoCraft está actualizado. + Could not check for updates. No se pudieron buscar actualizaciones. + Updates have not been checked yet. Aún no se han buscado actualizaciones. + Check Again Comprobar de nuevo + Automatically Check for Updates Buscar actualizaciones automáticamente + Installed version: {version} Versión instalada: {version} + PhotoCraft {version} is available. PhotoCraft {version} está disponible. # History panel › History Brush source (#2966) Paints from the History panel's source state Pinta a partir del estado de origen del panel Historia Sets the source for the history brush Establece el origen del pincel de historia diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 132bdddadb..4eff01f025 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3241,6 +3241,19 @@ curves Smooth Lisser Sent to {printer} Envoyé à {printer} set in Print Settings… défini dans les paramètres d’impression… ICO is limited to 256 × 256 pixels Le format ICO est limité à 256 × 256 pixels +# PhotoCraft release checks. + Check for Updates… Rechercher des mises à jour… + PhotoCraft Updates Mises à jour de PhotoCraft + Checking for updates… Recherche de mises à jour… + Open the release page to choose an installer for your system. Ouvrez la page de la version pour choisir un programme d’installation pour votre système. + Open Download Page Ouvrir la page de téléchargement + PhotoCraft is up to date. PhotoCraft est à jour. + Could not check for updates. Impossible de rechercher des mises à jour. + Updates have not been checked yet. Les mises à jour n’ont pas encore été vérifiées. + Check Again Vérifier à nouveau + Automatically Check for Updates Rechercher automatiquement des mises à jour + Installed version: {version} Version installée : {version} + PhotoCraft {version} is available. PhotoCraft {version} est disponible. # History panel › History Brush source (#2966) Paints from the History panel's source state Peint à partir de l'état source du panneau Historique Sets the source for the history brush Définit la source du pinceau d'historique diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index c5e32f7ef5..0cd1939b96 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4136,6 +4136,18 @@ cameraRaw Yellow Sárga Shadow Mode Árnyék módja Shadow Color Árnyék színe Shadow Opacity Árnyék fedettsége + Check for Updates… Frissítések keresése… + PhotoCraft Updates PhotoCraft-frissítések + Checking for updates… Frissítések keresése… + Open the release page to choose an installer for your system. Nyissa meg a kiadás oldalát, és válassza ki a rendszerének megfelelő telepítőt. + Open Download Page Letöltési oldal megnyitása + PhotoCraft is up to date. A PhotoCraft naprakész. + Could not check for updates. Nem sikerült ellenőrizni a frissítéseket. + Updates have not been checked yet. A frissítések még nem lettek ellenőrizve. + Check Again Újraellenőrzés + Automatically Check for Updates Frissítések automatikus keresése + Installed version: {version} Telepített verzió: {version} + PhotoCraft {version} is available. Elérhető a PhotoCraft {version}. # Embedded Profile Mismatch: profile names beside the choices, Remember this choice Use the embedded profile ({profile}) A beágyazott profil használata ({profile}) Convert to the working space ({profile}) Átalakítás a munkaszíntérbe ({profile}) diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 34eb27eea8..97c6d4cba6 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3244,6 +3244,19 @@ curves Smooth Haluskan Sent to {printer} Dikirim ke {printer} set in Print Settings… diatur di Pengaturan Cetak… ICO is limited to 256 × 256 pixels ICO dibatasi hingga 256 × 256 piksel +# PhotoCraft release checks. + Check for Updates… Periksa Pembaruan… + PhotoCraft Updates Pembaruan PhotoCraft + Checking for updates… Memeriksa pembaruan… + Open the release page to choose an installer for your system. Buka halaman rilis untuk memilih penginstal bagi sistem Anda. + Open Download Page Buka Halaman Unduhan + PhotoCraft is up to date. PhotoCraft sudah versi terbaru. + Could not check for updates. Tidak dapat memeriksa pembaruan. + Updates have not been checked yet. Pembaruan belum diperiksa. + Check Again Periksa Lagi + Automatically Check for Updates Periksa Pembaruan Secara Otomatis + Installed version: {version} Versi terpasang: {version} + PhotoCraft {version} is available. PhotoCraft {version} tersedia. # History panel › History Brush source (#2966) Paints from the History panel's source state Melukis dari status sumber panel Riwayat Sets the source for the history brush Menetapkan sumber untuk kuas riwayat diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 59dcf464de..f1a3096420 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4198,6 +4198,19 @@ navigator Zoom Zoom Sent to {printer} Inviato a {printer} set in Print Settings… impostato nelle impostazioni di stampa… ICO is limited to 256 × 256 pixels ICO è limitato a 256 × 256 pixel +# PhotoCraft release checks. + Check for Updates… Cerca aggiornamenti… + PhotoCraft Updates Aggiornamenti di PhotoCraft + Checking for updates… Ricerca aggiornamenti… + Open the release page to choose an installer for your system. Apri la pagina della versione per scegliere un programma di installazione per il tuo sistema. + Open Download Page Apri pagina di download + PhotoCraft is up to date. PhotoCraft è aggiornato. + Could not check for updates. Impossibile cercare aggiornamenti. + Updates have not been checked yet. Gli aggiornamenti non sono ancora stati verificati. + Check Again Controlla di nuovo + Automatically Check for Updates Cerca automaticamente aggiornamenti + Installed version: {version} Versione installata: {version} + PhotoCraft {version} is available. PhotoCraft {version} è disponibile. # History panel › History Brush source (#2966) Paints from the History panel's source state Dipinge dallo stato di origine del pannello Cronologia Sets the source for the history brush Imposta l'origine del pennello storia diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index e271bfec7b..0da5bfac2c 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3912,6 +3912,19 @@ curves Smooth スムーズ Reset All Locked Settings ロックされた設定をすべて初期化 Copy Texture to Other Tools テクスチャを他のツールにコピー ICO is limited to 256 × 256 pixels ICO は 256 × 256 ピクセルまでです +# PhotoCraft release checks. + Check for Updates… アップデートを確認… + PhotoCraft Updates PhotoCraft のアップデート + Checking for updates… アップデートを確認中… + Open the release page to choose an installer for your system. リリースページでお使いのシステム用のインストーラーを選択してください。 + Open Download Page ダウンロードページを開く + PhotoCraft is up to date. PhotoCraft は最新です。 + Could not check for updates. アップデートを確認できませんでした。 + Updates have not been checked yet. まだアップデートを確認していません。 + Check Again 再確認 + Automatically Check for Updates アップデートを自動的に確認 + Installed version: {version} インストール済みのバージョン: {version} + PhotoCraft {version} is available. PhotoCraft {version} が利用可能です。 # History panel › History Brush source (#2966) Paints from the History panel's source state ヒストリーパネルのソース状態からペイントします Sets the source for the history brush ヒストリーブラシのソースを設定します diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index f41856037a..f64c71f87e 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3435,6 +3435,19 @@ curves Smooth 매끄럽게 Sent to {printer} {printer}(으)로 전송됨 set in Print Settings… 인쇄 설정에서 지정… ICO is limited to 256 × 256 pixels ICO는 256 × 256픽셀로 제한됩니다 +# PhotoCraft release checks. + Check for Updates… 업데이트 확인… + PhotoCraft Updates PhotoCraft 업데이트 + Checking for updates… 업데이트 확인 중… + Open the release page to choose an installer for your system. 릴리스 페이지에서 시스템에 맞는 설치 프로그램을 선택하세요. + Open Download Page 다운로드 페이지 열기 + PhotoCraft is up to date. PhotoCraft가 최신 버전입니다. + Could not check for updates. 업데이트를 확인할 수 없습니다. + Updates have not been checked yet. 아직 업데이트를 확인하지 않았습니다. + Check Again 다시 확인 + Automatically Check for Updates 자동으로 업데이트 확인 + Installed version: {version} 설치된 버전: {version} + PhotoCraft {version} is available. PhotoCraft {version}을 사용할 수 있습니다. # History panel › History Brush source (#2966) Paints from the History panel's source state 작업 내역 패널의 소스 상태에서 칠합니다 Sets the source for the history brush 작업 내역 브러시의 소스를 설정합니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 2500efd59b..d936a62cdc 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -3994,6 +3994,19 @@ curves Smooth Vloeiend maken Sent to {printer} Verzonden naar {printer} set in Print Settings… instellen in de afdrukinstellingen… ICO is limited to 256 × 256 pixels ICO is beperkt tot 256 × 256 pixels +# PhotoCraft release checks. + Check for Updates… Controleren op updates… + PhotoCraft Updates PhotoCraft-updates + Checking for updates… Controleren op updates… + Open the release page to choose an installer for your system. Open de releasepagina om een installatieprogramma voor uw systeem te kiezen. + Open Download Page Downloadpagina openen + PhotoCraft is up to date. PhotoCraft is bijgewerkt. + Could not check for updates. Kan niet controleren op updates. + Updates have not been checked yet. Er is nog niet op updates gecontroleerd. + Check Again Opnieuw controleren + Automatically Check for Updates Automatisch op updates controleren + Installed version: {version} Geïnstalleerde versie: {version} + PhotoCraft {version} is available. PhotoCraft {version} is beschikbaar. # History panel › History Brush source (#2966) Paints from the History panel's source state Schildert vanuit de bronstatus van het deelvenster Geschiedenis Sets the source for the history brush Stelt de bron voor het historiepenseel in diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 7d058db9bc..facad5e282 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3848,6 +3848,19 @@ curves Smooth Wygładź Sent to {printer} Wysłano do {printer} set in Print Settings… ustawiane w ustawieniach druku… ICO is limited to 256 × 256 pixels ICO jest ograniczony do 256 × 256 pikseli +# PhotoCraft release checks. + Check for Updates… Sprawdź aktualizacje… + PhotoCraft Updates Aktualizacje PhotoCraft + Checking for updates… Sprawdzanie aktualizacji… + Open the release page to choose an installer for your system. Otwórz stronę wydania, aby wybrać instalator dla swojego systemu. + Open Download Page Otwórz stronę pobierania + PhotoCraft is up to date. PhotoCraft jest aktualny. + Could not check for updates. Nie udało się sprawdzić aktualizacji. + Updates have not been checked yet. Aktualizacje nie zostały jeszcze sprawdzone. + Check Again Sprawdź ponownie + Automatically Check for Updates Automatycznie sprawdzaj aktualizacje + Installed version: {version} Zainstalowana wersja: {version} + PhotoCraft {version} is available. PhotoCraft {version} jest dostępny. # History panel › History Brush source (#2966) Paints from the History panel's source state Maluje ze stanu źródłowego panelu Historia Sets the source for the history brush Ustawia źródło dla pędzla historii diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 4751c6bb76..c81381080f 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4024,6 +4024,19 @@ layerLabel No Color Sem cor Sent to {printer} Enviado para {printer} set in Print Settings… definido nas configurações de impressão… ICO is limited to 256 × 256 pixels ICO é limitado a 256 × 256 pixels +# PhotoCraft release checks. + Check for Updates… Verificar atualizações… + PhotoCraft Updates Atualizações do PhotoCraft + Checking for updates… Verificando atualizações… + Open the release page to choose an installer for your system. Abra a página da versão para escolher um instalador para o seu sistema. + Open Download Page Abrir página de download + PhotoCraft is up to date. O PhotoCraft está atualizado. + Could not check for updates. Não foi possível verificar atualizações. + Updates have not been checked yet. As atualizações ainda não foram verificadas. + Check Again Verificar novamente + Automatically Check for Updates Verificar atualizações automaticamente + Installed version: {version} Versão instalada: {version} + PhotoCraft {version} is available. PhotoCraft {version} está disponível. # History panel › History Brush source (#2966) Paints from the History panel's source state Pinta a partir do estado de origem do painel Histórico Sets the source for the history brush Define a origem do pincel do histórico diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d7a335de3e..76bda3c414 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3217,6 +3217,19 @@ curves Smooth Сгладить Shadow Mode Режим теней Shadow Color Цвет теней Shadow Opacity Непрозрачность теней +# PhotoCraft release checks. + Check for Updates… Проверить обновления… + PhotoCraft Updates Обновления PhotoCraft + Checking for updates… Проверка обновлений… + Open the release page to choose an installer for your system. Откройте страницу выпуска и выберите установщик для своей системы. + Open Download Page Открыть страницу загрузки + PhotoCraft is up to date. Установлена последняя версия PhotoCraft. + Could not check for updates. Не удалось проверить обновления. + Updates have not been checked yet. Обновления ещё не проверялись. + Check Again Проверить снова + Automatically Check for Updates Автоматически проверять обновления + Installed version: {version} Установленная версия: {version} + PhotoCraft {version} is available. Доступна версия PhotoCraft {version}. # Embedded Profile Mismatch: profile names beside the choices, Remember this choice Use the embedded profile ({profile}) Использовать встроенный профиль ({profile}) Convert to the working space ({profile}) Преобразовать в рабочее пространство ({profile}) diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index 67132c7b2e..a655837d3e 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -4310,6 +4310,7 @@ shape Appearance Izgled # View › Guides › right-click a guide Edit Selected Guides Uredi izabrane vodilje Clear Selected Guides Ukloni izabrane vodilje + Bicubic Automatic Bikubično automatski Bicubic Smoother Bikubično glađe Bicubic Sharper Bikubično oštrije @@ -4461,3 +4462,16 @@ shape Appearance Izgled # Print preview image (#8236) Print preview image Print preview image +# PhotoCraft release checks. + Check for Updates… Proveri ažuriranja… + PhotoCraft Updates Ažuriranja za PhotoCraft + Checking for updates… Provera ažuriranja… + Open the release page to choose an installer for your system. Otvorite stranicu izdanja da biste izabrali instalacioni program za svoj sistem. + Open Download Page Otvori stranicu za preuzimanje + PhotoCraft is up to date. PhotoCraft je ažuran. + Could not check for updates. Nije moguće proveriti ažuriranja. + Updates have not been checked yet. Ažuriranja još nisu proverena. + Check Again Proveri ponovo + Automatically Check for Updates Automatski proveravaj ažuriranja + Installed version: {version} Instalirana verzija: {version} + PhotoCraft {version} is available. Dostupan je PhotoCraft {version}. diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 94e0ed0f5f..e09affe420 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3948,6 +3948,18 @@ cameraData Lens Lens Shadow Mode Gölge Modu Shadow Color Gölge Rengi Shadow Opacity Gölge Opaklığı + Check for Updates… Güncellemeleri Denetle… + PhotoCraft Updates PhotoCraft Güncellemeleri + Checking for updates… Güncellemeler denetleniyor… + Open the release page to choose an installer for your system. Sisteminize uygun yükleyiciyi seçmek için sürüm sayfasını açın. + Open Download Page İndirme Sayfasını Aç + PhotoCraft is up to date. PhotoCraft güncel. + Could not check for updates. Güncellemeler denetlenemedi. + Updates have not been checked yet. Güncellemeler henüz denetlenmedi. + Check Again Yeniden Denetle + Automatically Check for Updates Güncellemeleri Otomatik Denetle + Installed version: {version} Yüklü sürüm: {version} + PhotoCraft {version} is available. PhotoCraft {version} kullanılabilir. # Embedded Profile Mismatch: profile names beside the choices, Remember this choice Use the embedded profile ({profile}) Gömülü profili kullanın ({profile}) Convert to the working space ({profile}) Çalışma alanına dönüştürün ({profile}) diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index d51858d596..792dd67380 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3933,6 +3933,19 @@ curves Smooth Згладити Sent to {printer} Надіслано на {printer} set in Print Settings… задається в параметрах друку… ICO is limited to 256 × 256 pixels ICO обмежено розміром 256 × 256 пікселів +# PhotoCraft release checks. + Check for Updates… Перевірити оновлення… + PhotoCraft Updates Оновлення PhotoCraft + Checking for updates… Перевірка оновлень… + Open the release page to choose an installer for your system. Відкрийте сторінку випуску й виберіть інсталятор для своєї системи. + Open Download Page Відкрити сторінку завантаження + PhotoCraft is up to date. PhotoCraft оновлено до останньої версії. + Could not check for updates. Не вдалося перевірити оновлення. + Updates have not been checked yet. Оновлення ще не перевірялися. + Check Again Перевірити знову + Automatically Check for Updates Автоматично перевіряти оновлення + Installed version: {version} Встановлена версія: {version} + PhotoCraft {version} is available. Доступна версія PhotoCraft {version}. # History panel › History Brush source (#2966) Paints from the History panel's source state Малює з вихідного стану панелі «Історія» Sets the source for the history brush Задає джерело для пензля історії diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index a7bd89b403..7a60d3d558 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3696,6 +3696,18 @@ curves Smooth Làm mượt Sent to {printer} Đã gửi tới {printer} set in Print Settings… đặt trong thiết lập in… ICO is limited to 256 × 256 pixels ICO giới hạn ở 256 × 256 pixel + Check for Updates… Kiểm tra bản cập nhật… + PhotoCraft Updates Bản cập nhật PhotoCraft + Checking for updates… Đang kiểm tra bản cập nhật… + Open the release page to choose an installer for your system. Mở trang phát hành để chọn bộ cài đặt cho hệ thống của bạn. + Open Download Page Mở trang tải xuống + PhotoCraft is up to date. PhotoCraft đã được cập nhật. + Could not check for updates. Không thể kiểm tra bản cập nhật. + Updates have not been checked yet. Chưa kiểm tra bản cập nhật. + Check Again Kiểm tra lại + Automatically Check for Updates Tự động kiểm tra bản cập nhật + Installed version: {version} Phiên bản đã cài: {version} + PhotoCraft {version} is available. PhotoCraft {version} đã có sẵn. # History panel › History Brush source (#2966) Paints from the History panel's source state Vẽ từ trạng thái nguồn của bảng Lịch sử Sets the source for the history brush Đặt nguồn cho cọ lịch sử diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index edd08b42b7..dd72fa2d07 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2882,6 +2882,19 @@ curves Smooth 平滑 Sent to {printer} 已发送到 {printer} set in Print Settings… 在打印设置中设置… ICO is limited to 256 × 256 pixels ICO 最大为 256 × 256 像素 +# PhotoCraft release checks. + Check for Updates… 检查更新… + PhotoCraft Updates PhotoCraft 更新 + Checking for updates… 正在检查更新… + Open the release page to choose an installer for your system. 打开发布页,选择适合您系统的安装包。 + Open Download Page 打开下载页面 + PhotoCraft is up to date. PhotoCraft 已是最新版本。 + Could not check for updates. 无法检查更新。 + Updates have not been checked yet. 尚未检查更新。 + Check Again 重新检查 + Automatically Check for Updates 自动检查更新 + Installed version: {version} 已安装版本:{version} + PhotoCraft {version} is available. PhotoCraft {version} 已发布。 # History panel › History Brush source (#2966) Paints from the History panel's source state 从历史记录面板的源状态绘画 Sets the source for the history brush 设置历史记录画笔的源 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 7130f18589..10a2deeea7 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2846,6 +2846,19 @@ curves Smooth 平滑 Sent to {printer} 已傳送至 {printer} set in Print Settings… 在列印設定中設定… ICO is limited to 256 × 256 pixels ICO 最大為 256 × 256 像素 +# PhotoCraft release checks. + Check for Updates… 檢查更新… + PhotoCraft Updates PhotoCraft 更新 + Checking for updates… 正在檢查更新… + Open the release page to choose an installer for your system. 開啟發佈頁,選擇適合您系統的安裝程式。 + Open Download Page 開啟下載頁面 + PhotoCraft is up to date. PhotoCraft 已是最新版本。 + Could not check for updates. 無法檢查更新。 + Updates have not been checked yet. 尚未檢查更新。 + Check Again 重新檢查 + Automatically Check for Updates 自動檢查更新 + Installed version: {version} 已安裝版本:{version} + PhotoCraft {version} is available. PhotoCraft {version} 已發佈。 # History panel › History Brush source (#2966) Paints from the History panel's source state 從步驟記錄面板的來源狀態繪畫 Sets the source for the history brush 設定步驟記錄筆刷的來源 diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index da2ae0e282..3fb53e9330 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -246,6 +246,7 @@ mod type_font_preview; pub mod type_panels_ui; pub mod type_tool; mod type_transform; +pub mod updates_ui; mod variables_ui; pub mod vector_ui; pub mod view_cmds; @@ -600,6 +601,8 @@ pub struct Services { /// Preferences ▸ General ▸ Beep When Done: the platform's default beep, played when a /// background job finishes successfully. `None` in the web build (and in tests). pub beep: Option, + /// Starts a background check for published releases (desktop, outside Flatpak). + pub check_updates: Option, /// Files delivered asynchronously (web drag-and-drop): drained every frame and opened as /// documents. pub inbox: Option, @@ -958,6 +961,7 @@ pub struct PhotocraftApp { pub stroke_trace: stroke_trace::StrokeTrace, /// Preferences, autosave and snapping runtime state (see `prefs_ui`, `snap_ui`). pub(crate) prefs_rt: prefs_ui::Runtime, + pub(crate) updates_rt: updates_ui::Runtime, /// Close, Revert or Exit parked behind the unsaved-changes prompt (see `discard_ui`). pub(crate) discard: Option, /// The Open or Save dialog in progress, and the action waiting on it (see `file_dialog`). @@ -1001,7 +1005,8 @@ pub struct PhotocraftApp { } impl PhotocraftApp { - pub fn new(session: Session, services: Services) -> Self { + pub fn new(mut session: Session, mut services: Services) -> Self { + session.updates.check = services.check_updates.take(); let mut app = Self { session, ui: UiState::default(), @@ -1133,6 +1138,7 @@ impl PhotocraftApp { perf: Default::default(), stroke_trace: stroke_trace::StrokeTrace::from_env(), prefs_rt: Default::default(), + updates_rt: Default::default(), discard: None, file_dialog: None, tiff_options: None, @@ -2276,6 +2282,7 @@ impl eframe::App for PhotocraftApp { self.collect_screenshots(ctx); self.issue_screenshots(ctx); prefs_ui::tick(self, ctx); + updates_ui::tick(self, ctx); monitor_status::poll_frame(self, ctx, frame); // Control requests and persisted preferences can change the language in this frame. i18n::sync_context(ctx, &self.session.prefs().interface.language); @@ -2458,6 +2465,7 @@ impl eframe::App for PhotocraftApp { wide_angle_ui::show(self, &ctx); canvas::extra_windows(self, &ctx); notices::show(self, &ctx); + updates_ui::show(self, &ctx); gpu_status::show_fallback(self, &ctx); kys_import::show_offer(self, &ctx); if self.titlebar_modal_drag(chrome) { diff --git a/crates/ui-egui/src/links.rs b/crates/ui-egui/src/links.rs index e01a19d93d..2042d996e0 100644 --- a/crates/ui-egui/src/links.rs +++ b/crates/ui-egui/src/links.rs @@ -102,7 +102,20 @@ mod tests { fn help_menu_lists_links_then_separator_then_system_info_and_about() { let app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default()); let help: Vec = crate::menus::menu_items(&app).into_iter().filter(|i| i.path == ["Help"]).map(|i| i.id).collect(); - assert_eq!(help, ["help.discord", "help.website", "help.artcraftWebsite", "help.github", "help.reportIssue", "---", "help.systemInfo", "help.about"]); + assert_eq!( + help, + [ + "help.discord", + "help.website", + "help.artcraftWebsite", + "help.github", + "help.reportIssue", + "help.checkForUpdates", + "---", + "help.systemInfo", + "help.about" + ] + ); for (id, _) in COMMANDS { assert!(crate::menus::is_live(id) && crate::menus::is_enabled(&app, id), "{id}"); } diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 57b15fb8ad..2191d2ac0a 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -90,6 +90,9 @@ pub(crate) fn invoke_unguarded(app: &mut PhotocraftApp, ctx: &egui::Context, id: crate::tool_memory::select(app, tool); return Ok(json!({"tool": tool})); } + if id == "help.checkForUpdates" { + return crate::updates_ui::check(app, ctx, params); + } if id == "ui.symmetryTransform" { return crate::symmetry_ui::begin(app).map(|_| Value::Null); } @@ -1075,7 +1078,13 @@ pub fn menu_items(app: &PhotocraftApp) -> Vec { items.insert(after + 1 + k, it); } } - // Help: the link items, a separator, then System Info and About. + // Keep the update command with the links, ahead of System Info and About. + if let Some(at) = items.iter().position(|i| i.id == "help.checkForUpdates") { + let update = items.remove(at); + let before = items.iter().position(|i| i.id == "help.systemInfo" || i.id == "help.about").unwrap_or(items.len()); + items.insert(before, update); + } + // Help: the link items and update check, a separator, then System Info and About. if let Some(at) = items.iter().position(|i| i.id == "help.systemInfo" || i.id == "help.about") { items.insert( at, diff --git a/crates/ui-egui/src/prefs_ui.rs b/crates/ui-egui/src/prefs_ui.rs index 9123e499e2..be0545ac3f 100644 --- a/crates/ui-egui/src/prefs_ui.rs +++ b/crates/ui-egui/src/prefs_ui.rs @@ -1203,6 +1203,7 @@ fn humanize(key: &str) -> String { "exrAcesCg" => return "Open color-less EXR as ACEScg".into(), "darkTheme" => return "Dark Theme".into(), "lightTheme" => return "Light Theme".into(), + "automaticallyCheckUpdates" => return "Automatically Check for Updates".into(), _ => {} } // These controls appear only for WebP, so reuse the existing translated labels. diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 372bad8474..ee12e90eef 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -1510,6 +1510,9 @@ pub struct UiState { /// Non-blocking notices (import/export warnings, files that couldn't open), newest last. #[serde(default)] pub notices: Vec, + /// Non-modal release-check window; readable and controllable through `ui.inspect`/`ui.set`. + #[serde(default)] + pub updates_open: bool, /// Pending GPU fallback warning, visible to automation. #[serde(default)] pub gpu_fallback_notice: Option, @@ -1615,6 +1618,7 @@ impl Default for UiState { status: String::new(), status_error: false, notices: Vec::new(), + updates_open: false, gpu_fallback_notice: None, kys_offer: None, slow_refresh_noticed: Vec::new(), diff --git a/crates/ui-egui/src/updates_ui.rs b/crates/ui-egui/src/updates_ui.rs new file mode 100644 index 0000000000..bbbbc7bba9 --- /dev/null +++ b/crates/ui-egui/src/updates_ui.rs @@ -0,0 +1,233 @@ +//! One background check at startup and a non-modal window for release information. + +use photocraft_engine::updates_cmds::Status; +use serde_json::Value; + +use crate::PhotocraftApp; + +#[derive(Default)] +pub(crate) struct Runtime { + startup_checked: bool, + notified_version: Option, +} + +pub(crate) fn check(app: &mut PhotocraftApp, _ctx: &egui::Context, params: Value) -> Result { + let result = app.run("help.checkForUpdates", params)?; + app.ui.updates_open = true; + app.updates_rt.startup_checked = true; + Ok(result) +} + +pub(crate) fn tick(app: &mut PhotocraftApp, ctx: &egui::Context) { + // `updates.status` also polls (automation may consume the result before this frame). + app.session.updates.poll(); + if let Status::Available { release } = &app.session.updates.status + && app.updates_rt.notified_version.as_ref() != Some(&release.version) + { + app.updates_rt.notified_version = Some(release.version.clone()); + app.ui.updates_open = true; + } + if app.session.updates.check.is_none() { + return; + } + if !app.updates_rt.startup_checked { + app.updates_rt.startup_checked = true; + if app.session.prefs().general.automatically_check_updates && matches!(app.session.updates.status, Status::Idle) { + let _ = app.run("help.checkForUpdates", serde_json::json!({})); + } + } + if matches!(app.session.updates.status, Status::Checking) { + ctx.request_repaint_after(std::time::Duration::from_millis(100)); + } +} + +pub(crate) fn show(app: &mut PhotocraftApp, ctx: &egui::Context) { + if !app.ui.updates_open { + return; + } + let mut open = true; + let status = app.session.updates.status.clone(); + let mut retry = false; + let mut download = None; + egui::Window::new(tl!("PhotoCraft Updates")) + .id(egui::Id::new("photocraft_updates")) + .open(&mut open) + .collapsible(false) + .resizable(false) + .default_width(380.0) + .show(ctx, |ui| { + let t = crate::theme::Tokens::get(ctx); + ui.label(crate::i18n::fmt(crate::i18n::t("Installed version: {version}"), &[("version", photocraft_engine::build_info::VERSION)])); + ui.add_space(8.0); + match &status { + Status::Checking => { + ui.horizontal(|ui| { + ui.spinner(); + ui.label(tl!("Checking for updates…")); + }); + } + Status::Available { release } => { + ui.label(crate::i18n::fmt(crate::i18n::t("PhotoCraft {version} is available."), &[("version", &release.version)])); + ui.label(tl!("Open the release page to choose an installer for your system.")); + if crate::widgets::primary_button(ui, tl!("Open Download Page"), 160.0).clicked() { + download = Some(release.url.clone()); + } + } + Status::UpToDate => { + ui.label(tl!("PhotoCraft is up to date.")); + } + Status::Failed { message } => { + ui.colored_label(t.warning, tl!("Could not check for updates.")); + ui.label(message); + } + Status::Idle => { + ui.label(tl!("Updates have not been checked yet.")); + } + } + if !matches!(status, Status::Checking) && ui.button(tl!("Check Again")).clicked() { + retry = true; + } + }); + app.ui.updates_open = open; + if let Some(url) = download { + crate::links::open(app, ctx, &url); + } + if retry { + let _ = check(app, ctx, serde_json::json!({})); + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{Services, menus}; + use photocraft_engine::{Session, updates_cmds::Release}; + use std::sync::{Arc, Mutex, mpsc}; + + type Sender = Arc>>>; + + fn app() -> (PhotocraftApp, Arc>, Sender) { + let calls = Arc::new(Mutex::new(0)); + let count = calls.clone(); + let sender = Arc::new(Mutex::new(None)); + let tx = sender.clone(); + let app = PhotocraftApp::new( + Session::new(), + Services { + check_updates: Some(Box::new(move || { + *count.lock().unwrap() += 1; + let (sender, receiver) = mpsc::channel(); + *tx.lock().unwrap() = Some(sender); + Ok(receiver) + })), + ..Default::default() + }, + ); + (app, calls, sender) + } + + fn at(app: &mut PhotocraftApp, ctx: &egui::Context, time: f64) { + let mut output = ctx.run_ui(egui::RawInput { time: Some(time), ..Default::default() }, |ui| tick(app, ui.ctx())); + output.textures_delta.clear(); + } + + #[test] + fn automatic_check_runs_once_per_launch_even_after_days_or_preference_changes() { + let (mut app, calls, sender) = app(); + let ctx = egui::Context::default(); + at(&mut app, &ctx, 0.0); + at(&mut app, &ctx, 1.0); + at(&mut app, &ctx, 2.0); + assert_eq!(*calls.lock().unwrap(), 1); + sender.lock().unwrap().as_ref().unwrap().send(Ok(None)).unwrap(); + at(&mut app, &ctx, 3.0); + assert!(!app.ui.updates_open, "automatic up-to-date checks stay quiet"); + at(&mut app, &ctx, 86400.0); + app.session.edit_prefs(|p| p.general.automatically_check_updates = false); + at(&mut app, &ctx, 86401.0); + app.session.edit_prefs(|p| p.general.automatically_check_updates = true); + at(&mut app, &ctx, 172800.0); + assert_eq!(*calls.lock().unwrap(), 1, "no periodic checks or preference-triggered rechecks"); + let (mut restarted, restarted_calls, _) = self::app(); + at(&mut restarted, &ctx, 0.0); + assert_eq!(*restarted_calls.lock().unwrap(), 1, "the next launch checks again"); + } + + #[test] + fn startup_opt_out_and_failed_checks_do_not_retry_automatically() { + let (mut disabled, calls, _) = app(); + let ctx = egui::Context::default(); + disabled.session.edit_prefs(|p| p.general.automatically_check_updates = false); + at(&mut disabled, &ctx, 0.0); + disabled.session.edit_prefs(|p| p.general.automatically_check_updates = true); + at(&mut disabled, &ctx, 86400.0); + assert_eq!(*calls.lock().unwrap(), 0, "opt-out is evaluated at startup"); + + let (mut failed, calls, sender) = app(); + at(&mut failed, &ctx, 0.0); + sender.lock().unwrap().as_ref().unwrap().send(Err("offline".into())).unwrap(); + at(&mut failed, &ctx, 1.0); + at(&mut failed, &ctx, 172800.0); + assert_eq!(*calls.lock().unwrap(), 1); + assert!(!failed.ui.updates_open, "an automatic failure stays quiet"); + } + + #[test] + fn manual_check_works_when_automatic_checks_are_off_and_opens_status() { + let (mut app, calls, sender) = app(); + let ctx = egui::Context::default(); + app.session.edit_prefs(|p| p.general.automatically_check_updates = false); + assert!(menus::is_enabled(&app, "help.checkForUpdates")); + menus::invoke(&mut app, &ctx, "help.checkForUpdates", serde_json::json!({})).unwrap(); + assert!(app.ui.updates_open); + assert_eq!(*calls.lock().unwrap(), 1); + sender.lock().unwrap().as_ref().unwrap().send(Err("offline".into())).unwrap(); + at(&mut app, &ctx, 1.0); + assert!(matches!(app.session.updates.status, Status::Failed { .. })); + let mut web = PhotocraftApp::new(Session::new(), Services::default()); + assert!(!menus::is_enabled(&web, "help.checkForUpdates")); + at(&mut web, &ctx, 2.0); + assert_eq!(web.session.updates.status, Status::Idle); + } + + #[test] + fn available_release_notifies_once_even_when_automation_polls_first() { + let (mut app, _, sender) = app(); + let ctx = egui::Context::default(); + at(&mut app, &ctx, 0.0); + sender + .lock() + .unwrap() + .as_ref() + .unwrap() + .send(Ok(Some(Release { version: "99.0.0".into(), url: "https://github.com/storytold/photocraft/releases/tag/v99.0.0".into() }))) + .unwrap(); + app.run("updates.status", serde_json::json!({})).unwrap(); + at(&mut app, &ctx, 1.0); + assert!(app.ui.updates_open); + app.ui.updates_open = false; + at(&mut app, &ctx, 2.0); + assert!(!app.ui.updates_open); + } + + #[test] + fn update_window_is_drivable_and_bad_state_changes_are_atomic() { + let (mut app, _, _) = app(); + let ctx = egui::Context::default(); + let call = |app: &mut PhotocraftApp, method: &str, params: Value| { + let (req, _) = crate::control::ControlRequest::new(method, params); + match crate::control::handle(app, &ctx, &req) { + crate::control::Outcome::Done(value) => value, + _ => panic!("expected an immediate reply"), + } + }; + assert_eq!(call(&mut app, "ui.set", serde_json::json!({"updatesOpen": true}))["ok"], true); + let inspected = call(&mut app, "ui.inspect", serde_json::json!({})); + assert_eq!(inspected["result"]["updatesOpen"], true); + assert_eq!(inspected["result"]["updates"]["supported"], true); + assert_eq!(call(&mut app, "ui.set", serde_json::json!({"updatesOpen": false, "maskTarget": "bad"}))["ok"], false); + assert!(app.ui.updates_open); + assert_eq!(call(&mut app, "ui.set", serde_json::json!({"updatesOpen": false}))["ok"], true); + assert!(!app.ui.updates_open); + } +} diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 9e60af2136..4cf03946c0 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -283,6 +283,19 @@ toolbox colour as `backgroundColor: [r,g,b]` (0..1), so reusing it does not foll changes. Up to 256 presets are kept. Invalid saved entries are skipped independently; other presets and preferences still load. Automatic Recent configurations are separate follow-up work. +## Update checks + +On desktop, `engine.execute` with `help.checkForUpdates` and `{}` starts a background +check; `updates.status` returns `{supported, currentVersion, result}`. The result's `status` +is `idle`, `checking`, `upToDate`, `available` (with `release: {version, url}`), or `failed` +(with `message`). No document is required and neither command adds history or journal entries. +Headless and web sessions without a release transport report `supported: false`. + +Set `general.automaticallyCheckUpdates` with `prefs.set` to enable or disable the next +desktop startup's single check (enabled by default). Manual checks still work when automatic checks are off. +`ui.inspect` includes `updates` and `updatesOpen`; `ui.set {"updatesOpen": false}` closes +the non-modal update window. + ## Snapping With View › Snap on, tool gestures snap to the View › Snap To targets (guides and grid while they diff --git a/docs/gaps.md b/docs/gaps.md index 2111315257..306f0ee096 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Where PhotoCraft falls short of Photoshop -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-22 · **Change:** minor (G10: `.asl` style libraries landed, #1051; G8: area type (TYPE-218-10); G1: smart objects keep Photoshop's Cylinder warp, #4112; G8: paragraph direction buttons in the Paragraph panel and options bar, TYPE-218-2 partial; G1: 32-bit Hue/Saturation and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; G11: compound layer properties export as separate Photoshop Set events, rename last, #8304; G11: Batch and droplets take the result at the action's Save step, so actions ending in Save As and Close work; G11: `.atn` steps that switch to another open document import, play and save back, #7103; G14: the Nikon D4 white level follows the sample depth, so 12-bit D4 NEFs no longer open 2.6 stops dark, #5978; G14: a Nikon NEF's Adobe RGB preview is read as Adobe RGB (maker-note ColorSpace 0x001E), #5987; Apply Layer Comp action mapping, #7101; G10: JPEG Options dialog landed, FILE-215-19 partial (no Matte, progressive Scans or size preview); G10: Cineon write; G10: DPX read and write, #1049, Cineon and Amiga IFF read; Classical Object Finder improvement; learned segmentation remains open; G4: named, stateful section locks and visible keyboard focus in Brush Settings; G4: independent Brush Pose tilt-axis overrides, #3825 partial; G4: Transfer Mixer-only controls, #3825 partial; G9: Preferences › File Handling › Save in Background takes effect, #6207, 24 of 169 preferences do nothing; G7: Content-Aware Move previews every selection the command takes, coarse then exact, TOOL-213-4 done, #6680; G4: Pattern Stamp and Background Eraser draw live, TOOL-213-7; G9: Animated Zoom pref read: holding the Zoom tool zooms continuously, #6210, prefs that do nothing 25 of 166; G2: a cancelled 24 MP Gaussian Blur job stops in at most 44 ms, P25 under its 200 ms budget in local runs, baseline not re-run, #6205; G1: generated large-file fixtures, a 4.38 GB PSB opens on Windows through io, FILE-216-2 done, #5107; G9: fill and adjustment layers copy and paste whole, #2344; G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-22 · **Change:** minor (G17: Help › Check for Updates and an opt-out check once per launch, DIST-220-1 partial, #5485; G10: `.asl` style libraries landed, #1051; G8: area type (TYPE-218-10); G1: smart objects keep Photoshop's Cylinder warp, #4112; G8: paragraph direction buttons in the Paragraph panel and options bar, TYPE-218-2 partial; G1: 32-bit Hue/Saturation and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; G11: compound layer properties export as separate Photoshop Set events, rename last, #8304; G11: Batch and droplets take the result at the action's Save step, so actions ending in Save As and Close work; G11: `.atn` steps that switch to another open document import, play and save back, #7103; G14: the Nikon D4 white level follows the sample depth, so 12-bit D4 NEFs no longer open 2.6 stops dark, #5978; G14: a Nikon NEF's Adobe RGB preview is read as Adobe RGB (maker-note ColorSpace 0x001E), #5987; Apply Layer Comp action mapping, #7101; G10: JPEG Options dialog landed, FILE-215-19 partial (no Matte, progressive Scans or size preview); G10: Cineon write; G10: DPX read and write, #1049, Cineon and Amiga IFF read; Classical Object Finder improvement; learned segmentation remains open; G4: named, stateful section locks and visible keyboard focus in Brush Settings; G4: independent Brush Pose tilt-axis overrides, #3825 partial; G4: Transfer Mixer-only controls, #3825 partial; G9: Preferences › File Handling › Save in Background takes effect, #6207, 24 of 169 preferences do nothing; G7: Content-Aware Move previews every selection the command takes, coarse then exact, TOOL-213-4 done, #6680; G4: Pattern Stamp and Background Eraser draw live, TOOL-213-7; G9: Animated Zoom pref read: holding the Zoom tool zooms continuously, #6210, prefs that do nothing 25 of 166; G2: a cancelled 24 MP Gaussian Blur job stops in at most 44 ms, P25 under its 200 ms budget in local runs, baseline not re-run, #6205; G1: generated large-file fixtures, a 4.38 GB PSB opens on Windows through io, FILE-216-2 done, #5107; G9: fill and adjustment layers copy and paste whole, #2344; G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026 Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impact on the way to beta. This is the work list agents pick from: take the highest-ranked entry that @@ -339,8 +339,9 @@ what an agent can't finish alone. ## Platform gaps ### G17. Platforms and distribution -- **Missing:** Windows code signing (material not obtained), in-app update check (DIST-220-1, - #2650, #2375), in-app bug report (DIST-220-3), Flathub (#173), +- **Missing:** Windows code signing (material not obtained), a periodic recheck for the in-app + update check (DIST-220-1 partial: Help › Check for Updates and an opt-out check once per + launch, #5485), in-app bug report (DIST-220-3), Flathub (#173), starting without a GPU adapter (#2519, #2412), Windows 7 (#2310, out of scope), Intel Macs with OpenCore (#1859). - **Estimate:** 30–60 h. **Human:** signing certificates. @@ -349,6 +350,7 @@ what an agent can't finish alone. | Date | Change | Summary | |---|---|---| +| 2026-10-22 | minor | G17: Help › Check for Updates and an opt-out check once per launch (#5485), DIST-220-1 partial; estimate unchanged | | 2026-10-22 | minor | G1: 32-bit Hue/Saturation unclipped with Photoshop's saturation factor, bright colours keep their hue, Colorize's saturation scaled by 1 − \|Lightness\|; photoshop rgb32 hue-saturation and hue-saturation-colorize pass; Photoshop-oracle floor 188 → 190 of 258 (#5781) | | 2026-10-21 | minor | #8304: compound layer properties export as separate Set events, rename last; independent Photoshop replay pending; percentages and estimates unchanged | | 2026-10-21 | minor | G11: Batch and droplets take the result at the action's recorded Save / Save As step (Photoshop's "Override Action 'Save As' Commands"); estimate unchanged | diff --git a/docs/releasing.md b/docs/releasing.md index def1911aa8..69a449f611 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -9,6 +9,23 @@ This is PhotoCraft's implementation of the shared [release playbook](release-playbook.md). User-facing names say **PhotoCraft**. Files, binaries and ids stay lowercase (`photocraft---.`, `ai.storyteller.photocraft`). +## In-app update checks + +The native desktop app checks the public GitHub latest-release endpoint in a background +thread once at launch, with no periodic checks or automatic retries. Preferences › General › Automatically +Check for Updates disables the startup check; Help › Check for Updates runs one manually. +Checks use a 15-second timeout and a 1 MiB response limit, need no GitHub token, and send +no document or personal data. Network failures are quiet during automatic checks and visible +in the manual check window. Concurrent requests share one check. +HTTPS validates certificates and host names against the operating system's trust store. + +Tags must be semantic versions (`v0.8.0` or `0.8.0`); only published stable versions newer +than the installed workspace version trigger a notice. The notice opens the official release +page to choose an installer; installation remains a user action. Drafts and prereleases do +not trigger it. Web/headless frontends and the Flatpak (no network in its sandbox; `flatpak update` +owns updates there) have no update transport. No release-workflow changes +are required: publishing a newer stable GitHub Release makes it discoverable. + ## Cutting a release 1. **Bump the version** on `main`. The only place it lives is `[workspace.package] version` diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 1a4c5b4468..bb850a770d 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # PhotoCraft vs Adobe Photoshop: target-app parity -> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-21 · **Change:** minor (area type, TYPE-218-10 partial, Type scorecard 5 / 5 / 0; compound layer properties export as separate Photoshop Set events, #8304; JPEG Options dialog landed, FILE-215-19 partial; Print › Functions › Bleed through `file.print`; Content-Aware Move live preview for every selection size, TOOL-213-4 done, #6680; retouching evidence: Pattern Stamp and Background Eraser draw live, only the Mixer Brush is left of TOOL-213-7; fill and adjustment layers copy and paste whole, UI-217-23 partial, #2344; shape layers take Density and Feather, TOOL-214-12 done, #5846; on-canvas corner radius widgets, TOOL-214-12; `.atn` import maps 112 events; Free Transform H/V skew fields; stale rows corrected against `main` and the scorecard, estimates unchanged; Photoshop Actions `.atn` load and save; 2026-10-10: Tilt-Shift measurements added; earlier the same day: major, full re-measure against Photoshop 2026 27.11.0; merged `parity-estimate.md` and the roadmap's honest assessment; stale missing-tool rows corrected: Color Replacement and Red Eye are live toolbar tools, Frame landed; percentages unchanged) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-22 · **Change:** minor (Help › Check for Updates and an opt-out check once per launch, DIST-220-1 partial, #5485; area type, TYPE-218-10 partial, Type scorecard 5 / 5 / 0; compound layer properties export as separate Photoshop Set events, #8304; JPEG Options dialog landed, FILE-215-19 partial; Print › Functions › Bleed through `file.print`; Content-Aware Move live preview for every selection size, TOOL-213-4 done, #6680; retouching evidence: Pattern Stamp and Background Eraser draw live, only the Mixer Brush is left of TOOL-213-7; fill and adjustment layers copy and paste whole, UI-217-23 partial, #2344; shape layers take Density and Feather, TOOL-214-12 done, #5846; on-canvas corner radius widgets, TOOL-214-12; `.atn` import maps 112 events; Free Transform H/V skew fields; stale rows corrected against `main` and the scorecard, estimates unchanged; Photoshop Actions `.atn` load and save; 2026-10-10: Tilt-Shift measurements added; earlier the same day: major, full re-measure against Photoshop 2026 27.11.0; merged `parity-estimate.md` and the roadmap's honest assessment; stale missing-tool rows corrected: Color Replacement and Red Eye are live toolbar tools, Frame landed; percentages unchanged) · **Target:** Adobe Photoshop 2026 The authoritative answer to "how close is PhotoCraft to Photoshop, and how much work is left". The one-page summary is [`ROADMAP.md`](../ROADMAP.md); the ranked work list is [`gaps.md`](gaps.md); @@ -82,7 +82,7 @@ Weights reflect what a working Photoshop user depends on (photographers, retouch | Stability | 10% | 45% | 150–250 | Never-crash lints on 28/28 crates, `panic_hunt` in the gate, atomic saves; but field reports of freezes (#2518 Type tool 60 s on macOS), GPU panics (#2020, #1215), no-GPU start failures (#2519, #2412) | [gaps.md](gaps.md) | | Hardware | 5% | 50% | 80–150 | GPU compositor (wgpu), pen pressure on all desktops but tilt/rotation not on Windows, Wayland pen broken (#2622), no HDR/EDR output, monitor profile auto-detected on macOS only | [hardware-parity.md](hardware-parity.md) | | Localization | 5% | 55% | 80–140 | 7 of the 12 key languages at 100% of measured UI keys; Hindi and Arabic absent, Vietnamese catalog added 2026-10-12 (#2636, coverage not re-measured); no RTL UI; engine messages English | [localization-parity.md](localization-parity.md) | -| Platforms | 5% | 80% | 30–60 | macOS (notarized), Windows (unsigned), Linux (AppImage/deb/rpm/Flatpak), web, FreeBSD partial; Windows ARM64 is packaged and install-checked by `.github/workflows/windows-arm64.yml` (DIST-220-2); no in-app updates | [scorecard.md](scorecard.md#distribution) | +| Platforms | 5% | 80% | 30–60 | macOS (notarized), Windows (unsigned), Linux (AppImage/deb/rpm/Flatpak), web, FreeBSD partial; Windows ARM64 is packaged and install-checked by `.github/workflows/windows-arm64.yml` (DIST-220-2); Help › Check for Updates plus an opt-out check once per launch (DIST-220-1 partial, no periodic recheck) | [scorecard.md](scorecard.md#distribution) | | Ecosystem (plug-ins, scripting, presets, libraries) | 5% | 15% | 250–450 | No .8BF hosting (#2647), no UXP/ExtendScript; .atn load/save (2026-10-12, 112 events, the rest kept verbatim), .abr/.grd/.pat/.aco/.ase/.cube supported | [gaps.md](gaps.md) | | AI features | 5% | 10% | 300–600 | No ML runtime at all (scorecard AUTO-219-7); classical substitutes only. Needs an owner decision and openly licensed models (#41) | [gaps.md](gaps.md) | | **Weighted** | 100% | **~46%** | **2,340–4,100** | | | @@ -565,6 +565,7 @@ See [method, raw measurements and reproduction](five-algorithm-performance.md). | Date | Change | Summary | |---|---|---| +| 2026-10-22 | minor | Platforms: Help › Check for Updates and an opt-out check once per launch (#5485), DIST-220-1 partial; percentages unchanged | | 2026-10-21 | minor | #8304: compound layer properties export as separate Set events, rename last; independent Photoshop replay pending; percentages and estimates unchanged | | 2026-10-19 | minor | JPEG Options dialog landed (FILE-215-19 partial: no Matte, progressive Scans or size preview); percentages unchanged | | 2026-10-18 | minor | Layers: with no selection, Copy takes fill and adjustment layers whole and Paste recreates them (#2344); UI-217-23 stays partial; percentages unchanged | diff --git a/scorecard/distribution.toml b/scorecard/distribution.toml index 1a65920852..a2a0b9da4e 100644 --- a/scorecard/distribution.toml +++ b/scorecard/distribution.toml @@ -43,9 +43,9 @@ note = "release.yml:242-283 (freebsd job) + packaging/freebsd/package.sh; layout [[item]] id = "DIST-220-1" target = "Help > Check for Updates plus an opt-out periodic release-feed check on all desktops" -status = "missing" +status = "partial" issue = 220 -note = "No update check in crates" +note = "2026-10-22 (#5485): Help > Check for Updates and an opt-out check once per launch (updates_cmds + the desktop HTTPS transport; none inside Flatpak, where flatpak update owns updates). Missing: a periodic recheck while the app stays open" [[item]] id = "DIST-220-2"