mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-01 07:24:56 -10:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1e872f797 | ||
|
|
88eb489352 | ||
|
|
40b40f9239 | ||
|
|
5bb5b16552 |
No files matched your search
Generated
+12
-4
@@ -2411,6 +2411,14 @@ dependencies = [
|
|||||||
"winres",
|
"winres",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "graphite-desktop-update"
|
||||||
|
version = "0.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"reqwest",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "graphite-desktop-wrapper"
|
name = "graphite-desktop-wrapper"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -5419,9 +5427,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "security-framework-sys"
|
name = "security-framework-sys"
|
||||||
version = "2.14.0"
|
version = "2.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32"
|
checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation-sys",
|
"core-foundation-sys",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -6326,9 +6334,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-http"
|
name = "tower-http"
|
||||||
version = "0.6.6"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
|
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.3",
|
"bitflags 2.9.3",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ members = [
|
|||||||
"desktop",
|
"desktop",
|
||||||
"desktop/wrapper",
|
"desktop/wrapper",
|
||||||
"desktop/embedded-resources",
|
"desktop/embedded-resources",
|
||||||
|
"desktop/update",
|
||||||
"desktop/bundle",
|
"desktop/bundle",
|
||||||
"desktop/platform/linux",
|
"desktop/platform/linux",
|
||||||
"desktop/platform/mac",
|
"desktop/platform/mac",
|
||||||
|
|||||||
@@ -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 }
|
||||||
@@ -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,
|
||||||
|
}
|
||||||
Reference in new issue
Block a user