mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-23 03:56:33 +00:00
Upgraded Tauri to v2.12.7 and the Rust dependencies (#1219)
This commit is contained in:
1 parent
f96025529a
commit
2772612c00
11 files changed
+1968
-1973
No files matched your search
@@ -54,7 +54,7 @@ env:
|
||||
# The Tauri CLI which bundles the app, exactly this version on every platform. Keep it at the minor
|
||||
# version of the tauri crate in runtime/Cargo.toml. The version also names the cache of the CLI, so
|
||||
# changing it installs the new CLI once on each platform and caches it from then on:
|
||||
TAURI_CLI_VERSION: "2.12.4"
|
||||
TAURI_CLI_VERSION: "2.12.6"
|
||||
|
||||
jobs:
|
||||
determine_run_mode:
|
||||
|
||||
@@ -35,5 +35,8 @@
|
||||
- Fixed the settings of the security audit for assistant plugins, which you could change even when your organization had locked them through a configuration plugin. They now show the lock, like all other settings your organization manages.
|
||||
- Fixed the automatic security audit of assistant plugins when no model was set for it: you got two error messages for each plugin, again whenever you opened the assistants or plugins page. Now AI Studio tells you once, and the settings of the security audit show a warning.
|
||||
- Fixed the AI-based data validation of classic RAG, which kept passages that the AI had judged as not fitting your question. Now the AI only gets the passages that fit. When the check fails for a passage, AI Studio keeps it, and when it fails for all of them, AI Studio tells you.
|
||||
- Upgraded several libraries to improve security.
|
||||
- Upgraded Tauri to v2.12.7.
|
||||
- Upgraded PDFium to v158.0.8125.0.
|
||||
- Upgraded to Rust v1.100.0.
|
||||
- Upgraded to .NET v10.0.15.
|
||||
@@ -17,7 +17,7 @@ Therefore, we cannot provide a static list here that is valid for all Linux syst
|
||||
Regardless of whether you want to build the app locally for yourself (not trusting the pre-built binaries) or test your changes before creating a PR, you have to run the following commands at least once:
|
||||
|
||||
1. Open a terminal.
|
||||
2. Install the Tauri CLI by running `cargo install tauri-cli --version 2.12.4 --locked`.
|
||||
2. Install the Tauri CLI by running `cargo install tauri-cli --version 2.12.6 --locked`.
|
||||
3. Navigate to the `/app/Build` directory within the repository.
|
||||
4. Run `dotnet run build` to build the entire app.
|
||||
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
10.0.15 (commit 8e0f8ed231)
|
||||
1.100.0 (commit 0ef1bc386)
|
||||
9.12.0
|
||||
2.12.5
|
||||
2.12.7
|
||||
9d1768e2f40, release
|
||||
148.0.7763.0
|
||||
158.0.8125.0
|
||||
0.8.0
|
||||
@@ -89,6 +89,20 @@ blocking handler can hold up the whole app. Therefore:
|
||||
- `runtime_api::test_support::assert_runtime_stays_free` tests a handler which waits for a lock. Run
|
||||
such a test with `#[tokio::test(flavor = "multi_thread", worker_threads = 1)]`.
|
||||
|
||||
**AI Studio restarts itself only through `own_restart.rs`.** Since Tauri 2.12.6, a restart on macOS starts
|
||||
the new instance in the background, so that it takes no focus away from the app the user works in. AI
|
||||
Studio restarts itself only on behalf of the user, after an update or the restore of a backup, and the
|
||||
user then expects to see the app again. The new instance cannot bring its window to the front by itself:
|
||||
macOS lets an app become active only when the active app allows it. Therefore:
|
||||
|
||||
- Call `own_restart::restart` or `own_restart::request_restart`, never `AppHandle::restart` or
|
||||
`AppHandle::request_restart` directly. Both note that AI Studio restarts itself.
|
||||
- On `RunEvent::Exit`, which comes right before Tauri starts the new instance, `start_new_instance_in_front`
|
||||
lets the old instance, which is still the active app, start the new one in the foreground and ends the
|
||||
process.
|
||||
- Call `own_restart::restart` outside the main thread only. On the main thread, Tauri restarts the app at
|
||||
once, without `RunEvent::Exit`, and therefore in the background.
|
||||
|
||||
**The runtime builds with the Rust of the Flatpak, too.** Flathub builds the Flatpak with its own Rust,
|
||||
the extension `org.freedesktop.Sdk.Extension.rust-stable` of the branch named by
|
||||
`FLATPAK_FREEDESKTOP_VERSION` in the pipeline, and only after a release. That Rust often lags behind the
|
||||
|
||||
Generated
+1754
-1935
File diff suppressed because it is too large.
Load diff
+36
-31
@@ -14,41 +14,41 @@ description = "MindWork AI Studio"
|
||||
authors = ["Thorsten Sommer"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.7.4", features = [] }
|
||||
tauri-build = { version = "2.7.6", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2.12.5", features = [] }
|
||||
tauri = { version = "2.12.7", features = [] }
|
||||
tauri-plugin-window-state = { version = "2.5.0" }
|
||||
tauri-plugin-shell = "2.6.0"
|
||||
tauri-plugin-dialog = "2.8.4"
|
||||
tauri-plugin-opener = "2.7.2"
|
||||
tauri-plugin-opener = "2.7.3"
|
||||
tauri-plugin-single-instance = "2"
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
serde_json = "1.0.150"
|
||||
keyring-core = "1.0.0"
|
||||
arboard = { version = "3.6.1", features = ["wayland-data-control"] }
|
||||
tokio = { version = "1.52.3", features = ["rt", "rt-multi-thread", "macros", "process"] }
|
||||
tokio-stream = { version = "0.1.18", features = ["sync"] }
|
||||
futures = "0.3.32"
|
||||
serde = { version = "1.0.229", features = ["derive"] }
|
||||
serde_json = "1.0.154"
|
||||
keyring-core = "1.1.0"
|
||||
arboard = { version = "3.7.0", features = ["wayland-data-control"] }
|
||||
tokio = { version = "1.54.1", features = ["rt", "rt-multi-thread", "macros", "process"] }
|
||||
tokio-stream = { version = "0.1.19", features = ["sync"] }
|
||||
futures = "0.3.34"
|
||||
async-stream = "0.3.6"
|
||||
flexi_logger = "0.31.9"
|
||||
chrono = "0.4.44"
|
||||
flexi_logger = "0.31.10"
|
||||
chrono = "0.4.45"
|
||||
dirs = "6.0.0"
|
||||
log = { version = "0.4.33", features = ["kv"] }
|
||||
log = { version = "0.4.35", features = ["kv"] }
|
||||
once_cell = "1.21.4"
|
||||
axum = { version = "0.8.9", features = ["http2", "json", "query", "tokio"] }
|
||||
axum-server = { version = "0.8.0", features = ["tls-rustls"] }
|
||||
rustls = { version = "0.23.46", default-features = false, features = ["aws_lc_rs"] }
|
||||
rand = "0.10.2"
|
||||
rand = "0.10.4"
|
||||
rand_chacha = "0.10.0"
|
||||
subtle = "2.6.1"
|
||||
base64 = "0.22.1"
|
||||
aes = "0.9.1"
|
||||
aes = "0.9.4"
|
||||
cbc = "0.2.1"
|
||||
pbkdf2 = "0.13.0"
|
||||
hmac = "0.13.0"
|
||||
sha2 = "0.11.0"
|
||||
rcgen = { version = "0.14.8", features = ["pem"] }
|
||||
sha2 = "0.11.1"
|
||||
rcgen = { version = "0.14.10", features = ["pem"] }
|
||||
|
||||
# The readers are needed to identify a file by its content instead of its extension: zip covers
|
||||
# OOXML and ODF, cfb the legacy Office formats, txt tells actual text from binary data, and exe
|
||||
@@ -60,17 +60,22 @@ file-format = { version = "0.29.0", features = ["reader-zip", "reader-cfb", "rea
|
||||
# umlauts are single bytes and therefore invalid UTF-8. chardetng guesses the encoding, encoding_rs
|
||||
# decodes it.
|
||||
chardetng = "1.0.0"
|
||||
encoding_rs = "0.8.35"
|
||||
encoding_rs = "0.8.44"
|
||||
|
||||
symphonia = { version = "0.6", default-features = false, features = ["aac", "aiff", "alac", "caf", "flac", "isomp4", "mkv", "mp1", "mp2", "mp3", "ogg", "pcm", "vorbis", "wav"] }
|
||||
ropus = "=0.12.18"
|
||||
rubato = { version = "4", default-features = false, features = ["fft_resampler"] }
|
||||
webm-iterable = "0.6.4"
|
||||
calamine = "0.37.0"
|
||||
pdfium-render = "0.9.1"
|
||||
|
||||
# pdfium-render binds the functions of a certain PDFium version when it loads the library, and refuses a
|
||||
# library which lacks one of them. By default, that is the newest PDFium it knows, which changes with
|
||||
# updates of the crate. Therefore, the feature names the Chromium revision of the PDFium we ship, line 10
|
||||
# of metadata.txt; the test `binds_the_api_of_the_shipped_pdfium` in pdfium.rs compares both.
|
||||
pdfium-render = { version = "0.9.6", default-features = false, features = ["pdfium_8125", "image_latest", "thread_safe"] }
|
||||
sys-locale = "0.3.2"
|
||||
whoami = "2.1.2"
|
||||
cfg-if = "1.0.4"
|
||||
whoami = "2.1.3"
|
||||
cfg-if = "1.0.5"
|
||||
pptx-to-md = "2.0.0"
|
||||
docx-to-md = "0.2.0"
|
||||
|
||||
@@ -85,21 +90,21 @@ typed-path = "0.12.4"
|
||||
tempfile = "3.27.0"
|
||||
strum_macros = "0.28.0"
|
||||
sysinfo = "0.39.6"
|
||||
bytes = "1.12.1"
|
||||
bytes = "1.12.2"
|
||||
qdrant-edge = "0.8.0"
|
||||
|
||||
# Prompt-injection detection. `regex` gives us linear-time matching without backtracking, so
|
||||
# a hostile document cannot make a scan blow up, and `aho-corasick` matches the ~1600 fixed
|
||||
# phrases in one pass no matter how long that list grows.
|
||||
regex = "1.13.1"
|
||||
regex = "1.13.2"
|
||||
aho-corasick = "1.1.5"
|
||||
toml = "1.1.4"
|
||||
toml = "1.2.2"
|
||||
image = { version = "0.25.10", default-features = false, features = ["jpeg", "png", "webp", "gif", "bmp", "tiff"] }
|
||||
tokenizers = "0.23.1"
|
||||
tokenizers = "0.23.2"
|
||||
|
||||
[dev-dependencies]
|
||||
# Sends requests through the runtime API router in tests, without starting a server.
|
||||
tower = { version = "0.5.2", features = ["util"] }
|
||||
tower = { version = "0.5.3", features = ["util"] }
|
||||
|
||||
[patch.crates-io]
|
||||
# Issue: This repo was not updated since 2020. The rand crate was outdated. We patched it to use a newer version of rand.
|
||||
@@ -118,15 +123,15 @@ windows = { version = "=0.62.2", features = ["ApplicationModel_DataTransfer", "F
|
||||
windows-collections = "=0.3.2"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
apple-native-keyring-store = { version = "1.0.0", features = ["keychain"] }
|
||||
objc2 = "0.6.3"
|
||||
apple-native-keyring-store = { version = "1.0.2", features = ["keychain"] }
|
||||
objc2 = "0.6.5"
|
||||
objc2-app-kit = { version = "0.3.2", features = ["NSResponder", "NSSharingService", "NSView", "NSWorkspace"] }
|
||||
objc2-foundation = { version = "0.3.2", features = ["NSArray", "NSBundle", "NSGeometry", "NSString", "NSURL"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
ashpd = { version = "0.13.12", default-features = false, features = ["tokio", "open_uri", "global_shortcuts"] }
|
||||
dbus-secret-service-keyring-store = { version = "1.0.0", features = ["crypto-rust"] }
|
||||
dbus-secret-service = "4.1.0"
|
||||
ashpd = { version = "0.13.13", default-features = false, features = ["tokio", "open_uri", "global_shortcuts"] }
|
||||
dbus-secret-service-keyring-store = { version = "1.0.1", features = ["crypto-rust"] }
|
||||
dbus-secret-service = "4.2.0"
|
||||
gtk = "0.18"
|
||||
webkit2gtk = { version = "2.0.2", features = ["v2_8"] }
|
||||
|
||||
|
||||
@@ -325,6 +325,12 @@ pub fn start_tauri(tauri_context: tauri::Context<tauri::Wry>) {
|
||||
info!(Source = "Tauri"; "Run event: Tauri app is ready.");
|
||||
}
|
||||
|
||||
// When AI Studio restarts itself, Tauri would start the new instance in the background next:
|
||||
#[cfg(target_os = "macos")]
|
||||
RunEvent::Exit => {
|
||||
crate::own_restart::start_new_instance_in_front();
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
@@ -1000,7 +1006,7 @@ pub async fn install_update() {
|
||||
|
||||
if is_prod() {
|
||||
if let Some(handle) = app_handle {
|
||||
handle.restart();
|
||||
crate::own_restart::restart(&handle);
|
||||
} else {
|
||||
warn!(Source = "Tauri"; "Cannot restart after update: main window not available.");
|
||||
}
|
||||
@@ -1013,7 +1019,7 @@ pub async fn install_update() {
|
||||
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();
|
||||
crate::own_restart::restart(&handle);
|
||||
} else {
|
||||
warn!(Source = "Tauri"; "Cannot restart after the failed update: main window not available.");
|
||||
}
|
||||
@@ -1104,7 +1110,7 @@ pub async fn restart_app() -> Json<AppRestartResponse> {
|
||||
info!(Source = "Tauri"; "Controlled app restart was requested by the UI.");
|
||||
tauri::async_runtime::spawn(async move {
|
||||
time::sleep(Duration::from_millis(50)).await;
|
||||
app_handle.request_restart();
|
||||
crate::own_restart::request_restart(&app_handle);
|
||||
});
|
||||
|
||||
Json(AppRestartResponse {
|
||||
@@ -1562,6 +1568,7 @@ mod tests {
|
||||
let approved = tauri::Url::parse("http://127.0.0.1:12345/").unwrap();
|
||||
for address in [
|
||||
"file:///etc/passwd",
|
||||
"about:blank",
|
||||
"javascript:alert(1)",
|
||||
"data:text/html,hello",
|
||||
"tauri://localhost/index.html",
|
||||
|
||||
@@ -29,3 +29,4 @@ pub mod tokenizer;
|
||||
mod file_actions;
|
||||
pub mod global_shortcuts;
|
||||
pub mod interface_zoom;
|
||||
mod own_restart;
|
||||
@@ -0,0 +1,109 @@
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use tauri::AppHandle;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use std::path::Path;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use log::{info, warn};
|
||||
|
||||
/// Whether AI Studio restarts itself, see `restart` and `request_restart`.
|
||||
static RESTART_REQUESTED: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
/// Restarts the app at once, see `AppHandle::restart`, and shows its window in the foreground again.
|
||||
///
|
||||
/// On macOS, Tauri starts the new instance in the background, so that a restart in the background
|
||||
/// takes no focus away from the app the user works in. AI Studio restarts itself only on behalf of
|
||||
/// the user, e.g., to finish an update, who then expects to see the app again. Therefore, AI Studio
|
||||
/// starts the new instance itself, see `start_new_instance_in_front`.
|
||||
///
|
||||
/// Call it outside the main thread only: there, Tauri restarts the app at once, without the event
|
||||
/// `RunEvent::Exit`, and therefore in the background.
|
||||
pub fn restart(app_handle: &AppHandle) -> ! {
|
||||
RESTART_REQUESTED.store(true, Ordering::SeqCst);
|
||||
app_handle.restart()
|
||||
}
|
||||
|
||||
/// Requests a restart of the app, see `AppHandle::request_restart`, and shows its window in the
|
||||
/// foreground again, see `restart`.
|
||||
pub fn request_restart(app_handle: &AppHandle) {
|
||||
RESTART_REQUESTED.store(true, Ordering::SeqCst);
|
||||
app_handle.request_restart();
|
||||
}
|
||||
|
||||
/// Starts the new instance in the foreground and ends this one, when AI Studio restarts itself.
|
||||
///
|
||||
/// Call it on `RunEvent::Exit`, which reaches the app right before Tauri starts the new instance in
|
||||
/// the background. The new instance cannot bring its window to the front by itself: macOS lets an app
|
||||
/// become active only when the active app allows it. The old instance, however, is still the active
|
||||
/// app, so the new instance it starts comes to the front.
|
||||
///
|
||||
/// Outside an app bundle, as in a development build, and when the start fails, Tauri restarts the
|
||||
/// app as usual.
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn start_new_instance_in_front() {
|
||||
use std::process::{exit, Command, Stdio};
|
||||
|
||||
if !RESTART_REQUESTED.load(Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
|
||||
let Ok(binary) = std::env::current_exe() else {
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(bundle) = app_bundle(&binary) else {
|
||||
return;
|
||||
};
|
||||
|
||||
info!(Source = "Tauri"; "Starting the new instance of AI Studio in the foreground.");
|
||||
let result = Command::new("/usr/bin/open")
|
||||
.arg("-n")
|
||||
.arg(bundle)
|
||||
.arg("--args")
|
||||
.args(std::env::args_os().skip(1))
|
||||
.stdin(Stdio::null())
|
||||
.output();
|
||||
|
||||
match result {
|
||||
Ok(output) if output.status.success() => {
|
||||
log::logger().flush();
|
||||
exit(0);
|
||||
},
|
||||
|
||||
Ok(output) => warn!(Source = "Tauri"; "Failed to start the new instance in the foreground ({}), so Tauri starts it in the background: {}", output.status, String::from_utf8_lossy(&output.stderr).trim()),
|
||||
Err(error) => warn!(Source = "Tauri"; "Failed to start the new instance in the foreground, so Tauri starts it in the background: {error}"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the app bundle which contains the binary, such as `/Applications/X.app` for
|
||||
/// `/Applications/X.app/Contents/MacOS/x`.
|
||||
#[cfg(target_os = "macos")]
|
||||
fn app_bundle(binary: &Path) -> Option<&Path> {
|
||||
let macos_directory = binary.parent()?;
|
||||
let contents_directory = macos_directory.parent()?;
|
||||
if macos_directory.file_name()? != "MacOS" || contents_directory.file_name()? != "Contents" {
|
||||
return None;
|
||||
}
|
||||
|
||||
contents_directory.parent()
|
||||
}
|
||||
|
||||
#[cfg(all(test, target_os = "macos"))]
|
||||
mod tests {
|
||||
use std::path::Path;
|
||||
use super::app_bundle;
|
||||
|
||||
#[test]
|
||||
fn finds_the_bundle_of_a_binary_inside_one() {
|
||||
let binary = Path::new("/Applications/MindWork AI Studio.app/Contents/MacOS/mindwork-ai-studio");
|
||||
assert_eq!(app_bundle(binary), Some(Path::new("/Applications/MindWork AI Studio.app")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn finds_no_bundle_for_a_binary_outside_one() {
|
||||
assert_eq!(app_bundle(Path::new("/Users/placeholder/runtime/target/debug/mindwork-ai-studio")), None);
|
||||
assert_eq!(app_bundle(Path::new("/Applications/MindWork AI Studio.app/Contents/Resources/mindwork-ai-studio")), None);
|
||||
assert_eq!(app_bundle(Path::new("/mindwork-ai-studio")), None);
|
||||
}
|
||||
}
|
||||
@@ -93,3 +93,40 @@ fn load_pdfium() -> Result<Pdfium, String> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
/// pdfium-render refuses a PDFium library which lacks a function of the version its feature names.
|
||||
/// Its default features name the newest PDFium it knows, which changes with updates of the crate,
|
||||
/// while we ship the PDFium of line 10 of metadata.txt. A mismatch makes every PDF fail to open,
|
||||
/// and no other test notices, since none of them loads the library.
|
||||
#[test]
|
||||
fn binds_the_api_of_the_shipped_pdfium() {
|
||||
let pdfium_version = include_str!("../../metadata.txt").lines().nth(9).expect("metadata.txt must name the PDFium version in line 10");
|
||||
let chromium_revision = pdfium_version.trim().split('.').nth(2).expect("the PDFium version must have the form 148.0.7763.0");
|
||||
let expected_feature = format!("pdfium_{chromium_revision}");
|
||||
|
||||
let manifest: toml::Table = toml::from_str(include_str!("../Cargo.toml")).expect("Cargo.toml must be valid TOML");
|
||||
let dependency = &manifest["dependencies"]["pdfium-render"];
|
||||
assert_eq!(
|
||||
dependency.get("default-features").and_then(toml::Value::as_bool),
|
||||
Some(false),
|
||||
"pdfium-render must not use its default features: they bind the newest PDFium the crate knows, not the one we ship.",
|
||||
);
|
||||
|
||||
let api_features: Vec<&str> = dependency.get("features")
|
||||
.and_then(toml::Value::as_array)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter_map(toml::Value::as_str)
|
||||
.filter(|feature| feature.strip_prefix("pdfium_").is_some_and(|version| version == "latest" || version.chars().all(|c| c.is_ascii_digit())))
|
||||
.collect();
|
||||
|
||||
assert_eq!(
|
||||
api_features,
|
||||
[expected_feature.as_str()],
|
||||
"The feature of pdfium-render must name the PDFium version in metadata.txt. Change both together.",
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user