Add Help > Check for Updates and bump to 0.2.1 (M8) (#165)

* feat(updates): add manual release checks and verified native updates (M8)

* chore: bump version to 0.2.1 (M8)

* fix(flatpak): honor the launcher version choices (M8)

* fix(updates): preserve pending edits and report restart outcomes (M8)

* test(updates): verify startup consumes helper failures once (M8)
This commit is contained in:
Dylan M. Taylor authored and GitHub committed 2026-11-11 19:32:21 -05:00
1 parent 1e92b09dc5
commit 1bddc73503
11 files changed
+1134 -24

No files matched your search

Generated
+563 -18
View File
@@ -216,7 +216,7 @@ dependencies = [
[[package]]
name = "anicraft"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-audio",
"anicraft-doc",
@@ -225,6 +225,7 @@ dependencies = [
"anicraft-gpu",
"anicraft-render",
"cpal",
"craft-update",
"eframe",
"egui",
"fontdb",
@@ -242,7 +243,7 @@ dependencies = [
[[package]]
name = "anicraft-actions"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"serde",
"serde_json",
@@ -250,7 +251,7 @@ dependencies = [
[[package]]
name = "anicraft-audio"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"lewton",
"nanomp3",
@@ -258,7 +259,7 @@ dependencies = [
[[package]]
name = "anicraft-cli"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-doc",
"anicraft-engine",
@@ -269,7 +270,7 @@ dependencies = [
[[package]]
name = "anicraft-doc"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-actions",
"anicraft-audio",
@@ -282,7 +283,7 @@ dependencies = [
[[package]]
name = "anicraft-engine"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-doc",
"anicraft-geom",
@@ -306,7 +307,7 @@ dependencies = [
[[package]]
name = "anicraft-geom"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"serde",
"serde_json",
@@ -314,7 +315,7 @@ dependencies = [
[[package]]
name = "anicraft-gpu"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-doc",
"anicraft-geom",
@@ -330,7 +331,7 @@ dependencies = [
[[package]]
name = "anicraft-plugins"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"serde",
"serde_json",
@@ -341,7 +342,7 @@ dependencies = [
[[package]]
name = "anicraft-render"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-doc",
"anicraft-geom",
@@ -354,7 +355,7 @@ dependencies = [
[[package]]
name = "anicraft-svg"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-doc",
"anicraft-geom",
@@ -365,7 +366,7 @@ dependencies = [
[[package]]
name = "anicraft-text"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-geom",
"fontdb",
@@ -375,7 +376,7 @@ dependencies = [
[[package]]
name = "anicraft-xfl"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"anicraft-doc",
"anicraft-geom",
@@ -388,7 +389,7 @@ dependencies = [
[[package]]
name = "anicraft-xml"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"thiserror 2.0.21",
]
@@ -614,6 +615,12 @@ version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "base64"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
[[package]]
name = "bit-set"
version = "0.10.0"
@@ -641,6 +648,15 @@ version = "2.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
[[package]]
name = "block-buffer"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"generic-array",
]
[[package]]
name = "block2"
version = "0.5.1"
@@ -944,6 +960,15 @@ dependencies = [
"libc",
]
[[package]]
name = "chrono"
version = "0.4.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
dependencies = [
"num-traits",
]
[[package]]
name = "clipboard-win"
version = "5.4.3"
@@ -998,6 +1023,15 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "constant_time_eq"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9eb6feb175df65d0a3ccd3e73484e940d0ac664e8034f0519fd49a93db3071d9"
dependencies = [
"rustversion",
]
[[package]]
name = "core-foundation"
version = "0.9.4"
@@ -1008,6 +1042,16 @@ dependencies = [
"libc",
]
[[package]]
name = "core-foundation"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
@@ -1021,7 +1065,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
"core-foundation 0.9.4",
"core-graphics-types",
"foreign-types",
"libc",
@@ -1034,7 +1078,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
dependencies = [
"bitflags 1.3.2",
"core-foundation",
"core-foundation 0.9.4",
"libc",
]
@@ -1097,6 +1141,40 @@ dependencies = [
"windows-core",
]
[[package]]
name = "cpufeatures"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
dependencies = [
"libc",
]
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=6ac2a6a34ae83fc0f0bfb25a569ba6388b72266a#6ac2a6a34ae83fc0f0bfb25a569ba6388b72266a"
dependencies = [
"chrono",
"dunce",
"flate2",
"getrandom 0.3.4",
"log",
"plist",
"rustix 1.1.5",
"semver",
"serde",
"serde_json",
"sha2",
"tar",
"tempfile",
"ureq",
"verifysign",
"winreg",
"winsafe",
"zip",
]
[[package]]
name = "crc32fast"
version = "1.5.3"
@@ -1137,6 +1215,16 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-common"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "cursor-icon"
version = "1.2.0"
@@ -1169,6 +1257,16 @@ version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e"
[[package]]
name = "digest"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"crypto-common",
]
[[package]]
name = "dispatch"
version = "0.2.0"
@@ -1228,6 +1326,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
[[package]]
name = "dunce"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
[[package]]
name = "dynify"
version = "0.1.2"
@@ -1352,6 +1456,7 @@ dependencies = [
"raw-window-handle",
"smithay-clipboard",
"web-time",
"webbrowser",
"winit",
]
@@ -1546,6 +1651,16 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693"
[[package]]
name = "filetime"
version = "0.2.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"
dependencies = [
"cfg-if",
"libc",
]
[[package]]
name = "find-msvc-tools"
version = "0.1.15"
@@ -1630,6 +1745,15 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
[[package]]
name = "form_urlencoded"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
dependencies = [
"percent-encoding",
]
[[package]]
name = "futures-channel"
version = "0.3.34"
@@ -1707,6 +1831,16 @@ dependencies = [
"slab",
]
[[package]]
name = "generic-array"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
]
[[package]]
name = "gethostname"
version = "1.1.0"
@@ -1717,6 +1851,17 @@ dependencies = [
"windows-link",
]
[[package]]
name = "getrandom"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "getrandom"
version = "0.3.4"
@@ -1736,8 +1881,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"r-efi 6.0.0",
"wasm-bindgen",
]
[[package]]
@@ -1949,6 +2096,22 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "http"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
dependencies = [
"bytes",
"itoa",
]
[[package]]
name = "httparse"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
[[package]]
name = "icu_collections"
version = "2.0.0"
@@ -2038,6 +2201,27 @@ dependencies = [
"zerovec",
]
[[package]]
name = "idna"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
dependencies = [
"idna_adapter",
"smallvec",
"utf8_iter",
]
[[package]]
name = "idna_adapter"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
dependencies = [
"icu_normalizer",
"icu_properties",
]
[[package]]
name = "image"
version = "0.25.10"
@@ -2452,6 +2636,18 @@ dependencies = [
"jni-sys 0.3.1",
]
[[package]]
name = "nix"
version = "0.31.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
dependencies = [
"bitflags 2.13.2",
"cfg-if",
"cfg_aliases",
"libc",
]
[[package]]
name = "nohash-hasher"
version = "0.2.0"
@@ -2929,6 +3125,12 @@ version = "11.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
[[package]]
name = "openssl-probe"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1"
[[package]]
name = "orbclient"
version = "0.3.55"
@@ -3104,6 +3306,19 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
[[package]]
name = "plist"
version = "1.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285"
dependencies = [
"base64",
"indexmap",
"quick-xml 0.42.0",
"serde",
"time",
]
[[package]]
name = "png"
version = "0.17.16"
@@ -3255,6 +3470,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "quick-xml"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
version = "1.0.47"
@@ -3459,6 +3683,20 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "ring"
version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if",
"getrandom 0.2.17",
"libc",
"untrusted",
"windows-sys 0.52.0",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
@@ -3506,6 +3744,80 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "rustls"
version = "0.23.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
dependencies = [
"log",
"once_cell",
"ring",
"rustls-pki-types",
"rustls-webpki",
"subtle",
"zeroize",
]
[[package]]
name = "rustls-native-certs"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4"
dependencies = [
"openssl-probe",
"rustls-pki-types",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pki-types"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb"
dependencies = [
"zeroize",
]
[[package]]
name = "rustls-platform-verifier"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98"
dependencies = [
"core-foundation 0.10.1",
"core-foundation-sys",
"jni",
"log",
"once_cell",
"rustls",
"rustls-native-certs",
"rustls-platform-verifier-android",
"rustls-webpki",
"security-framework",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.52.0",
]
[[package]]
name = "rustls-platform-verifier-android"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f"
[[package]]
name = "rustls-webpki"
version = "0.103.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
dependencies = [
"ring",
"rustls-pki-types",
"untrusted",
]
[[package]]
name = "rustversion"
version = "1.0.23"
@@ -3527,6 +3839,15 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "schannel"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5"
dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
@@ -3539,6 +3860,29 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "security-framework"
version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [
"bitflags 2.13.2",
"core-foundation 0.10.1",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "self_cell"
version = "1.3.0"
@@ -3550,6 +3894,10 @@ name = "semver"
version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
dependencies = [
"serde",
"serde_core",
]
[[package]]
name = "serde"
@@ -3614,6 +3962,17 @@ dependencies = [
"serde_core",
]
[[package]]
name = "sha2"
version = "0.10.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
]
[[package]]
name = "shlex"
version = "2.0.1"
@@ -3807,6 +4166,12 @@ dependencies = [
"serde",
]
[[package]]
name = "subtle"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "2.0.119"
@@ -3875,6 +4240,16 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "tar"
version = "0.4.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
dependencies = [
"filetime",
"libc",
]
[[package]]
name = "tempfile"
version = "3.27.0"
@@ -4116,6 +4491,18 @@ dependencies = [
"rustc-hash 2.1.3",
]
[[package]]
name = "typed-path"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e"
[[package]]
name = "typenum"
version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
[[package]]
name = "uds_windows"
version = "1.2.1"
@@ -4151,6 +4538,53 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "ureq"
version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7be76686bdf7198002062423ca0d8cf9b75a27c8e1de804513b97e97b555d9d"
dependencies = [
"base64",
"flate2",
"log",
"percent-encoding",
"rustls",
"rustls-pki-types",
"rustls-platform-verifier",
"ureq-proto",
"utf8-zero",
]
[[package]]
name = "ureq-proto"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622dce33c252115466d83f63e9744a18f12b4406aae51a01c15ad8fcf1185eb3"
dependencies = [
"base64",
"http",
"httparse",
"log",
]
[[package]]
name = "url"
version = "2.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
]
[[package]]
name = "utf16_iter"
version = "1.1.0"
@@ -4160,6 +4594,21 @@ dependencies = [
"utf_types",
]
[[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.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0"
dependencies = [
"utf_types",
]
[[package]]
name = "utf_types"
version = "1.0.0"
@@ -4204,6 +4653,16 @@ dependencies = [
"vello_common",
]
[[package]]
name = "verifysign"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6efd25aadc22c756a9012267fae0b130278d335d6ceb512ec02ce82029b5ca9"
dependencies = [
"core-foundation 0.10.1",
"windows-sys 0.61.2",
]
[[package]]
name = "version_check"
version = "0.9.5"
@@ -4220,6 +4679,12 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "wasip2"
version = "1.0.4+wasi-0.2.12"
@@ -4536,7 +5001,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0"
dependencies = [
"proc-macro2",
"quick-xml",
"quick-xml 0.41.0",
"quote",
]
@@ -4572,6 +5037,31 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "webbrowser"
version = "1.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73e91ccd4698f2647d6137e8eb17a3f1dcfd63810be9029fb2398f507279b95b"
dependencies = [
"jni",
"log",
"ndk-context",
"objc2 0.6.5",
"objc2-app-kit 0.3.2",
"objc2-foundation 0.3.2",
"url",
"web-sys",
]
[[package]]
name = "webpki-root-certs"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "293198dcebfb821155b5092ab94b5a82ff180eddd7241df3bd6e66a4ffd1a585"
dependencies = [
"rustls-pki-types",
]
[[package]]
name = "weezl"
version = "0.1.12"
@@ -4986,7 +5476,7 @@ dependencies = [
"calloop 0.13.0",
"cfg_aliases",
"concurrent-queue",
"core-foundation",
"core-foundation 0.9.4",
"core-graphics",
"cursor-icon",
"dpi",
@@ -5031,6 +5521,16 @@ dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97"
dependencies = [
"cfg-if",
"windows-sys 0.59.0",
]
[[package]]
name = "winresource"
version = "0.1.34"
@@ -5041,6 +5541,12 @@ dependencies = [
"version_check",
]
[[package]]
name = "winsafe"
version = "0.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ef0ffc427f045c0cc9ebffd6f4f91153dcd2a1547b5c3c29ee3f541e16e95c6"
[[package]]
name = "wit-bindgen"
version = "0.57.1"
@@ -5292,6 +5798,26 @@ dependencies = [
"synstructure 0.14.0",
]
[[package]]
name = "zeroize"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "zerotrie"
version = "0.2.5"
@@ -5327,6 +5853,25 @@ dependencies = [
"syn 3.0.9",
]
[[package]]
name = "zip"
version = "9.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3476fd497ac8af5b1ec7b51acab7bef380f7e8dd8e0487595bafd839417a302"
dependencies = [
"constant_time_eq",
"crc32fast",
"flate2",
"getrandom 0.4.3",
"indexmap",
"libc",
"memchr",
"nix",
"typed-path",
"windows-sys 0.61.2",
"zeroize",
]
[[package]]
name = "zlib-rs"
version = "0.6.8"
+4 -2
View File
@@ -6,7 +6,7 @@ default-members = [".", "crates/*"]
[workspace.package]
# 0.1.0 is the early alpha (release stage in src/app.rs, RELEASE_STAGE); see CHANGELOG.md
# and docs/release.md.
version = "0.2.0"
version = "0.2.1"
edition = "2024"
license = "MIT OR Apache-2.0"
# An application, not a library: not published to crates.io.
@@ -107,7 +107,9 @@ web-time.workspace = true
sys-locale = "0.3"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
eframe.workspace = true
craft-update = { git = "https://github.com/storytold/craft-libs", rev = "6ac2a6a34ae83fc0f0bfb25a569ba6388b72266a" }
eframe = { workspace = true, features = ["links"] }
rfd.workspace = true
# Sound output (Apache-2.0): WASAPI on Windows, CoreAudio on macOS, ALSA on Linux and the BSDs.
cpal = { version = "0.18", optional = true }
+8
View File
@@ -29,6 +29,12 @@ confidence-threshold = 0.93
crate = "epaint_default_fonts"
allow = ["OFL-1.1", "Ubuntu-font-1.0"]
# Approved for the Mozilla certificate data pulled in by the shared HTTPS updater.
# The exception applies to this data crate and version, not application code.
[[licenses.exceptions]]
crate = "webpki-root-certs@=1.0.12"
allow = ["CDLA-Permissive-2.0"]
[licenses.private]
# Our own workspace crates are MIT OR Apache-2.0 (checked by `cargo deny` like any other crate).
ignore = false
@@ -42,6 +48,8 @@ allow-wildcard-paths = true
[sources]
unknown-registry = "deny"
unknown-git = "deny"
# Shared updater implementation, pinned to a reviewed commit in Cargo.toml.
allow-git = ["https://github.com/storytold/craft-libs"]
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
[advisories]
+7 -2
View File
@@ -21,8 +21,13 @@ AniCraft is **MIT OR Apache-2.0**, the same as its sibling PhotoCraft (`LICENSE-
Allowed: MIT, Apache-2.0 (incl. LLVM exception), BSD-2/3-Clause, ISC, Zlib, 0BSD, BSL-1.0,
Unicode-3.0, Unlicense. Font licences (OFL-1.1, Ubuntu-font-1.0) are allowed **only** for
`epaint_default_fonts`. Copyleft (GPL, LGPL, AGPL, MPL, EPL, CDDL, SSPL), "non-commercial",
"source-available" and unknown licences are **not allowed**. Only crates.io sources are allowed
(no unknown registries or git).
"source-available" and unknown licences are **not allowed**. Crates.io and the explicitly allowlisted Storytold shared library repository are allowed;
unknown registries and git sources remain denied. The native update checker uses `craft-update`
(MIT OR Apache-2.0), pinned to a commit of `storytold/craft-libs`; its HTTP, verification and
platform installer code are shared with the other Craft apps. A narrowly approved exception
accepts `webpki-root-certs` 1.0.12 under CDLA-Permissive-2.0 for Mozilla certificate data pulled
in by the HTTPS verifier. It applies only to that data crate and version; the code licence
allowlist is unchanged.
```sh
cargo deny check licenses bans sources # policy in deny.toml; must pass before every commit
@@ -17,6 +17,12 @@ runtime-version: '26.08'
sdk: org.freedesktop.Sdk
command: anicraft
finish-args:
# Honor the launcher's pinned and nightly version choices before offering updates.
- --filesystem=xdg-data/ArtCraft/versions:ro
# Release checks and downloads use HTTPS.
- --share=network
# Verified update helpers run through flatpak-spawn --host.
- --talk-name=org.freedesktop.Flatpak
# Display: Wayland first; X11 only when no Wayland compositor is running.
- --socket=wayland
- --socket=fallback-x11
@@ -33,7 +39,6 @@ finish-args:
- --filesystem=xdg-documents
- --filesystem=xdg-pictures
- --filesystem=xdg-videos
# Deliberately not granted: network (AniCraft never uses it) and home/host filesystem access.
modules:
- name: anicraft
buildsystem: simple
@@ -19,6 +19,12 @@ sdk-extensions:
- org.freedesktop.Sdk.Extension.rust-stable
command: anicraft
finish-args:
# Honor the launcher's pinned and nightly version choices before offering updates.
- --filesystem=xdg-data/ArtCraft/versions:ro
# Release checks and downloads use HTTPS.
- --share=network
# Verified update helpers run through flatpak-spawn --host.
- --talk-name=org.freedesktop.Flatpak
# Display: Wayland first; X11 only when no Wayland compositor is running.
- --socket=wayland
- --socket=fallback-x11
@@ -35,7 +41,6 @@ finish-args:
- --filesystem=xdg-documents
- --filesystem=xdg-pictures
- --filesystem=xdg-videos
# Deliberately not granted: network (AniCraft never uses it) and home/host filesystem access.
build-options:
append-path: /usr/lib/sdk/rust-stable/bin
modules:
+21
View File
@@ -277,6 +277,8 @@ pub const SHOT_FRAMES: u32 = 120;
pub use anicraft_engine::doc::LibraryItem;
pub struct App {
#[cfg(not(target_arch = "wasm32"))]
pub(crate) updates: crate::updates::Updates,
pub s: Session,
pub tool: Tool,
pub view: StageView,
@@ -462,6 +464,12 @@ pub const VIEW_SHORTCUTS: &[(&str, &str)] = &[
];
impl App {
/// Show the last update's result once the native window begins drawing.
#[cfg(not(target_arch = "wasm32"))]
pub fn show_update_outcome_on_start(&mut self) {
self.updates.startup();
}
pub fn new(cc: &eframe::CreationContext<'_>, session: Session, shot: Option<PathBuf>) -> App {
#[cfg_attr(not(gpu_stage), allow(unused_mut))]
let mut app = App::with_context(&cc.egui_ctx, session, shot);
@@ -495,6 +503,8 @@ impl App {
// The editor draws as Animate does: merge drawing, until Object Drawing (J) is switched on.
session.style.object_drawing = false;
let mut app = App {
#[cfg(not(target_arch = "wasm32"))]
updates: Default::default(),
s: session,
tool: Tool::Select,
view: StageView { zoom: 1.0, pan: egui::Vec2::ZERO, fit: true, fitted: None },
@@ -794,6 +804,8 @@ impl App {
let last = self.s.doc.scenes.len().saturating_sub(1);
self.run("scene.select", json!({"scene": last}));
}
#[cfg(not(target_arch = "wasm32"))]
Some("updates") => self.updates.request(),
Some("files") => self.show_files = true,
Some("start") => {
// The start screen with sample recent files (one pinned, one missing).
@@ -2337,6 +2349,8 @@ impl eframe::App for App {
fn on_exit(&mut self, _gl: Option<&eframe::glow::Context>) {
let clean = !self.s.is_dirty() || self.allow_close || self.shot.is_some();
self.recovery.finish(&self.s, clean);
#[cfg(not(target_arch = "wasm32"))]
self.updates.finish();
}
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
@@ -2348,6 +2362,13 @@ impl App {
/// One frame of the whole interface. Needs no window, so tests run it headless.
pub fn frame(&mut self, ui: &mut egui::Ui) {
let ctx = ui.ctx().clone();
#[cfg(not(target_arch = "wasm32"))]
{
let safe = crate::updates::safe_to_install(self);
if self.updates.show(&ctx, safe) {
return;
}
}
self.handle_screenshot(&ctx);
self.poll_font_scan(&ctx);
if let Some(p) = platform::picked_file() {
+12
View File
@@ -40,6 +40,8 @@ mod icons;
mod keymap;
mod library;
mod menus;
#[cfg(not(target_arch = "wasm32"))]
mod updates;
mod mixed;
mod motion_editor;
mod movie_explorer;
@@ -121,6 +123,9 @@ fn run(renderer: eframe::Renderer, file: Option<&Path>, shot: Option<PathBuf>, o
Box::new(move |cc| {
let starting_fresh = file_given.is_none() && shot.is_none();
let mut a = app::App::new(cc, session, shot);
if a.shot.is_none() {
a.show_update_outcome_on_start();
}
// No document to open: the start screen, unless it was switched off (ADR 0059).
if starting_fresh && a.prefs.start_screen {
start::open(&mut a);
@@ -145,6 +150,13 @@ fn main() {
#[cfg(not(target_arch = "wasm32"))]
fn main() -> eframe::Result {
if let Some(result) = updates::finish_helper() {
let failed = result.is_err();
if let Err(error) = result {
eprintln!("Update failed: {error}");
}
std::process::exit(i32::from(failed));
}
let mut shot: Option<PathBuf> = None;
let mut file: Option<PathBuf> = None;
let mut open: Option<String> = None;
+4
View File
@@ -282,6 +282,10 @@ pub(crate) fn menu_contents(app: &mut App, ui: &mut egui::Ui, top: &str, cmds: &
ui.label(text(Type::Caption, tr!("Panels are docked: Tools, Stage, Timeline, Properties, Library and Movie Explorer")));
}
"Help" => {
#[cfg(not(target_arch = "wasm32"))]
if ui_item(ui, tr!("Check for Updates…"), "", None) {
app.updates.check(ui.ctx());
}
if ui_item(ui, tr!("Command Palette…"), "Ctrl+K", None) {
app.palette = Some(crate::dialogs::Palette::default());
}
+476
View File
@@ -0,0 +1,476 @@
//! Native release checks and verified installation through craft-update's platform helpers.
use craft_update::pins::{Choice, Pins};
use craft_update::{App, Http, Paths, Platform, Release, Stop, self_update};
use std::sync::mpsc::{Receiver, TryRecvError, channel};
// i18n-exempt: stable release identity, not interface text.
pub const APP: App = App::new("anicraft", "AniCraft", "Animation", "storytold/anicraft");
const VERSION: &str = env!("CARGO_PKG_VERSION");
/// A pinned, nightly, or unknown launcher choice must never be replaced by a stable update.
fn stable_choice() -> Result<(), String> {
if Pins::load_default().choice(APP.id) == Choice::Stable {
Ok(())
} else {
Err(tr!("ArtCraft Launcher manages this app's version. Change its version there.").into())
}
}
/// Whether an update may close the editor without losing pending document work.
pub(crate) fn safe_to_install(app: &crate::app::App) -> bool {
!app.s.is_dirty()
&& !app.s.in_gesture()
&& !app.playing
&& app.text_edit.is_none()
&& app.pen.is_none()
&& app.pencil.is_empty()
&& app.brush_samples.is_empty()
&& app.raw_touched.is_empty()
&& app.drag == crate::app::Drag::None
&& app.motion_drag.is_none()
&& app.tl_drag == crate::timeline::TlDrag::None
&& app.me_drag.is_none()
&& app.plugin_dialog.is_none()
&& app.envelope.is_none()
}
enum Reply {
Checked(Result<Option<Release>, String>, bool),
Installed(Result<self_update::Restart, String>),
}
#[derive(Default)]
pub struct Updates {
open: bool,
read_outcome_requested: bool,
requested: bool,
message: String,
release: Option<Release>,
installable: bool,
worker: Option<Receiver<Reply>>,
installing: bool,
restart: Option<self_update::Restart>,
}
impl Updates {
/// Read the previous update result when the first desktop frame can show it.
pub fn startup(&mut self) {
self.read_outcome_requested = true;
}
/// Queue a check from the command-line panel selector.
pub fn request(&mut self) {
self.requested = true;
}
/// Start a manual check off the UI thread; repeated requests share the running check.
pub fn check(&mut self, ctx: &egui::Context) {
self.check_using(ctx, || {
let result = stable_choice()
.and_then(|()| Http::new(concat!("AniCraft/", env!("CARGO_PKG_VERSION"))))
.and_then(|http| craft_update::check_for_update(&APP, &http, VERSION));
let installable = result
.as_ref()
.ok()
.and_then(|release| release.as_ref())
.is_some_and(|release| self_update::is_self_updating(&APP) && self_update::release_installs(&APP, release));
(result, installable)
});
}
fn check_using(&mut self, ctx: &egui::Context, check: impl FnOnce() -> (Result<Option<Release>, String>, bool) + Send + 'static) {
self.open = true;
if self.worker.is_some() {
return;
}
self.message = tr!("Checking for updates…").into();
self.release = None;
self.installable = false;
let (tx, rx) = channel();
self.worker = Some(rx);
let ctx = ctx.clone();
let result = std::thread::Builder::new().name("release-check".into()).spawn(move || {
let (result, installable) = check();
let _ = tx.send(Reply::Checked(result, installable));
ctx.request_repaint();
});
if let Err(error) = result {
self.worker = None;
self.message = error.to_string();
}
}
fn install(&mut self, ctx: &egui::Context, release: Release) {
self.install_using(ctx, move || {
let install = self_update::current(&APP)
.ok_or(tr!("This installation is managed externally. Update it with its package manager or open Releases."))?;
let platform = Platform::current().ok_or(tr!("No installer is available for this platform."))?;
let http = Http::new(concat!("AniCraft/", env!("CARGO_PKG_VERSION")))?;
let paths = Paths::for_app(&APP)?;
self_update::prepare_update(
&APP,
&install,
&release,
platform,
&http,
&paths,
&Stop::default(),
&mut |_| {},
&stable_choice,
Some(VERSION),
)
});
}
fn install_using(&mut self, ctx: &egui::Context, install: impl FnOnce() -> Result<self_update::Restart, String> + Send + 'static) {
self.installing = true;
self.message = tr!("Downloading and verifying the update…").into();
let (tx, rx) = channel();
self.worker = Some(rx);
let ctx = ctx.clone();
let result = std::thread::Builder::new().name("release-install".into()).spawn(move || {
let result = install();
let _ = tx.send(Reply::Installed(result));
ctx.request_repaint();
});
if let Err(error) = result {
self.worker = None;
self.installing = false;
self.message = error.to_string();
}
}
/// Returns true while installing: the caller pauses editing and starting work until restart.
pub fn show(&mut self, ctx: &egui::Context, safe_to_install: bool) -> bool {
if std::mem::take(&mut self.requested) {
self.check(ctx);
}
if std::mem::take(&mut self.read_outcome_requested)
&& let Ok(paths) = Paths::for_app(&APP)
{
self.apply_outcome(self_update::take_outcome(&paths, VERSION));
}
let reply = self.worker.as_ref().map(Receiver::try_recv);
match reply {
Some(Ok(Reply::Checked(result, installable))) => {
self.installable = installable;
self.worker = None;
self.checked(result);
}
Some(Ok(Reply::Installed(result))) => {
self.worker = None;
match result {
Ok(restart) => {
self.restart = Some(restart);
self.message = tr!("Update ready. Restarting…").into();
}
Err(error) => {
self.installing = false;
self.message = error;
}
}
}
Some(Err(TryRecvError::Disconnected)) => {
self.worker = None;
self.installing = false;
self.message = tr!("The update worker stopped unexpectedly. Try checking again.").into();
}
_ => {}
}
if self.restart.is_some() {
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
} else if self.installing && ctx.input(|i| i.viewport().close_requested()) {
// The platform helper may be replacing files. Keep this process alive until it finishes.
ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose);
}
if self.worker.is_some() {
ctx.request_repaint_after(std::time::Duration::from_millis(100));
}
if self.open {
let mut open = true;
let mut install = false;
let mut again = false;
egui::Window::new(tr!("Check for Updates"))
.open(&mut open)
.collapsible(false)
.resizable(false)
.anchor(egui::Align2::CENTER_CENTER, egui::Vec2::ZERO)
.default_width(440.0)
.max_width((ctx.content_rect().width() - 32.0).max(160.0))
.show(ctx, |ui| {
ui.label(tr!("AniCraft {version}", version = VERSION));
ui.label(&self.message);
if !safe_to_install && self.release.is_some() {
ui.label(tr!("Save your work and stop running tasks before installing an update."));
}
if self.release.is_some() && !self.installable {
ui.label(tr!("Use Releases or your package manager to update this installation."));
}
ui.horizontal(|ui| {
if let Some(release) = &self.release {
ui.hyperlink_to(tr!("Releases"), &release.html_url);
install = ui
.add_enabled(
safe_to_install && self.installable && self.worker.is_none() && self.restart.is_none(),
egui::Button::new(tr!("Update and restart")),
)
.clicked();
} else {
ui.hyperlink_to(tr!("Releases"), APP.releases_url());
}
again = ui.add_enabled(self.worker.is_none() && !self.installing, egui::Button::new(tr!("Check again"))).clicked();
});
});
self.open = open || self.installing;
if install && let Some(release) = self.release.clone() {
self.install(ctx, release);
}
if again {
self.check(ctx);
}
}
self.installing
}
fn apply_outcome(&mut self, outcome: Option<self_update::Outcome>) {
match outcome {
Some(self_update::Outcome::Installed(version)) => {
self.open = true;
self.message = tr!("Updated to {version}.", version = version);
}
Some(self_update::Outcome::Failed(error)) => {
self.open = true;
self.message = tr!("The update failed: {error}", error = error);
}
None => {}
}
}
fn checked(&mut self, result: Result<Option<Release>, String>) {
match result {
Ok(Some(release)) => {
self.message = tr!("{version} is available.", version = release.version_label());
self.release = Some(release);
}
Ok(None) => {
self.message = tr!("You're up to date.").into();
self.release = None;
}
Err(error) => {
self.message = tr!("Couldn't check for updates: {error}", error = error);
self.release = None;
}
}
}
/// Start the prepared helper only after the app's normal exit path has accepted closing.
pub fn finish(&mut self) {
if let Some(restart) = self.restart.take()
&& let Err(error) = restart.start()
{
eprintln!("Couldn't restart after updating: {error}");
}
}
}
/// Runs the Windows installation helper before opening a normal application window.
pub fn finish_helper() -> Option<Result<(), String>> {
self_update::finish(&APP, &std::env::args_os().skip(1).collect::<Vec<_>>())
}
#[cfg(test)]
mod tests {
use super::*;
fn draw(updates: &mut Updates, safe: bool, close: bool) -> egui::FullOutput {
let ctx = egui::Context::default();
let mut input =
egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(640.0, 400.0))), ..Default::default() };
if close {
input.viewports.entry(egui::ViewportId::ROOT).or_default().events.push(egui::ViewportEvent::Close);
}
let mut output = ctx.run_ui(input, |ui| {
updates.show(ui.ctx(), safe);
});
output.textures_delta.clear();
output
}
#[test]
fn a_launcher_pin_stops_the_real_check_before_network_access() {
const CHILD: &str = "CRAFT_UPDATE_PIN_TEST_CHILD";
if std::env::var_os(CHILD).is_some() {
assert!(stable_choice().is_err());
let mut updates = Updates::default();
updates.check(&egui::Context::default());
let reply = updates
.worker
.as_ref()
.expect("check worker")
.recv_timeout(std::time::Duration::from_secs(5))
.expect("pin check finishes without network");
let (tx, rx) = channel();
tx.send(reply).expect("receiver");
updates.worker = Some(rx);
draw(&mut updates, true, false);
assert!(updates.message.contains("ArtCraft Launcher"));
assert!(updates.release.is_none());
assert!(!updates.installable);
assert!(finish_helper().is_none());
#[cfg(target_os = "linux")]
{
// This child has an isolated XDG data folder; never consume a user's update record.
let paths = Paths::for_app(&APP).expect("isolated app folders");
std::fs::create_dir_all(paths.logs()).expect("test logs");
let failure = paths.logs().join("self-update-error.txt");
std::fs::write(&failure, "test installer failure").expect("test failure record");
let mut restarted = Updates::default();
restarted.startup();
draw(&mut restarted, true, false);
assert!(restarted.open);
assert!(restarted.message.contains("test installer failure"));
assert!(!failure.exists(), "the helper result is consumed exactly once");
restarted.open = false;
restarted.startup();
draw(&mut restarted, true, false);
assert!(!restarted.open, "the old failure must not reappear on the next start");
}
return;
}
// Keep the process environment and the user's actual version choices untouched.
let dir = std::env::temp_dir().join(format!("{}-updater-pin-test-{}", APP.id, std::process::id()));
std::fs::create_dir_all(&dir).expect("test folder");
let path = dir.join("versions.json");
std::fs::write(&path, format!(r#"{{"apps":{{"{}":{{"Pinned":"0.1.0"}}}}}}"#, APP.id)).expect("test pin");
let status = std::process::Command::new(std::env::current_exe().expect("test binary"))
.args(["--exact", "updates::tests::a_launcher_pin_stops_the_real_check_before_network_access"])
.env(CHILD, "1")
.env(craft_update::pins::PATH_ENV, &path)
.env("XDG_DATA_HOME", dir.join("data"))
.status()
.expect("isolated pin test");
std::fs::remove_dir_all(dir).expect("remove test folder");
assert!(status.success());
}
#[test]
fn available_release_is_shown_but_never_installed_without_confirmation() {
let release = Release { tag: "v99.0.0".into(), html_url: APP.releases_url(), ..Release::default() };
let (tx, rx) = channel();
tx.send(Reply::Checked(Ok(Some(release)), false)).expect("receiver is alive");
let mut updates = Updates { open: true, worker: Some(rx), ..Updates::default() };
let output = draw(&mut updates, false, false);
assert!(updates.message.contains("99.0.0"));
assert!(!output.shapes.is_empty(), "the result window must be rendered");
assert!(updates.worker.is_none());
assert!(!updates.installing);
assert!(!updates.installable, "externally managed installs must only offer Releases");
updates.installable = true;
draw(&mut updates, true, false);
assert!(!updates.installing, "an available update alone must never install");
}
#[test]
fn checks_run_off_thread_and_repeated_requests_share_the_worker() {
let ctx = egui::Context::default();
let (started, wait) = channel();
let mut updates = Updates::default();
updates.check_using(&ctx, move || {
wait.recv().expect("release test worker");
(Ok(None), false)
});
assert!(updates.worker.is_some());
updates.check_using(&ctx, || panic!("must not start a second check"));
draw(&mut updates, false, false);
started.send(()).expect("worker waiting");
let reply = updates.worker.as_ref().expect("worker").recv_timeout(std::time::Duration::from_secs(5)).expect("worker finishes");
let (tx, rx) = channel();
tx.send(reply).expect("receiver");
updates.worker = Some(rx);
draw(&mut updates, true, false);
assert_eq!(updates.message, "You're up to date.");
assert!(updates.worker.is_none());
}
#[test]
fn an_install_failure_unlocks_editing_and_close_is_cancelled_until_it_finishes() {
let ctx = egui::Context::default();
let (finish, wait) = channel();
let mut updates = Updates { open: true, ..Updates::default() };
updates.install_using(&ctx, move || {
wait.recv().expect("release test worker");
Err("signature verification failed".into())
});
assert!(updates.installing);
let output = draw(&mut updates, false, true);
assert!(output.viewport_output.values().any(|v| v.commands.contains(&egui::ViewportCommand::CancelClose)));
finish.send(()).expect("worker waiting");
let reply = updates.worker.as_ref().expect("worker").recv_timeout(std::time::Duration::from_secs(5)).expect("worker finishes");
let (tx, rx) = channel();
tx.send(reply).expect("receiver");
updates.worker = Some(rx);
draw(&mut updates, false, false);
assert!(!updates.installing);
assert!(updates.worker.is_none());
assert!(updates.restart.is_none(), "failed verification must never schedule a restart");
assert!(updates.message.contains("signature verification failed"));
updates.finish();
updates.apply_outcome(None);
}
#[test]
fn uncommitted_stage_text_and_pen_paths_prevent_installation() {
let ctx = egui::Context::default();
let session = anicraft_engine::Session::new(anicraft_engine::doc::sample::demo());
let mut app = crate::app::App::with_context(&ctx, session, Some(std::path::PathBuf::from("unused.png")));
assert!(!app.s.is_dirty());
assert!(safe_to_install(&app));
app.text_edit = Some(crate::app::TextEditing {
at: egui::Pos2::ZERO,
element: None,
text: "Uncommitted stage text".into(),
original: String::new(),
focus: false,
});
assert!(!app.s.is_dirty(), "the edit has not reached Session yet");
assert!(!safe_to_install(&app), "restarting would discard the text buffer");
app.text_edit = None;
app.pen = Some(crate::pathtools::PenPath { knots: vec![[anicraft_engine::geom::Vec2::ZERO; 3]], dragging: false });
assert!(!app.s.is_dirty());
assert!(!safe_to_install(&app), "an unfinished Pen path is also pending work");
app.pen = None;
assert!(safe_to_install(&app));
app.s.begin_gesture("pending edit");
assert!(!safe_to_install(&app), "an engine gesture must finish first");
}
#[test]
fn a_failed_helper_is_reported_when_the_old_app_restarts() {
let mut updates = Updates::default();
updates.apply_outcome(Some(self_update::Outcome::Failed("installer refused the update".into())));
assert!(updates.open);
assert!(updates.message.contains("installer refused the update"));
assert!(updates.worker.is_none());
assert!(!updates.installing);
}
#[test]
fn a_successful_restart_reports_the_installed_version() {
let mut updates = Updates::default();
let version = craft_update::version::parse("1.2.3").expect("valid test version");
updates.apply_outcome(Some(self_update::Outcome::Installed(version)));
assert!(updates.open);
assert!(updates.message.contains("1.2.3"));
}
#[test]
fn a_manual_check_reports_success_and_failure() {
let mut updates = Updates::default();
updates.checked(Ok(None));
assert_eq!(updates.message, "You're up to date.");
updates.checked(Err("network unavailable".into()));
assert!(updates.message.contains("network unavailable"));
assert!(updates.release.is_none());
}
#[test]
fn a_dropped_worker_reports_failure_and_unblocks_the_app() {
let (tx, rx) = channel();
drop(tx);
let mut updates = Updates { worker: Some(rx), installing: true, ..Updates::default() };
assert!(!updates.show(&egui::Context::default(), false));
assert!(updates.message.contains("stopped unexpectedly"));
}
}
+27
View File
@@ -0,0 +1,27 @@
//! Release and source Flatpaks must allow release checks and host update helpers.
fn finish_args(manifest: &str) -> Vec<&str> {
manifest
.split("finish-args:")
.nth(1)
.unwrap_or_default()
.lines()
.take_while(|line| line.is_empty() || line.starts_with(' ') || line.starts_with('#'))
.filter_map(|line| line.trim().strip_prefix("- "))
.map(|arg| arg.trim_matches(['\'', '"']))
.collect()
}
#[test]
fn flatpak_update_permissions() {
let manifests = [
include_str!("../packaging/linux/flatpak/ai.storyteller.anicraft.bundle.yml"),
include_str!("../packaging/linux/flatpak/ai.storyteller.anicraft.yml"),
];
let args = manifests.map(finish_args);
assert_eq!(args[0], args[1], "source and release permissions must agree");
for permissions in args {
for required in ["--share=network", "--talk-name=org.freedesktop.Flatpak", "--filesystem=xdg-data/ArtCraft/versions:ro"] {
assert!(permissions.contains(&required), "missing update permission: {required}");
}
}
}