mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-10 23:07:21 +00:00
Upgraded Tauri to v2.12.5 and fixed the zip security alerts (#1134)
This commit is contained in:
1 parent
bca728ba2c
commit
1c8b6ef774
7 files changed
+502
-433
No files matched your search
@@ -765,6 +765,11 @@ pub async fn install_update() {
|
||||
match cloned_response_option {
|
||||
Some(update_response) => {
|
||||
info!(Source = "Tauri"; "Updater: update is pending!");
|
||||
|
||||
// Once the download is complete, the .NET server and Qdrant Edge stop so that the installer
|
||||
// can replace their files. When the update fails after that, e.g., because the installer
|
||||
// cannot start, the app would remain without both. Restarting it brings them back.
|
||||
let mut servers_stopped = false;
|
||||
let result = update_response.download_and_install(
|
||||
|chunk_length, _content_length| {
|
||||
trace!(Source = "Tauri"; "Updater: downloading chunk of {chunk_length} bytes");
|
||||
@@ -776,6 +781,7 @@ pub async fn install_update() {
|
||||
if is_prod() {
|
||||
stop_dotnet_server();
|
||||
stop_qdrant_edge_database();
|
||||
servers_stopped = true;
|
||||
} else {
|
||||
warn!(Source = "Tauri"; "Development environment detected; do not stop the .NET server.");
|
||||
}
|
||||
@@ -799,6 +805,14 @@ pub async fn install_update() {
|
||||
}
|
||||
Err(e) => {
|
||||
warn!(Source = "Tauri"; "Updater: failed to update: {e}");
|
||||
if servers_stopped {
|
||||
warn!(Source = "Tauri"; "The .NET server and Qdrant Edge are already stopped; try to restart the app now...");
|
||||
if let Some(handle) = app_handle {
|
||||
handle.restart();
|
||||
} else {
|
||||
warn!(Source = "Tauri"; "Cannot restart after the failed update: main window not available.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -128,7 +128,7 @@ async fn share_file_on_platform(_path: PathBuf) -> Result<(), ShareFailure> {
|
||||
|
||||
#[cfg(windows)]
|
||||
async fn share_file_on_platform(path: PathBuf) -> Result<(), ShareFailure> {
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::time::{Duration, Instant};
|
||||
use log::{debug, warn};
|
||||
use windows::ApplicationModel::DataTransfer::{DataPackage, DataRequestedEventArgs, DataTransferManager, ShareCompletedEventArgs};
|
||||
@@ -151,7 +151,7 @@ async fn share_file_on_platform(path: PathBuf) -> Result<(), ShareFailure> {
|
||||
fn provide_shared_file(arguments: &DataRequestedEventArgs, path: &str) -> windows::core::Result<()> {
|
||||
let request = arguments.Request()?;
|
||||
let lookup_started = Instant::now();
|
||||
let file = StorageFile::GetFileFromPathAsync(&HSTRING::from(path))?.get()?;
|
||||
let file = StorageFile::GetFileFromPathAsync(&HSTRING::from(path))?.join()?;
|
||||
let lookup_duration = lookup_started.elapsed();
|
||||
if lookup_duration > DATA_PACKAGE_DEADLINE {
|
||||
warn!(Source = "Share sheet"; "Looking up the shared file took {} ms, but Windows allows only {} ms to provide the data.", lookup_duration.as_millis(), DATA_PACKAGE_DEADLINE.as_millis());
|
||||
@@ -231,7 +231,10 @@ async fn share_file_on_platform(path: PathBuf) -> Result<(), ShareFailure> {
|
||||
// that lock.
|
||||
//
|
||||
let share_started = Instant::now();
|
||||
let mut data_requested = Some(data_requested_sender);
|
||||
|
||||
// Windows accepts only handlers which do not change what they captured, yet the first
|
||||
// request has to take the sender. The cell allows that through a shared reference:
|
||||
let data_requested = Cell::new(Some(data_requested_sender));
|
||||
let handler = TypedEventHandler::<DataTransferManager, DataRequestedEventArgs>::new(move |_, arguments| {
|
||||
let Some(arguments) = arguments.as_ref() else {
|
||||
return Ok(());
|
||||
|
||||
Reference in new issue
Block a user