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 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()));

View File

@@ -28,7 +28,7 @@
"csp": null
}
},
"bundle": {
"bundle": {
"active": true,
"targets": "all",
"icon": [
@@ -39,5 +39,13 @@
"icons/icon.ico"
],
"createUpdaterArtifacts": true
},
"plugins" : {
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDI1MjZGQTNFRjA1NEFFMDEKUldRQnJsVHdQdm9tSlNMLzNxKzJOM24wdC9SYUZHckFpeUZoWW1xb1dtdVpSa2dWMkRGdkV2WmsK",
"endpoints": [
"https://releases.hoppscotch.com/hoppscotch-agent.json"
]
}
}
}