Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Add one-click in-app updates for Windows and macOS

Gabriele Lozuponea2a4158a788a
diff --git a/Cargo.lock b/Cargo.lock
index 233d45d..eae40f4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -47,6 +47,15 @@ version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
+[[package]]
+name = "arbitrary"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed"
+dependencies = [
+ "derive_arbitrary",
+]
+
[[package]]
name = "arboard"
version = "3.6.1"
@@ -612,6 +621,16 @@ dependencies = [
"version_check",
]
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "core-foundation"
version = "0.10.1"
@@ -635,7 +654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97"
dependencies = [
"bitflags 2.13.2",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-graphics-types",
"foreign-types 0.5.0",
"libc",
@@ -648,7 +667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
dependencies = [
"bitflags 2.13.2",
- "core-foundation",
+ "core-foundation 0.10.1",
"libc",
]
@@ -833,6 +852,17 @@ dependencies = [
"serde_core",
]
+[[package]]
+name = "derive_arbitrary"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.6",
+]
+
[[package]]
name = "derive_more"
version = "2.1.1"
@@ -1142,6 +1172,16 @@ dependencies = [
"rustc_version",
]
+[[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.14"
@@ -1438,6 +1478,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"
@@ -1781,6 +1832,21 @@ dependencies = [
"want",
]
+[[package]]
+name = "hyper-rustls"
+version = "0.27.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53"
+dependencies = [
+ "http",
+ "hyper",
+ "hyper-util",
+ "rustls",
+ "tokio",
+ "tokio-rustls",
+ "tower-service",
+]
+
[[package]]
name = "hyper-tls"
version = "0.6.0"
@@ -1816,9 +1882,11 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"socket2",
+ "system-configuration",
"tokio",
"tower-service",
"tracing",
+ "windows-registry",
]
[[package]]
@@ -2150,6 +2218,36 @@ dependencies = [
"windows-sys 0.45.0",
]
+[[package]]
+name = "jni"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
+dependencies = [
+ "cfg-if",
+ "combine",
+ "jni-macros",
+ "jni-sys 0.4.1",
+ "log",
+ "simd_cesu8",
+ "thiserror 2.0.21",
+ "walkdir",
+ "windows-link",
+]
+
+[[package]]
+name = "jni-macros"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "simd_cesu8",
+ "syn 2.0.119",
+]
+
[[package]]
name = "jni-sys"
version = "0.3.1"
@@ -2235,7 +2333,9 @@ dependencies = [
"tauri-plugin-clipboard-manager",
"tauri-plugin-dialog",
"tauri-plugin-opener",
+ "tauri-plugin-process",
"tauri-plugin-single-instance",
+ "tauri-plugin-updater",
]
[[package]]
@@ -2387,6 +2487,12 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
+[[package]]
+name = "minisign-verify"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22f9645cb765ea72b8111f36c522475d2daa0d22c957a9826437e97534bc4e9e"
+
[[package]]
name = "miniz_oxide"
version = "0.8.9"
@@ -2728,6 +2834,18 @@ dependencies = [
"objc2-foundation",
]
+[[package]]
+name = "objc2-osa-kit"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-app-kit",
+ "objc2-foundation",
+]
+
[[package]]
name = "objc2-quartz-core"
version = "0.3.2"
@@ -2871,6 +2989,20 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "osakit"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"
+dependencies = [
+ "objc2",
+ "objc2-foundation",
+ "objc2-osa-kit",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.21",
+]
+
[[package]]
name = "pango"
version = "0.18.3"
@@ -3200,7 +3332,7 @@ dependencies = [
"tracing",
"uuid",
"windows",
- "zip",
+ "zip 8.6.0",
]
[[package]]
@@ -3356,6 +3488,7 @@ dependencies = [
"http-body",
"http-body-util",
"hyper",
+ "hyper-rustls",
"hyper-tls",
"hyper-util",
"js-sys",
@@ -3363,12 +3496,15 @@ dependencies = [
"native-tls",
"percent-encoding",
"pin-project-lite",
+ "rustls",
"rustls-pki-types",
+ "rustls-platform-verifier",
"serde",
"serde_json",
"sync_wrapper",
"tokio",
"tokio-native-tls",
+ "tokio-rustls",
"tokio-util",
"tower",
"tower-http 0.6.11",
@@ -3404,6 +3540,20 @@ dependencies = [
"windows-sys 0.60.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 = "rsqlite-vfs"
version = "0.1.1"
@@ -3457,6 +3607,32 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "rustls"
+version = "0.23.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"
+dependencies = [
+ "once_cell",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-native-certs"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d"
+dependencies = [
+ "openssl-probe",
+ "rustls-pki-types",
+ "schannel",
+ "security-framework",
+]
+
[[package]]
name = "rustls-pki-types"
version = "1.15.1"
@@ -3466,6 +3642,44 @@ 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 0.22.4",
+ "log",
+ "once_cell",
+ "rustls",
+ "rustls-native-certs",
+ "rustls-platform-verifier-android",
+ "rustls-webpki",
+ "security-framework",
+ "security-framework-sys",
+ "webpki-root-certs",
+ "windows-sys 0.61.2",
+]
+
+[[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.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
[[package]]
name = "rustversion"
version = "1.0.23"
@@ -3560,7 +3774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [
"bitflags 2.13.2",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-foundation-sys",
"libc",
"security-framework-sys",
@@ -3840,6 +4054,22 @@ version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
+[[package]]
+name = "simd_cesu8"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520"
+dependencies = [
+ "rustc_version",
+ "simdutf8",
+]
+
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
[[package]]
name = "siphasher"
version = "1.0.4"
@@ -3964,6 +4194,12 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
[[package]]
name = "swift-rs"
version = "1.0.8"
@@ -4048,6 +4284,27 @@ dependencies = [
"windows",
]
+[[package]]
+name = "system-configuration"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
+dependencies = [
+ "bitflags 2.13.2",
+ "core-foundation 0.9.4",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "system-deps"
version = "6.2.2"
@@ -4069,7 +4326,7 @@ checksum = "f37f381f4e048e6cdf038b5705f8cf14ad108279d46eb968140a7b291aba9400"
dependencies = [
"bitflags 2.13.2",
"block2",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-graphics",
"crossbeam-channel",
"dbus",
@@ -4079,7 +4336,7 @@ dependencies = [
"gdkwayland-sys",
"gdkx11-sys",
"gtk",
- "jni",
+ "jni 0.21.1",
"libc",
"log",
"ndk",
@@ -4112,6 +4369,17 @@ dependencies = [
"syn 2.0.119",
]
+[[package]]
+name = "tar"
+version = "0.4.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
+dependencies = [
+ "filetime",
+ "libc",
+ "xattr",
+]
+
[[package]]
name = "target-lexicon"
version = "0.12.16"
@@ -4135,7 +4403,7 @@ dependencies = [
"gtk",
"heck 0.5.0",
"http",
- "jni",
+ "jni 0.21.1",
"libc",
"log",
"mime",
@@ -4326,6 +4594,16 @@ dependencies = [
"zbus",
]
+[[package]]
+name = "tauri-plugin-process"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74ae3d8549ae564c0397377373e262f340908eb23a5b9fbe03f2a00007dc0038"
+dependencies = [
+ "tauri",
+ "tauri-plugin",
+]
+
[[package]]
name = "tauri-plugin-single-instance"
version = "2.5.2"
@@ -4342,6 +4620,40 @@ dependencies = [
"zbus",
]
+[[package]]
+name = "tauri-plugin-updater"
+version = "2.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8cb463cd1f26c9562a01718fe9adf6927795f764c3576e509f27cf567307ddef"
+dependencies = [
+ "base64 0.22.1",
+ "dirs",
+ "flate2",
+ "futures-util",
+ "http",
+ "infer",
+ "libc",
+ "log",
+ "minisign-verify",
+ "osakit",
+ "percent-encoding",
+ "reqwest",
+ "rustls",
+ "semver",
+ "serde",
+ "serde_json",
+ "tar",
+ "tauri",
+ "tauri-plugin",
+ "tempfile",
+ "thiserror 2.0.21",
+ "time",
+ "tokio",
+ "url",
+ "windows-sys 0.61.2",
+ "zip 4.6.1",
+]
+
[[package]]
name = "tauri-runtime"
version = "2.12.1"
@@ -4352,7 +4664,7 @@ dependencies = [
"dpi",
"gtk",
"http",
- "jni",
+ "jni 0.21.1",
"objc2",
"objc2-ui-kit",
"objc2-web-kit",
@@ -4375,7 +4687,7 @@ checksum = "7f9e7e0c9f80a5130773cfabb6df4dc924518fb1b2c923726966804634b57d22"
dependencies = [
"gtk",
"http",
- "jni",
+ "jni 0.21.1",
"log",
"objc2",
"objc2-app-kit",
@@ -4611,6 +4923,16 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "tokio-rustls"
+version = "0.26.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db"
+dependencies = [
+ "rustls",
+ "tokio",
+]
+
[[package]]
name = "tokio-stream"
version = "0.1.19"
@@ -4950,6 +5272,12 @@ version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
[[package]]
name = "url"
version = "2.5.8"
@@ -5286,6 +5614,15 @@ dependencies = [
"system-deps",
]
+[[package]]
+name = "webpki-root-certs"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b"
+dependencies = [
+ "rustls-pki-types",
+]
+
[[package]]
name = "webview2-com"
version = "0.39.1"
@@ -5456,6 +5793,17 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "windows-registry"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
+dependencies = [
+ "windows-link",
+ "windows-result",
+ "windows-strings",
+]
+
[[package]]
name = "windows-result"
version = "0.4.1"
@@ -5483,6 +5831,15 @@ dependencies = [
"windows-targets 0.42.2",
]
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-sys"
version = "0.60.2"
@@ -5516,6 +5873,22 @@ dependencies = [
"windows_x86_64_msvc 0.42.2",
]
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
+ "windows_i686_gnullvm 0.52.6",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
+]
+
[[package]]
name = "windows-targets"
version = "0.53.5"
@@ -5526,7 +5899,7 @@ dependencies = [
"windows_aarch64_gnullvm 0.53.1",
"windows_aarch64_msvc 0.53.1",
"windows_i686_gnu 0.53.1",
- "windows_i686_gnullvm",
+ "windows_i686_gnullvm 0.53.1",
"windows_i686_msvc 0.53.1",
"windows_x86_64_gnu 0.53.1",
"windows_x86_64_gnullvm 0.53.1",
@@ -5557,6 +5930,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.53.1"
@@ -5569,6 +5948,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.53.1"
@@ -5581,12 +5966,24 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
[[package]]
name = "windows_i686_gnu"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
[[package]]
name = "windows_i686_gnullvm"
version = "0.53.1"
@@ -5599,6 +5996,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
[[package]]
name = "windows_i686_msvc"
version = "0.53.1"
@@ -5611,6 +6014,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.53.1"
@@ -5623,6 +6032,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.53.1"
@@ -5635,6 +6050,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.53.1"
@@ -5717,7 +6138,7 @@ dependencies = [
"gtk",
"http",
"javascriptcore-rs",
- "jni",
+ "jni 0.21.1",
"libc",
"ndk",
"objc2",
@@ -5781,6 +6202,16 @@ version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"
+[[package]]
+name = "xattr"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"
+dependencies = [
+ "libc",
+ "rustix",
+]
+
[[package]]
name = "yoke"
version = "0.8.3"
@@ -5954,6 +6385,18 @@ dependencies = [
"syn 3.0.6",
]
+[[package]]
+name = "zip"
+version = "4.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"
+dependencies = [
+ "arbitrary",
+ "crc32fast",
+ "indexmap 2.14.2",
+ "memchr",
+]
+
[[package]]
name = "zip"
version = "8.6.0"
diff --git a/README.md b/README.md
index dd0619f..d4612f2 100644
--- a/README.md
+++ b/README.md
@@ -306,9 +306,18 @@ Simple-operation fields: `prompt`, `image` / `images[]`, `mask`, `action`
## Privacy
-Kokon makes network requests **only from the setup screen**: to `github.com` for the
-stable-diffusion.cpp release and to `huggingface.co` for the models. Creating, editing, the
-gallery, the MCP server and the API talk to `127.0.0.1` only. Logs never contain your prompts.
+Kokon makes only two kinds of network request:
+
+- **Setup:** `github.com` for the stable-diffusion.cpp release and `huggingface.co` for the
+ models.
+- **Update check:** at most once a day, the app fetches `latest.json` from this repository's
+ latest GitHub release, a small file with the newest version number. Nothing about you or your
+ images is sent. Turn it off on the welcome screen or in Settings → General. Updates are
+ downloaded only when you click **Update**, and installed only if their signature matches the
+ key built into the app.
+
+Creating, editing, the gallery, the MCP server and the API talk to `127.0.0.1` only. Logs never
+contain your prompts.
You can check this yourself. While you work, watch `Kokon.exe`, `kokon-service.exe` and
`sd-server.exe` in Resource Monitor (Network tab), or run
diff --git a/docs/releasing.md b/docs/releasing.md
new file mode 100644
index 0000000..0e6e0f9
--- /dev/null
+++ b/docs/releasing.md
@@ -0,0 +1,56 @@
+# Releasing Kokon
+
+How to publish a version that installed copies update to, on Windows and macOS.
+
+## How updates work
+
+- Once a day (unless turned off), the app reads
+ `https://github.com/GabrieleLozupone/kokon/releases/latest/download/latest.json`.
+- If its `version` is newer than the app's, a **Update to x.y.z** pill appears in the top bar.
+- One click downloads the installer (Windows) or the app archive (Mac) and checks its
+ signature against the public key in `src-tauri/tauri.conf.json`. Then it stops the local
+ service, installs, and restarts Kokon. Settings, gallery and models are kept.
+- **While the repository is private, the check finds nothing**, because GitHub serves release
+ files of a private repo only to signed-in users. Updates start working when the repo is
+ public.
+
+## The signing key (do this once)
+
+- **The private key** is `C:\Users\gabri\.tauri\kokon-updater.key`. It was generated on
+ 2026-10-09 with no password, and its public half is in `tauri.conf.json`.
+- **Back it up** (password manager, encrypted drive). If it's lost, already installed copies
+ can never be updated again: you'd need a new key and every user would have to reinstall
+ by hand.
+- **Never commit it.** It lives outside the repo on purpose.
+- **Mac:** copy it to `~/.tauri/kokon-updater.key` (for example over AirDrop, then
+ `chmod 600 ~/.tauri/kokon-updater.key`). Both build scripts read it from there, or from the
+ `TAURI_SIGNING_PRIVATE_KEY` environment variable.
+
+## Publishing a version
+
+1. **Bump the version** in `src-tauri/tauri.conf.json`, `Cargo.toml` (workspace) and
+ `package.json`, all to the same value. The updater only offers versions *higher* than the
+ installed one.
+2. **Windows:** `powershell -ExecutionPolicy Bypass -File scripts\build-release.ps1`
+3. **Mac:** `bash scripts/build-release-mac.sh`. Then copy `dist-release/` from the Mac to the
+ PC (or the other way around) so that one folder holds both platforms' files.
+4. **Write the manifest:**
+ `node scripts/release/updater.mjs manifest --notes "What changed, in one or two lines"`
+5. **Publish** (the tag must be `v` + the version):
+ ```bash
+ gh release create v0.9.1 --title "Kokon 0.9.1" --notes "…" \
+ "dist-release/Kokon Setup.exe" dist-release/Kokon_0.9.1_aarch64.dmg \
+ dist-release/Kokon_0.9.1_x64-setup.exe dist-release/Kokon_0.9.1_aarch64.app.tar.gz \
+ dist-release/latest.json
+ ```
+ `Kokon Setup.exe` and the `.dmg` are for people downloading by hand. The `_x64-setup.exe`
+ and `.app.tar.gz` are what the updater downloads; `latest.json` points to them. A release
+ marked *pre-release* is not "latest", so the updater ignores it.
+
+## Testing an update
+
+1. Install version A (for example 0.9.0) from its installer.
+2. Publish version B (0.9.1) as above.
+3. Open A. The check runs at startup, at most once a day; to force it, use Settings → General →
+ **Check now**. Then click **Update to 0.9.1**. Kokon restarts as 0.9.1, and Settings →
+ General shows the new version.
diff --git a/package-lock.json b/package-lock.json
index 3594e62..ddae70f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,11 +1,11 @@
{
- "name": "qwen-local-studio",
+ "name": "kokon",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "qwen-local-studio",
+ "name": "kokon",
"version": "1.0.0",
"dependencies": {
"@fontsource-variable/inter": "^5.3.0",
@@ -13,6 +13,8 @@
"@tauri-apps/plugin-clipboard-manager": "^2.4.1",
"@tauri-apps/plugin-dialog": "^2.8.1",
"@tauri-apps/plugin-opener": "^2.7.0",
+ "@tauri-apps/plugin-process": "^2.4.0",
+ "@tauri-apps/plugin-updater": "^2.13.2",
"lucide-react": "^1.52.0",
"react": "^19.3.0",
"react-dom": "^19.3.0"
@@ -813,6 +815,24 @@
"@tauri-apps/api": "^2.12.0"
}
},
+ "node_modules/@tauri-apps/plugin-process": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.4.0.tgz",
+ "integrity": "sha512-GddrmsSLAYrLa/yTXlXK/YRDzUgYeeOnUXTbiyvJWkmI424RmDPD3FVLeqcon7rv6O6ZfhBilcrHWnSo7o6hIQ==",
+ "license": "MIT OR Apache-2.0",
+ "dependencies": {
+ "@tauri-apps/api": "^2.12.0"
+ }
+ },
+ "node_modules/@tauri-apps/plugin-updater": {
+ "version": "2.13.2",
+ "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-updater/-/plugin-updater-2.13.2.tgz",
+ "integrity": "sha512-ekGlOBis1gztzDVuLAI54p0117BJXzFiHzYlcq3slC0LKKsHNy6TvnIdcl9g5DLuGOnViVT6EShdQczCM50SZQ==",
+ "license": "MIT OR Apache-2.0",
+ "dependencies": {
+ "@tauri-apps/api": "^2.12.0"
+ }
+ },
"node_modules/@types/chai": {
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
diff --git a/package.json b/package.json
index 3e4db34..dd6272f 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,8 @@
"@tauri-apps/plugin-clipboard-manager": "^2.4.1",
"@tauri-apps/plugin-dialog": "^2.8.1",
"@tauri-apps/plugin-opener": "^2.7.0",
+ "@tauri-apps/plugin-process": "^2.4.0",
+ "@tauri-apps/plugin-updater": "^2.13.2",
"lucide-react": "^1.52.0",
"react": "^19.3.0",
"react-dom": "^19.3.0"
diff --git a/scripts/build-release-mac.sh b/scripts/build-release-mac.sh
index dc38d4d..f6720c2 100755
--- a/scripts/build-release-mac.sh
+++ b/scripts/build-release-mac.sh
@@ -30,12 +30,20 @@ cp target/release/kokon-service "src-tauri/binaries/kokon-service-$TRIPLE"
echo "4/5 kokon-mcp"
(cd mcp && npm run build:exe)
-echo "5/5 Kokon.app + disk image"
+echo "5/5 Kokon.app + disk image (signed for the in-app updater)"
+# Updates are verified against the public key in tauri.conf.json. Copy the private key from
+# the PC that made it (~/.tauri/kokon-updater.key) once; see docs/releasing.md.
+if [ -z "${TAURI_SIGNING_PRIVATE_KEY:-}" ]; then
+ KEY="$HOME/.tauri/kokon-updater.key"
+ [ -f "$KEY" ] || { echo "✗ Updater signing key not found: $KEY (see docs/releasing.md)"; exit 1; }
+ export TAURI_SIGNING_PRIVATE_KEY="$KEY"
+fi
npx tauri build --target "$TRIPLE"
DMG="$(ls -t target/$TRIPLE/release/bundle/dmg/*.dmg | head -1)"
mkdir -p dist-release
cp "$DMG" dist-release/
+node scripts/release/updater.mjs fragment darwin-aarch64 "target/$TRIPLE/release/bundle/macos/Kokon.app.tar.gz"
codesign --verify --deep --strict "target/$TRIPLE/release/bundle/macos/Kokon.app" && echo "✓ signature (ad hoc) valid"
ls -lh dist-release/*.dmg
echo "Disk image: $(pwd)/dist-release/$(basename "$DMG")"
diff --git a/scripts/build-release.ps1 b/scripts/build-release.ps1
index 7168ac2..d9251e6 100644
--- a/scripts/build-release.ps1
+++ b/scripts/build-release.ps1
@@ -27,7 +27,14 @@ Write-Host "3/5 kokon-mcp.exe" -ForegroundColor Cyan
Push-Location mcp; npm run build:exe; $rc = $LASTEXITCODE; Pop-Location
if ($rc) { throw "MCP build failed" }
-Write-Host "4/5 Desktop app + NSIS installer" -ForegroundColor Cyan
+Write-Host "4/5 Desktop app + NSIS installer (signed for the in-app updater)" -ForegroundColor Cyan
+# Updates are verified against the public key in tauri.conf.json; the private key never
+# leaves this machine (back it up: without it, installed copies cannot be updated).
+if (-not $env:TAURI_SIGNING_PRIVATE_KEY) {
+ $key = Join-Path $env:USERPROFILE ".tauri\kokon-updater.key"
+ if (-not (Test-Path $key)) { throw "Updater signing key not found: $key (see docs/releasing.md)" }
+ $env:TAURI_SIGNING_PRIVATE_KEY = $key
+}
npx tauri build
if ($LASTEXITCODE) { throw "tauri build failed" }
@@ -39,5 +46,7 @@ Copy-Item $exe.FullName "dist-release\Kokon.exe" -Force
Copy-Item $setup.FullName "dist-release\Kokon Setup.exe" -Force
Copy-Item target\release\kokon-service.exe dist-release\ -Force
Copy-Item mcp\build\kokon-mcp.exe dist-release\ -Force
+node scripts\release\updater.mjs fragment windows-x86_64 $setup.FullName
+if ($LASTEXITCODE) { throw "updater entry failed" }
Get-ChildItem dist-release | Format-Table Name, @{n = 'MB'; e = { [math]::Round($_.Length / 1MB, 1) } } -AutoSize
Write-Host "Installer: $root\dist-release\Kokon Setup.exe" -ForegroundColor Green
diff --git a/scripts/release/updater.mjs b/scripts/release/updater.mjs
new file mode 100644
index 0000000..5f266fc
--- /dev/null
+++ b/scripts/release/updater.mjs
@@ -0,0 +1,44 @@
+// Update manifest for the in-app updater (Tauri), built from releases made on two machines.
+//
+// node scripts/release/updater.mjs fragment <windows-x86_64|darwin-aarch64> <signed bundle>
+// Copies the bundle into dist-release/ under a stable, versioned name and writes
+// dist-release/updater-<platform>.json (file name + signature from <bundle>.sig).
+// node scripts/release/updater.mjs manifest [--notes "What's new"]
+// Merges every dist-release/updater-*.json into dist-release/latest.json, with download
+// URLs of the GitHub release v<version>. Upload latest.json with the other files.
+import fs from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+
+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
+const out = path.join(root, "dist-release");
+const REPO = "GabrieleLozupone/kokon";
+const version = JSON.parse(fs.readFileSync(path.join(root, "src-tauri", "tauri.conf.json"), "utf8")).version;
+const [cmd, ...args] = process.argv.slice(2);
+fs.mkdirSync(out, { recursive: true });
+
+if (cmd === "fragment") {
+ const [platform, bundle] = args;
+ if (!["windows-x86_64", "darwin-aarch64"].includes(platform) || !bundle) throw new Error("usage: fragment <windows-x86_64|darwin-aarch64> <bundle>");
+ const sig = fs.readFileSync(`${bundle}.sig`, "utf8").trim();
+ // GitHub turns spaces in asset names into dots: keep names space-free and versioned.
+ const name = platform === "darwin-aarch64" ? `Kokon_${version}_aarch64.app.tar.gz` : `Kokon_${version}_x64-setup.exe`;
+ fs.copyFileSync(bundle, path.join(out, name));
+ fs.writeFileSync(path.join(out, `updater-${platform}.json`), JSON.stringify({ version, platform, file: name, signature: sig }, null, 2));
+ console.log(`updater entry: ${platform} -> ${name}`);
+} else if (cmd === "manifest") {
+ const i = args.indexOf("--notes");
+ const notes = i >= 0 ? args[i + 1] : `Kokon ${version}`;
+ const platforms = {};
+ for (const f of fs.readdirSync(out).filter((f) => /^updater-.+\.json$/.test(f))) {
+ const e = JSON.parse(fs.readFileSync(path.join(out, f), "utf8"));
+ if (e.version !== version) throw new Error(`${f} is for ${e.version}, but the app version is ${version}: rebuild it.`);
+ platforms[e.platform] = { signature: e.signature, url: `https://github.com/${REPO}/releases/download/v${version}/${e.file}` };
+ }
+ if (!Object.keys(platforms).length) throw new Error("No updater-*.json in dist-release: run a release build first.");
+ const manifest = { version, notes, pub_date: new Date().toISOString(), platforms };
+ fs.writeFileSync(path.join(out, "latest.json"), JSON.stringify(manifest, null, 2));
+ console.log(`dist-release/latest.json: ${version} for ${Object.keys(platforms).join(", ")}`);
+} else {
+ throw new Error("usage: updater.mjs fragment <platform> <bundle> | manifest [--notes text]");
+}
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 6a5d81a..0451c5d 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -21,4 +21,6 @@ tauri = { version = "2", features = [] }
tauri-plugin-clipboard-manager = "2"
tauri-plugin-dialog = "2"
tauri-plugin-opener = "2"
+tauri-plugin-process = "2"
tauri-plugin-single-instance = "2"
+tauri-plugin-updater = "2"
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json
index 49a228c..9ebbeb9 100644
--- a/src-tauri/capabilities/default.json
+++ b/src-tauri/capabilities/default.json
@@ -2,7 +2,9 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Main window: dialogs, clipboard text, window events, full-screen image viewer.",
- "windows": ["main"],
+ "windows": [
+ "main"
+ ],
"permissions": [
"core:default",
"core:window:allow-show",
@@ -12,6 +14,8 @@
"dialog:allow-save",
"dialog:allow-message",
"dialog:allow-ask",
- "clipboard-manager:allow-write-text"
+ "clipboard-manager:allow-write-text",
+ "updater:default",
+ "process:allow-restart"
]
}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 401af26..fd0d523 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -92,12 +92,32 @@ fn spawn_service() -> Result<(), String> {
Ok(())
}
+/// Asks the service to exit (it also stops sd-server unless kept loaded) and waits until it
+/// no longer answers, so an update can replace its executable.
+fn stop_service(info: &ServiceInfo) -> bool {
+ let _ = http().post(format!("http://127.0.0.1:{}/api/v1/shutdown", info.port)).bearer_auth(&info.token).send();
+ let start = Instant::now();
+ while start.elapsed() < Duration::from_secs(15) {
+ if !ping(info.port) {
+ // The port closes before the process ends; give it a moment to release its files.
+ std::thread::sleep(Duration::from_millis(800));
+ return true;
+ }
+ std::thread::sleep(Duration::from_millis(200));
+ }
+ false
+}
+
fn ensure_service(shared: &Shared) -> Result<ServiceInfo, String> {
let _g = shared.connect_lock.lock().unwrap();
if let Some(i) = read_info()
&& ping(i.port)
{
- return Ok(i);
+ if i.version == env!("CARGO_PKG_VERSION") {
+ return Ok(i);
+ }
+ // Left running by the previous version (e.g. just updated): replace it.
+ stop_service(&i);
}
spawn_service()?;
let start = Instant::now();
@@ -187,6 +207,21 @@ async fn read_clipboard_image(app: tauri::AppHandle) -> Result<tauri::ipc::Respo
Ok(tauri::ipc::Response::new(png))
}
+/// Before installing an update: stop the service so the installer can replace it.
+#[tauri::command]
+async fn prepare_update(state: tauri::State<'_, Arc<Shared>>) -> Result<(), String> {
+ let shared = state.inner().clone();
+ tauri::async_runtime::spawn_blocking(move || {
+ let info = shared.info.lock().unwrap().clone().or_else(read_info);
+ match info {
+ Some(i) if ping(i.port) && !stop_service(&i) => Err("The Kokon service did not stop. Close Kokon and try again.".to_string()),
+ _ => Ok(()),
+ }
+ })
+ .await
+ .map_err(|e| e.to_string())?
+}
+
#[tauri::command]
fn reveal(path: String) -> Result<(), String> {
tauri_plugin_opener::reveal_item_in_dir(&path).map_err(|e| e.to_string())
@@ -243,6 +278,8 @@ pub fn run() {
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_clipboard_manager::init())
+ .plugin(tauri_plugin_updater::Builder::new().build())
+ .plugin(tauri_plugin_process::init())
.manage(shared.clone())
.setup(|app| {
// The window starts hidden and the page shows it once its splash is painted
@@ -259,7 +296,7 @@ pub fn run() {
});
Ok(())
})
- .invoke_handler(tauri::generate_handler![connect, copy_image, read_clipboard_image, reveal, open_folder, open_link, data_folder])
+ .invoke_handler(tauri::generate_handler![connect, copy_image, read_clipboard_image, reveal, open_folder, open_link, data_folder, prepare_update])
.build(tauri::generate_context!())
.expect("error while building Kokon");
app.run(move |_handle, event| {
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 9e44956..c3f8277 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -31,13 +31,23 @@
},
"bundle": {
"active": true,
- "targets": ["nsis"],
+ "targets": [
+ "nsis"
+ ],
"publisher": "Kokon",
"shortDescription": "Create and edit images by describing them, on your own GPU",
"longDescription": "Kokon creates and edits images from a sentence, privately on your own GPU, with Qwen-Image 2.1 via stable-diffusion.cpp. Everything runs on this PC.",
"category": "Graphics and Design",
- "icon": ["icons/32x32.png", "icons/128x128.png", "icons/[email protected]", "icons/icon.ico"],
- "externalBin": ["binaries/kokon-service", "binaries/kokon-mcp"],
+ "icon": [
+ "icons/32x32.png",
+ "icons/128x128.png",
+ "icons/icon.ico"
+ ],
+ "externalBin": [
+ "binaries/kokon-service",
+ "binaries/kokon-mcp"
+ ],
"windows": {
"nsis": {
"installerIcon": "icons/icon.ico",
@@ -45,6 +55,18 @@
"installMode": "currentUser",
"displayLanguageSelector": false
}
+ },
+ "createUpdaterArtifacts": true
+ },
+ "plugins": {
+ "updater": {
+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZEOTYyMjkyRkI1MTQzREQKUldUZFExSDdraUtXL2ZXWWcrNnhNVGZuTnp2UFFrRk1XMFR0em1IWURmcmVEUlJ2bnVscDBCaC8K",
+ "endpoints": [
+ "https://github.com/GabrieleLozupone/kokon/releases/latest/download/latest.json"
+ ],
+ "windows": {
+ "installMode": "passive"
+ }
}
}
}
diff --git a/src/App.tsx b/src/App.tsx
index 6ec7865..16bd111 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,5 +1,5 @@
import { getCurrentWebview } from "@tauri-apps/api/webview";
-import { EyeOff, PanelLeft, Redo2, Settings, SquarePen, Undo2, X } from "lucide-react";
+import { ArrowDownToLine, EyeOff, PanelLeft, Redo2, Settings, SquarePen, Undo2, X } from "lucide-react";
import { useEffect, useState } from "react";
import { api, configure } from "./lib/api";
import { native } from "./lib/native";
@@ -17,6 +17,7 @@ import { Stage } from "./components/Stage";
import { IconButton } from "./components/ui";
import { shortcut } from "./lib/platform";
import { KokonMark, Welcome } from "./components/Welcome";
+import { autoCheckForUpdate, installUpdate } from "./lib/updates";
const IMAGE_EXT = /\.(png|jpe?g|webp|bmp|gif|tiff?|heic|heif)$/i;
@@ -96,6 +97,28 @@ function BootSplash() {
);
}
+/** "Update" pill in the top bar once a newer release is found; one click installs it. */
+function UpdatePill() {
+ const update = useStore((s) => s.update);
+ if (!update) return null;
+ const busy = update.phase !== "available";
+ const click = async () => {
+ const running = Object.values(getState().jobs).some((j) => !["done", "failed", "cancelled"].includes(j.status));
+ const msg = `Install Kokon ${update.version} now? Kokon closes and restarts in a few seconds${running ? "; the images being made now are stopped" : ""}. Your images, settings and models stay.`;
+ if (await native.confirm(update.notes ? `${msg}
+
+What's new:
+${update.notes}` : msg, "Update Kokon")) installUpdate();
+ };
+ const label =
+ update.phase === "downloading" ? `Downloading${update.progress != null ? ` ${Math.round(update.progress * 100)}%` : "…"}` : update.phase === "installing" ? "Installing…" : `Update to ${update.version}`;
+ return (
+ <button className="update-pill" onClick={click} disabled={busy} title={`Kokon ${update.version} is available`}>
+ <ArrowDownToLine size={14} /> {label}
+ </button>
+ );
+}
+
function PrivateToggle() {
const on = useStore((s) => s.privateMode);
const toggle = () => setPrivateMode(!on, () => native.confirm("Turn off private mode? The images made in private mode will be deleted.", "Private mode"));
@@ -171,6 +194,7 @@ export default function App() {
const welcomeSeen = !!(cfg.ui as Record<string, unknown> | null)?.welcomeSeen;
setState({ needsSetup: !cfg.setupComplete, ...(welcomeSeen ? {} : { overlay: "welcome" }) });
setBoot("ok");
+ autoCheckForUpdate();
// Preload the model so the first generation starts immediately.
if (cfg.setupComplete && st && st.server.state === "stopped") api.startBackend().then(refreshStatus, () => refreshStatus());
} catch (e) {
@@ -297,6 +321,7 @@ export default function App() {
</div>
<div className="toolbar">
{!needsSetup && <HistoryButtons />}
+ <UpdatePill />
{!needsSetup && <PrivateToggle />}
<StatusIndicator />
<IconButton title="Settings" onClick={() => setState({ overlay: "settings" })}>
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index d6934e3..0712fed 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -3,10 +3,11 @@ import { useEffect, useState } from "react";
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { api } from "../lib/api";
import { native } from "../lib/native";
-import { refreshStatus, setState, toastError, toastInfo } from "../lib/store";
+import { getState, refreshStatus, setState, toastError, toastInfo } from "../lib/store";
import { UPSCALERS } from "../lib/logic";
import type { AppConfig, Check, ModelProfile, RefineMode, SetupReport, TextEncoderPlacement } from "../lib/types";
import { IconButton, Seg, Switch } from "./ui";
+import { autoCheckEnabled, checkForUpdate } from "../lib/updates";
type Tab = "general" | "models" | "performance" | "diagnostics";
@@ -111,6 +112,7 @@ export function Settings() {
const profile = cfg.profiles.find((p) => p.id === cfg.activeProfile) ?? cfg.profiles[0];
// Apple Silicon (Metal) has unified memory: no VRAM, device picker or CUDA-only options.
const mac = cfg.gpuBackend === "metal";
+ const appVersion = getState().status?.service.version ?? "";
const set = (patch: Partial<AppConfig>) => {
setCfg({ ...cfg, ...patch });
setDirty(true);
@@ -173,6 +175,18 @@ export function Settings() {
<input className="input" type="number" min={0} max={1440} style={{ width: 90 }} value={cfg.idleUnloadMinutes} onChange={(e) => set({ idleUnloadMinutes: Math.max(0, Number(e.target.value) || 0) })} />
</label>
<span className="muted" style={{ marginTop: -10 }}>Applies to MCP and API use without the desktop window. 0 keeps it loaded.</span>
+ <div className="field-row">
+ <span>Check for updates once a day</span>
+ <Switch on={autoCheckEnabled(cfg.ui)} onChange={(v) => set({ ui: { ...cfg.ui, updateCheck: v } })} />
+ </div>
+ <div className="field-row" style={{ marginTop: -10 }}>
+ <span className="muted">
+ Kokon {appVersion} · only asks GitHub for the latest version number; nothing about you or your images is sent. Updates install when you click them.
+ </span>
+ <button className="btn" onClick={() => checkForUpdate(true)}>
+ Check now
+ </button>
+ </div>
<div className="field-row">
<span>Welcome screen: what Kokon is and how it keeps your work private</span>
<button className="btn" onClick={() => setState({ overlay: "welcome" })}>
diff --git a/src/components/Welcome.tsx b/src/components/Welcome.tsx
index a6a84ba..df232be 100644
--- a/src/components/Welcome.tsx
+++ b/src/components/Welcome.tsx
@@ -11,6 +11,7 @@ import restyle from "../assets/showcase/restyle.jpg";
import text from "../assets/showcase/text.jpg";
import { api } from "../lib/api";
import { isMac } from "../lib/platform";
+import { autoCheckEnabled } from "../lib/updates";
import { setState, toastError, useStore } from "../lib/store";
const machine = isMac ? "Mac" : "PC";
@@ -21,12 +22,13 @@ export function KokonMark({ size = 40 }: { size?: number }) {
return <span className="kokon-mark" aria-hidden dangerouslySetInnerHTML={{ __html: svg }} />;
}
-/** Remembers that the welcome screen was seen (in the app config, so it survives updates). */
-async function markSeen() {
+/** Remembers that the welcome screen was seen (in the app config, so it survives updates)
+ * and the update-check choice made on it. */
+async function markSeen(updateCheck: boolean) {
try {
const cfg = await api.config();
const ui = (cfg.ui ?? {}) as Record<string, unknown>;
- if (!ui.welcomeSeen) await api.saveConfig({ ...cfg, ui: { ...ui, welcomeSeen: true } });
+ if (!ui.welcomeSeen || autoCheckEnabled(ui) !== updateCheck) await api.saveConfig({ ...cfg, ui: { ...ui, welcomeSeen: true, updateCheck } });
} catch (e) {
toastError(e);
}
@@ -34,7 +36,7 @@ async function markSeen() {
const PROMISES = [
{ icon: Cpu, title: `Made on your ${machine}`, text: "Your graphics chip creates every image. Photos and prompts never leave this computer." },
- { icon: CloudOff, title: "Online only once", text: "Setup downloads the model. After that Kokon works without an internet connection." },
+ { icon: CloudOff, title: "Online only when needed", text: "To download the model, and once a day to check for a new Kokon version. Your images and prompts are never sent." },
{ icon: Unlimited, title: "No limits", text: "No account, no credits, no subscription, no queue. Create as much as you like." },
{ icon: EyeOff, title: "Private mode", text: "Click the eye icon and nothing is kept: no gallery, no files, no history." },
];
@@ -42,9 +44,15 @@ const PROMISES = [
/** First launch (and Settings → General → Show welcome screen): what Kokon is and why it is private. */
export function Welcome() {
const needsSetup = useStore((s) => s.needsSetup);
+ const [updateCheck, setUpdateCheck] = useState(true);
+ useEffect(() => {
+ api.config().then((c) => setUpdateCheck(autoCheckEnabled(c.ui)), () => {});
+ }, []);
+ const choice = useRef(updateCheck);
+ choice.current = updateCheck;
const close = () => {
setState({ overlay: null });
- markSeen();
+ markSeen(choice.current);
};
useEffect(() => {
const onKey = (e: KeyboardEvent) => e.key === "Escape" && close();
@@ -69,6 +77,10 @@ export function Welcome() {
</div>
))}
</div>
+ <label className="welcome-check">
+ <input type="checkbox" checked={updateCheck} onChange={(e) => setUpdateCheck(e.target.checked)} />
+ Check for Kokon updates once a day
+ </label>
<button className="btn primary big" onClick={close}>
{needsSetup ? "Set up Kokon" : "Start creating"}
</button>
diff --git a/src/lib/store.ts b/src/lib/store.ts
index ce2e6e9..d093f9c 100644
--- a/src/lib/store.ts
+++ b/src/lib/store.ts
@@ -41,7 +41,17 @@ export interface Toast {
kind: "error" | "info";
}
+/** A newer Kokon release found by the update check (`lib/updates.ts`). */
+export interface UpdateInfo {
+ version: string;
+ notes: string;
+ phase: "available" | "downloading" | "installing";
+ /** 0..1 while downloading, when the size is known. */
+ progress: number | null;
+}
+
export interface State {
+ update: UpdateInfo | null;
connected: boolean;
connectError: string | null;
server: { state: ServerState; owned: boolean; error: AppErrorBody | null };
@@ -249,6 +259,7 @@ const loadSidebar = () => {
};
let state: State = {
+ update: null,
connected: false,
connectError: null,
server: { state: "stopped", owned: false, error: null },
diff --git a/src/lib/updates.test.ts b/src/lib/updates.test.ts
new file mode 100644
index 0000000..e4f0a46
--- /dev/null
+++ b/src/lib/updates.test.ts
@@ -0,0 +1,18 @@
+import { describe, expect, it } from "vitest";
+import { autoCheckEnabled, checkDue } from "./updates";
+
+describe("update check schedule", () => {
+ it("is on unless turned off", () => {
+ expect(autoCheckEnabled(undefined)).toBe(true);
+ expect(autoCheckEnabled({})).toBe(true);
+ expect(autoCheckEnabled({ updateCheck: true })).toBe(true);
+ expect(autoCheckEnabled({ updateCheck: false })).toBe(false);
+ });
+ it("checks at most once a day", () => {
+ const now = Date.UTC(2026, 9, 10, 12);
+ expect(checkDue(null, now)).toBe(true);
+ expect(checkDue(NaN, now)).toBe(true);
+ expect(checkDue(now - 60_000, now)).toBe(false);
+ expect(checkDue(now - 25 * 3600_000, now)).toBe(true);
+ });
+});
diff --git a/src/lib/updates.ts b/src/lib/updates.ts
new file mode 100644
index 0000000..0d4647a
--- /dev/null
+++ b/src/lib/updates.ts
@@ -0,0 +1,96 @@
+// In-app updates (Tauri updater): checks GitHub for latest.json at most once a day (unless the
+// user turned it off), then downloads, verifies the signature, stops the local service and
+// installs with one click. The request carries nothing about the user or their images.
+
+import { invoke } from "@tauri-apps/api/core";
+import { relaunch } from "@tauri-apps/plugin-process";
+import { type Update, check } from "@tauri-apps/plugin-updater";
+import { api } from "./api";
+import { getState, setState, toastError, toastInfo } from "./store";
+
+const DAY_MS = 24 * 60 * 60 * 1000;
+const LAST_CHECK_KEY = "kokon.lastUpdateCheck";
+let pending: Update | null = null;
+
+/** The automatic check is on unless the user turned it off (config `ui.updateCheck`). */
+export function autoCheckEnabled(ui: Record<string, unknown> | null | undefined): boolean {
+ return ui?.updateCheck !== false;
+}
+
+/** Due when the last check is older than a day (or unknown). */
+export function checkDue(lastCheck: number | null, now: number): boolean {
+ return lastCheck == null || !Number.isFinite(lastCheck) || now - lastCheck >= DAY_MS;
+}
+
+function readLastCheck(): number | null {
+ try {
+ const v = localStorage.getItem(LAST_CHECK_KEY);
+ return v ? Number(v) : null;
+ } catch {
+ return null;
+ }
+}
+
+function writeLastCheck(t: number) {
+ try {
+ localStorage.setItem(LAST_CHECK_KEY, String(t));
+ } catch {
+ /* only means checking again next start */
+ }
+}
+
+/** Looks for an update. `manual`: from Settings, so report the outcome (and errors). */
+export async function checkForUpdate(manual = false): Promise<void> {
+ try {
+ const u = await check();
+ writeLastCheck(Date.now());
+ if (u) {
+ pending = u;
+ setState({ update: { version: u.version, notes: u.body ?? "", phase: "available", progress: null } });
+ } else if (manual) {
+ toastInfo("Kokon is up to date.");
+ }
+ } catch (e) {
+ // Offline, or no release published yet: silent for the automatic check.
+ if (manual) toastError(`Could not check for updates: ${String(e)}`);
+ else console.info("update check failed", e);
+ }
+}
+
+/** On startup: check if enabled and a day has passed. Never in development builds. */
+export async function autoCheckForUpdate(): Promise<void> {
+ if (import.meta.env.DEV) return;
+ try {
+ const cfg = await api.config();
+ if (!autoCheckEnabled(cfg.ui as Record<string, unknown>) || !checkDue(readLastCheck(), Date.now())) return;
+ } catch {
+ return;
+ }
+ await checkForUpdate(false);
+}
+
+/** Download, stop the service (so its files can be replaced), install and restart. */
+export async function installUpdate(): Promise<void> {
+ const u = pending;
+ const info = getState().update;
+ if (!u || !info) return;
+ try {
+ let total = 0;
+ let got = 0;
+ setState({ update: { ...info, phase: "downloading", progress: null } });
+ await u.download((ev) => {
+ if (ev.event === "Started") total = ev.data.contentLength ?? 0;
+ else if (ev.event === "Progress") {
+ got += ev.data.chunkLength;
+ setState((s) => (s.update ? { update: { ...s.update, progress: total ? got / total : null } } : {}));
+ }
+ });
+ setState({ update: { ...info, phase: "installing", progress: null } });
+ await invoke("prepare_update");
+ await u.install();
+ await relaunch();
+ } catch (e) {
+ setState({ update: { ...info, phase: "available", progress: null } });
+ toastError(`The update could not be installed: ${String(e)}`);
+ }
+}
diff --git a/src/styles.css b/src/styles.css
index b962c92..4853a2b 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -333,6 +333,9 @@ pre.diag { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.private-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--invert-bg); color: var(--invert-text); font: inherit; font-size: 13px; cursor: pointer; }
+.update-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
+.update-pill:hover:not(:disabled) { background: var(--surface-2); }
+.update-pill:disabled { cursor: default; color: var(--text-2); }
.setup { flex: 1; display: flex; justify-content: center; overflow-y: auto; padding: 40px 24px 0; }
/* Bottom room inside the scroller (padding on the scroller itself is dropped by Chromium). */
.setup-inner { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 20px; padding-bottom: 72px; height: fit-content; }
@@ -490,3 +493,5 @@ pre.diag { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font
.boot-text.on { opacity: 1; }
@keyframes boot-breathe { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .boot-splash .kokon-mark { animation: none; } }
+.welcome-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
+.welcome-check input { width: 15px; height: 15px; accent-color: var(--text); margin: 0; }