fix(helper): уточнены замеры PoC и поведение выхода

- prevent_exit только при code.is_none(): иначе app.exit(0)
  блокировался и процесс добивал скрипт
- замер ведётся по PrivateBytes — WorkingSetPrivate у простаивающих
  процессов занижен Windows
- capability окон с пустым permissions: команды приложения не входят
  в ACL, плагинов нет
- CSP дополнен connect-src для IPC по кастомному протоколу (Linux/macOS)
- first_paint после двойного requestAnimationFrame, лог замера
  откатывается в temp при недоступности каталога exe

Refs: 1.8.1, 1.8.2
This commit is contained in:
TMSH committed 2026-11-09 23:21:14 +03:00
1 parent 4abe485e73
commit 82eb829851
5 files changed
+84 -53

No files matched your search

@@ -1,9 +1,7 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "helper-windows",
"description": "Окна Помощника, создаваемые динамически из меню трея",
"description": "Окна Помощника, создаваемые динамически из меню трея. Команды приложения не входят в ACL, плагинов нет — разрешений не нужно",
"windows": ["win-*"],
"permissions": [
"core:default"
]
"permissions": []
}
+20 -12
View File
@@ -143,16 +143,21 @@ fn spawn_measure_scenario(app: AppHandle) {
}
fn measure_log_file() -> Option<File> {
let dir = std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|d| d.to_path_buf()))
.unwrap_or_else(std::env::temp_dir);
OpenOptions::new()
.create(true)
.write(true)
.truncate(true)
.open(dir.join("helper-tray-poc.measure.log"))
let exe_dir = std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|d| d.to_path_buf()));
for dir in [exe_dir, Some(std::env::temp_dir())].into_iter().flatten() {
match OpenOptions::new()
.create(true)
.write(true)
.truncate(true)
.open(dir.join("helper-tray-poc.measure.log"))
{
Ok(f) => return Some(f),
Err(e) => eprintln!("не удалось открыть лог в {}: {}", dir.display(), e),
}
}
None
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
@@ -181,10 +186,13 @@ pub fn run() {
})
.build(tauri::generate_context!())
.expect("error while building tauri application");
// Трею нельзя завершаться при закрытии последнего окна;
// app.exit(0) при этом продолжает работать.
// Трею нельзя завершаться при закрытии последнего окна (code == None);
// при программном выходе code задан — prevent_exit не вызываем,
// иначе app.exit(0) был бы заблокирован.
app.run(|_handle, event| {
if let tauri::RunEvent::ExitRequested { api, .. } = event {
if let tauri::RunEvent::ExitRequested { code, api, .. } = event
&& code.is_none()
{
api.prevent_exit();
}
});
+1 -1
View File
@@ -12,7 +12,7 @@
"app": {
"windows": [],
"security": {
"csp": "default-src 'self'; style-src 'self' 'unsafe-inline'"
"csp": "default-src 'self'; style-src 'self' 'unsafe-inline'; connect-src ipc: http://ipc.localhost"
}
},
"bundle": {