diff --git a/Cargo.lock b/Cargo.lock index 94eb26b3e..49b3a992b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,6 +158,15 @@ version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "arrayvec" version = "0.7.6" @@ -354,6 +363,7 @@ dependencies = [ "tauri-plugin-process", "tauri-plugin-shell", "tauri-plugin-store", + "tauri-plugin-updater", "tauri-plugin-window-state", "tempfile", "tokio", @@ -1144,6 +1154,17 @@ dependencies = [ "serde", ] +[[package]] +name = "derive_arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.104", +] + [[package]] name = "derive_more" version = "0.99.20" @@ -1483,6 +1504,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "filetime" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +dependencies = [ + "cfg-if", + "libc", + "libredox", + "windows-sys 0.59.0", +] + [[package]] name = "flate2" version = "1.1.2" @@ -2782,6 +2815,7 @@ checksum = "1580801010e535496706ba011c15f8532df6b42297d2e471fec38ceadd8c0638" dependencies = [ "bitflags 2.9.1", "libc", + "redox_syscall", ] [[package]] @@ -2965,6 +2999,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minisign-verify" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e856fdd13623a2f5f2f54676a4ee49502a96a80ef4a62bcedd23d52427c44d43" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -3340,6 +3380,18 @@ dependencies = [ "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-osa-kit" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26bb88504b5a050dbba515d2414607bf5e57dd56b107bc5f0351197a3e7bdc5d" +dependencies = [ + "bitflags 2.9.1", + "objc2 0.6.1", + "objc2-app-kit", + "objc2-foundation 0.3.1", +] + [[package]] name = "objc2-quartz-core" version = "0.2.2" @@ -3505,6 +3557,20 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "osakit" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b" +dependencies = [ + "objc2 0.6.1", + "objc2-foundation 0.3.1", + "objc2-osa-kit", + "serde", + "serde_json", + "thiserror 2.0.12", +] + [[package]] name = "pango" version = "0.18.3" @@ -5266,6 +5332,17 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tar" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "target-lexicon" version = "0.12.16" @@ -5576,6 +5653,38 @@ dependencies = [ "tracing", ] +[[package]] +name = "tauri-plugin-updater" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27cbc31740f4d507712550694749572ec0e43bdd66992db7599b89fbfd6b167b" +dependencies = [ + "base64 0.22.1", + "dirs", + "flate2", + "futures-util", + "http", + "infer", + "log", + "minisign-verify", + "osakit", + "percent-encoding", + "reqwest", + "semver", + "serde", + "serde_json", + "tar", + "tauri", + "tauri-plugin", + "tempfile", + "thiserror 2.0.12", + "time", + "tokio", + "url", + "windows-sys 0.60.2", + "zip", +] + [[package]] name = "tauri-plugin-window-state" version = "2.3.0" @@ -7375,6 +7484,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "xattr" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3a19837351dc82ba89f8a125e22a3c475f05aba604acc023d62b2739ae2909" +dependencies = [ + "libc", + "rustix 1.0.8", +] + [[package]] name = "yoke" version = "0.8.0" @@ -7540,6 +7659,18 @@ dependencies = [ "syn 2.0.104", ] +[[package]] +name = "zip" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aed4ac33e8eb078c89e6cbb1d5c4c7703ec6d299fc3e7c3695af8f8b423468b" +dependencies = [ + "arbitrary", + "crc32fast", + "indexmap 2.10.0", + "memchr", +] + [[package]] name = "zvariant" version = "5.6.0" diff --git a/bun.lock b/bun.lock index 551ad8efc..991b483fd 100644 --- a/bun.lock +++ b/bun.lock @@ -10,6 +10,7 @@ "@tauri-apps/plugin-os": "^2", "@tauri-apps/plugin-process": "^2", "@tauri-apps/plugin-shell": "^2.3.0", + "@tauri-apps/plugin-updater": "^2.9.0", "@types/prismjs": "^1.26.5", "clsx": "^2.1.1", "fast-deep-equal": "^3.1.3", @@ -387,6 +388,8 @@ "@tauri-apps/plugin-shell": ["@tauri-apps/plugin-shell@2.3.0", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-6GIRxO2z64uxPX4CCTuhQzefvCC0ew7HjdBhMALiGw74vFBDY95VWueAHOHgNOMV4UOUAFupyidN9YulTe5xlA=="], + "@tauri-apps/plugin-updater": ["@tauri-apps/plugin-updater@2.9.0", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-j++sgY8XpeDvzImTrzWA08OqqGqgkNyxczLD7FjNJJx/uXxMZFz5nDcfkyoI/rCjYuj2101Tci/r/HFmOmoxCg=="], + "@types/babel__core": ["@types/babel__core@7.20.5", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="], "@types/babel__generator": ["@types/babel__generator@7.27.0", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="], diff --git a/package.json b/package.json index db5e95f15..7caa61b2c 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@tauri-apps/plugin-os": "^2", "@tauri-apps/plugin-process": "^2", "@tauri-apps/plugin-shell": "^2.3.0", + "@tauri-apps/plugin-updater": "^2.9.0", "@types/prismjs": "^1.26.5", "clsx": "^2.1.1", "fast-deep-equal": "^3.1.3", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 37a9c83ee..f3df7e0c2 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -45,6 +45,7 @@ tauri-plugin-os = "2" tauri-plugin-process = "2" tauri-plugin-shell = "2" tauri-plugin-store = "2" +tauri-plugin-updater = "2" tokio = { version = "1.0", features = ["full"] } tokio-tungstenite = "0.24" tree-sitter = "0.25.8" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b15b488f5..106b87991 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -45,6 +45,7 @@ "bundle": { "active": true, "targets": "all", + "createUpdaterArtifacts": true, "icon": [ "icons/32x32.png", "icons/128x128.png", @@ -56,6 +57,14 @@ "plugins": { "fs": { "requireLiteralLeadingDot": false + }, + "updater": { + "active": true, + "endpoints": [ + "https://athas.dev/updates/{{target}}/{{current_version}}" + ], + "dialog": true, + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUxRDJGNTM3M0M0M0U3NzEKUldSeDUwTThOL1hTNFRlYVNycS9QSFFaa29Rdy9xZUVRUU80Wi8wekxHS2EvWkk5dG5Xb1gxbnoK" } } } diff --git a/src/components/editor-footer.tsx b/src/components/editor-footer.tsx index a20f0a984..3f603e1cb 100644 --- a/src/components/editor-footer.tsx +++ b/src/components/editor-footer.tsx @@ -1,4 +1,4 @@ -import { AlertCircle, Terminal as TerminalIcon } from "lucide-react"; +import { AlertCircle, Terminal as TerminalIcon, Download } from "lucide-react"; import { useBufferStore } from "../stores/buffer-store"; import { useFileSystemStore } from "../stores/file-system/store"; import { useGitStore } from "../stores/git-store"; @@ -7,6 +7,7 @@ import { useUIState } from "../stores/ui-state-store"; import { getFilenameFromPath, getLanguageFromFilename } from "../utils/file-utils"; import { getGitStatus } from "../utils/git"; import GitBranchManager from "./git/git-branch-manager"; +import { useUpdater } from "../hooks/use-updater"; const EditorFooter = () => { const buffers = useBufferStore.use.buffers(); @@ -16,6 +17,7 @@ const EditorFooter = () => { const uiState = useUIState(); const { rootFolderPath } = useFileSystemStore(); const { gitStatus, actions } = useGitStore(); + const { available, downloading, installing, updateInfo, downloadAndInstall } = useUpdater(false); return (
+ v0.1.0 +
+ {checking && ( +- v0.1.0 -
+ Version {updateInfo?.version} is ready to install +
++ {error} +
+