Compare commits

...
Author SHA1 Message Date
Timon b1e872f797 WIP 2026-02-14 23:41:46 +00:00
Timon 88eb489352 WIP 2026-02-13 19:55:30 +00:00
Timon 40b40f9239 WIP 2026-02-13 19:50:13 +00:00
Timon 5bb5b16552 WIP 2026-02-13 16:24:20 +00:00
4 changed files with 118 additions and 4 deletions

No files matched your search

Generated
+12 -4
View File
@@ -2411,6 +2411,14 @@ dependencies = [
"winres",
]
[[package]]
name = "graphite-desktop-update"
version = "0.0.0"
dependencies = [
"reqwest",
"serde",
]
[[package]]
name = "graphite-desktop-wrapper"
version = "0.1.0"
@@ -5419,9 +5427,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
version = "2.14.0"
version = "2.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32"
checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0"
dependencies = [
"core-foundation-sys",
"libc",
@@ -6326,9 +6334,9 @@ dependencies = [
[[package]]
name = "tower-http"
version = "0.6.6"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
dependencies = [
"bitflags 2.9.3",
"bytes",
+1
View File
@@ -3,6 +3,7 @@ members = [
"desktop",
"desktop/wrapper",
"desktop/embedded-resources",
"desktop/update",
"desktop/bundle",
"desktop/platform/linux",
"desktop/platform/mac",
+13
View File
@@ -0,0 +1,13 @@
[package]
name = "graphite-desktop-update"
version = "0.0.0"
description = "Graphite Desktop Update"
authors = ["Graphite Authors <[email protected]>"]
license = "Apache-2.0"
repository = ""
edition = "2024"
rust-version = "1.87"
[dependencies]
serde = { workspace = true }
reqwest = { workspace = true }
+92
View File
@@ -0,0 +1,92 @@
const UPDATE_CHECK_URL: &str = "https://localhost:8080/v1/update";
async fn check_for_update(info: Info) -> UpdateCheckResponse {
let client = reqwest::Client::new();
let response = client.post(UPDATE_CHECK_URL).json(&info).send().await;
match response {
Ok(response) if response.status().is_success() => {
if let Ok(result) = response.json::<UpdateCheckResponse>().await {
return result;
}
}
_ => {}
}
UpdateCheckResponse {
status: Status::Unknown,
prompts: Vec::new(),
}
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Info {
pub commit: Commit,
pub version: Version,
pub system: System,
pub distribution: Distribution,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Commit {
pub hash: String,
pub time: u64,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Version {
Stable { major: u32, minor: u32, patch: u32 },
Dev,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct System {
pub os: Os,
pub arch: Arch,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Os {
Linux,
Mac,
Windows,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Arch {
X86_64,
Aarch64,
Wasm32,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Distribution {
WebOfficial,
WebUnknown,
Flathub,
Nixpkgs,
Steam,
MacAppStore,
WindowsStore,
Installer,
Portable,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct UpdateCheckResponse {
status: Option<Prompt>,
prompts: Vec<Prompt>,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub struct Prompt {
title: String,
body: String,
resolution: Option<Resolution>,
}
#[derive(Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Resolution {
Visit { url: String },
AutoInstall { url: String, hash: String, version: Version, commit: Commit },
PackageManager,
}