chore: update agent updater config

This commit is contained in:
Andrew Bastin
2024-10-03 22:20:45 +05:30
parent cd25ba7d92
commit 025a8fc0cb
2 changed files with 23 additions and 27 deletions

View File

@@ -11,7 +11,7 @@ pub mod util;
use state::AppState; use state::AppState;
use std::sync::Arc; use std::sync::Arc;
use tauri::{Listener, Manager, Url, WebviewWindowBuilder}; use tauri::{Listener, Manager, WebviewWindowBuilder};
use tauri_plugin_updater::UpdaterExt; use tauri_plugin_updater::UpdaterExt;
use tokio_util::sync::CancellationToken; use tokio_util::sync::CancellationToken;
@@ -54,24 +54,13 @@ pub fn run() {
#[cfg(desktop)] #[cfg(desktop)]
{ {
// We use env variables to define the pubkey for installer to check
let updater_pub_key = option_env!("UPDATER_PUB_KEY");
let updater_url = option_env!("UPDATER_URL");
if let (Some(pub_key), Some(updater_url)) = (updater_pub_key, updater_url) {
let _ = app.handle() let _ = app.handle()
.plugin(tauri_plugin_updater::Builder::new() .build()); .plugin(tauri_plugin_updater::Builder::new() .build());
let _ = app.handle() let _ = app.handle()
.plugin(tauri_plugin_dialog::init()); .plugin(tauri_plugin_dialog::init());
let updater_url: Url = updater_url.parse().unwrap();
let updater = app.updater_builder() let updater = app.updater_builder()
.pubkey(pub_key)
.endpoints(
vec![updater_url]
)
.build() .build()
.unwrap(); .unwrap();
@@ -82,7 +71,6 @@ pub fn run() {
updater::check_and_install_updates(app_handle_ref, updater).await; updater::check_and_install_updates(app_handle_ref, updater).await;
}) })
}); });
}
}; };
let app_state = Arc::new(AppState::new(app_handle.clone())); let app_state = Arc::new(AppState::new(app_handle.clone()));

View File

@@ -39,5 +39,13 @@
"icons/icon.ico" "icons/icon.ico"
], ],
"createUpdaterArtifacts": true "createUpdaterArtifacts": true
},
"plugins" : {
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDI1MjZGQTNFRjA1NEFFMDEKUldRQnJsVHdQdm9tSlNMLzNxKzJOM24wdC9SYUZHckFpeUZoWW1xb1dtdVpSa2dWMkRGdkV2WmsK",
"endpoints": [
"https://releases.hoppscotch.com/hoppscotch-agent.json"
]
}
} }
} }