chore: update agent updater config
This commit is contained in:
@@ -11,7 +11,7 @@ pub mod util;
|
||||
|
||||
use state::AppState;
|
||||
use std::sync::Arc;
|
||||
use tauri::{Listener, Manager, Url, WebviewWindowBuilder};
|
||||
use tauri::{Listener, Manager, WebviewWindowBuilder};
|
||||
use tauri_plugin_updater::UpdaterExt;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
@@ -54,35 +54,23 @@ pub fn run() {
|
||||
|
||||
#[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");
|
||||
let _ = app.handle()
|
||||
.plugin(tauri_plugin_updater::Builder::new() .build());
|
||||
|
||||
if let (Some(pub_key), Some(updater_url)) = (updater_pub_key, updater_url) {
|
||||
let _ = app.handle()
|
||||
.plugin(tauri_plugin_updater::Builder::new() .build());
|
||||
let _ = app.handle()
|
||||
.plugin(tauri_plugin_dialog::init());
|
||||
|
||||
let _ = app.handle()
|
||||
.plugin(tauri_plugin_dialog::init());
|
||||
let updater = app.updater_builder()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let updater_url: Url = updater_url.parse().unwrap();
|
||||
let app_handle_ref = app_handle.clone();
|
||||
|
||||
let updater = app.updater_builder()
|
||||
.pubkey(pub_key)
|
||||
.endpoints(
|
||||
vec![updater_url]
|
||||
)
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let app_handle_ref = app_handle.clone();
|
||||
|
||||
tauri::async_runtime::spawn_blocking(|| {
|
||||
tauri::async_runtime::block_on(async {
|
||||
updater::check_and_install_updates(app_handle_ref, updater).await;
|
||||
})
|
||||
});
|
||||
}
|
||||
tauri::async_runtime::spawn_blocking(|| {
|
||||
tauri::async_runtime::block_on(async {
|
||||
updater::check_and_install_updates(app_handle_ref, updater).await;
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
let app_state = Arc::new(AppState::new(app_handle.clone()));
|
||||
|
||||
Reference in New Issue
Block a user