Host: Google Fonts commands (gfonts_*) are served for every app that sets AppConfig::with_fonts; SiteHooks::fonts_changed; commands::GFONTS, testkit::assert_fonts_guards

This commit is contained in:
CRTkafa 2026-10-01 04:11:46 +07:00
parent 49aadd1653
commit 5e950f4f62
5 changed files with 105 additions and 2 deletions

View file

@ -637,7 +637,9 @@ pub fn rebuild_tabs(app: &AppHandle) {
#[tauri::command]
async fn shell_focus(webview: Webview) -> Result<(), String> {
shell_only(&webview)?;
webview.set_focus().map_err(|error| format!("FOCUS: {error}"))
let result = webview.set_focus().map_err(|error| format!("FOCUS: {error}"));
crate::diag::log("host", &format!("shell_focus -> {}", if result.is_ok() { "ok" } else { "error" }));
result
}
/// The shell calls this after its first DOM commit, so startup never exposes an empty webview.
@ -669,7 +671,24 @@ async fn shell_raise(webview: Webview, app: AppHandle, on: bool) -> Result<bool,
host_state(&app).hooks.shell_raised(&app, on);
}
SHELL_RAISED.store(on, Ordering::SeqCst);
Ok(host::raise_shell(&webview, on))
let supported = host::raise_shell(&webview, on);
crate::diag::log("host", &format!("shell_raise on={on} -> supported={supported}"));
Ok(supported)
}
/// Whether focus and layering diagnostics are on for this run ([`crate::diag`]).
#[tauri::command]
async fn diag_get(webview: Webview) -> Result<bool, String> {
shell_only(&webview)?;
Ok(crate::diag::active())
}
/// One diagnostic line from the shell (plain short text; nothing is written unless diagnostics are on).
#[tauri::command]
async fn diag_log(webview: Webview, line: String) -> Result<(), String> {
shell_only(&webview)?;
crate::diag::log("shell", &line);
Ok(())
}
#[tauri::command]
@ -1056,6 +1075,8 @@ fn host_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 's
tab_find,
safe_mode_get,
safe_mode_set,
diag_get,
diag_log,
open_external_url,
shell_focus,
shell_ready,
@ -1213,6 +1234,10 @@ impl App {
crate::media_commands::init(&handle);
// Safe mode for this run: the launch argument, or Shift held while starting (Windows).
crate::safe::set(crate::safe::at_launch(std::env::args(), host::shift_held()));
// Focus and layering diagnostics for this run: `--diag` or WAYBETTER_DIAG=1 (app log folder, diag.log).
if crate::diag::asked(std::env::args(), std::env::var(crate::diag::ENV).ok().as_deref()) {
crate::diag::start(handle.path().app_log_dir().ok());
}
#[cfg(debug_assertions)]
crate::devloop::start(&handle);
if let Some(setup) = setup {