Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@tauri-apps/plugin-notification": "^2.3.3",
"@tauri-apps/plugin-opener": "^2",
"@tauri-apps/plugin-process": "^2.3.1",
"@tauri-apps/plugin-updater": "^2.10.0",
"@tiptap/core": "^3.22.3",
"@tiptap/extension-link": "^3.22.3",
"@tiptap/extension-placeholder": "^3.22.3",
Expand Down
10 changes: 10 additions & 0 deletions desktop/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 79 additions & 1 deletion desktop/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ tauri-plugin-opener = "2"
tauri-plugin-window-state = "2"
tauri-plugin-websocket = "2"
tauri-plugin-dialog = "2"
tauri-plugin-updater = "2"
tauri-plugin-process = "2"
infer = "0.19"
hex = "0.4"
Expand Down
16 changes: 16 additions & 0 deletions desktop/src-tauri/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
fn main() {
println!("cargo:rerun-if-env-changed=SPROUT_RELAY_URL");
println!("cargo:rerun-if-env-changed=SPROUT_RELAY_HTTP");
println!("cargo:rerun-if-env-changed=SPROUT_UPDATER_PUBLIC_KEY");
println!("cargo:rerun-if-env-changed=SPROUT_UPDATER_ENDPOINT");
println!("cargo:rustc-check-cfg=cfg(sprout_updater_enabled)");

if let Ok(relay_url) = std::env::var("SPROUT_RELAY_URL") {
println!("cargo:rustc-env=SPROUT_DESKTOP_BUILD_RELAY_URL={relay_url}");
Expand All @@ -10,5 +13,18 @@ fn main() {
println!("cargo:rustc-env=SPROUT_DESKTOP_BUILD_RELAY_HTTP={relay_http}");
}

let updater_public_key = std::env::var("SPROUT_UPDATER_PUBLIC_KEY")
.ok()
.map(|value| value.trim().to_string())
.filter(|value| !value.is_empty());
let updater_endpoint = std::env::var("SPROUT_UPDATER_ENDPOINT")
.ok()
.map(|value| value.trim().to_string())
.filter(|value| !value.is_empty());

if updater_public_key.is_some() && updater_endpoint.is_some() {
println!("cargo:rustc-cfg=sprout_updater_enabled");
}

tauri_build::build()
}
2 changes: 2 additions & 0 deletions desktop/src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"websocket:default",
"window-state:default",
"dialog:default",
"updater:allow-check",
"updater:allow-download-and-install",
"process:allow-restart",
"global-shortcut:allow-register",
"global-shortcut:allow-unregister",
Expand Down
13 changes: 13 additions & 0 deletions desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,19 @@ pub fn run() {
.build()
});

// Only register the updater in release builds that were compiled with a
// real updater configuration. Local unsigned builds omit that config and
// should still launch for debugging.
#[cfg(sprout_updater_enabled)]
let builder = if cfg!(debug_assertions) {
builder
} else {
builder.plugin(tauri_plugin_updater::Builder::new().build())
};

#[cfg(not(sprout_updater_enabled))]
let builder = builder;

let shutdown_started = Arc::new(AtomicBool::new(false));
let restore_shutdown_started = Arc::clone(&shutdown_started);
let app = builder
Expand Down
5 changes: 5 additions & 0 deletions desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"csp": null
}
},
"plugins": {
"updater": {
"endpoints": []
}
},
"bundle": {
"active": true,
"targets": "all",
Expand Down
Loading