waybetter/crates/waybetter-host/Cargo.toml
CRT 8dd570147e Safe mode: one run with only the shell working (the app menu, --safe-mode, Shift at launch on Windows)
Host: `safe.rs` is a flag in this process's memory, never written to disk, so the next normal start is back to the owner's setup. While it is on a site tab gets the tab bridge and nothing of the app's page layers: its document-start scripts are `SiteHooks::safe_init_scripts` (default: the bridge alone) instead of `init_scripts`; `site_page_loaded`, `tab_placed` and `tab_background` are not called; `page_scripts` is empty; `eval_in_site_tabs` does nothing. So no page runtime, plugins, theme, custom CSS, feature flags, fixes, hotfix data or words reach a page: the site runs as in a browser, and only the shell is the app's. It starts from the launch argument `--safe-mode` (for when the interface itself is broken), from Shift held while the app starts (Windows), or from the shell: `safe_mode_get` / `safe_mode_set {on}` (shell-only), where a switch rebuilds every tab webview (profiles marked stale, `tabs-rebuild` asks the shell for its layout) so document-start scripts change too. Tests: the argument, the flag, and that app.rs and host.rs gate every layer.

Frame: the app menu's "Restart in safe mode…" says what it does before anything reloads; while on, the titlebar shows an amber "Safe mode | Leave" chip (one click leaves) and the row reads "Leave safe mode"; the chrome drops its theme (and pane themes) and takes it back on leaving, without touching the first-frame cache. `features.safeMode` (on by default).
2026-09-30 23:13:03 +07:00

83 lines
4.5 KiB
TOML

[package]
name = "waybetter-host"
version = "0.1.0"
description = "wayBetter native host: one window, a trusted shell webview and one child webview per site tab"
license = "GPL-3.0-or-later"
edition = "2021"
rust-version = "1.88"
publish = false
[lib]
name = "waybetter_host"
path = "src/lib.rs"
[features]
default = []
# Tauri glue (webview helpers, window system menu). Off for headless tests.
tauri = ["dep:tauri", "dep:tauri-plugin-notification", "dep:tauri-plugin-updater", "dep:tokio", "dep:arboard", "dep:clipboard-win", "dep:windows", "dep:webview2-com", "dep:gtk", "dep:objc2-app-kit"]
# Store downloads (`store::net`): allow-listed https, no redirects or cookies, size caps.
net = ["dep:reqwest", "dep:rustls"]
# The whole app (`app::run_app`): window, shell and tab webviews, the generic commands and the
# Tauri plugins every wayBetter app registers.
app = ["tauri", "dep:tauri-plugin-single-instance", "dep:tauri-plugin-deep-link", "dep:tauri-plugin-window-state", "dep:tauri-plugin-opener", "dep:tauri-plugin-process", "dep:tauri-plugin-dialog"]
# macOS: the shell webview is transparent (it can rise above the tabs for its overlays); needs
# `"macOSPrivateApi": true` in the app's tauri.conf.json. Other platforms always are.
macos-private-api = ["tauri?/macos-private-api"]
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
url = "2"
sha2 = "0.10"
chrono = { version = "0.4", default-features = false, features = ["clock"] }
minisign-verify = "0.2"
base64 = "0.22"
# PNG encoding of clipboard images (media::encode_png).
image = { version = "0.25", default-features = false, features = ["png"] }
# Store catalog signatures (Ed25519 over the exact catalog bytes).
ed25519-dalek = "2"
# The OS language preference (first run, "Follow system"); no dependencies of its own on desktop.
sys-locale = "0.3"
# Encrypted settings sync (a folder the owner picks): Argon2id key from the passphrase,
# XChaCha20-Poly1305 per snapshot. Pure Rust (RustCrypto), no server, no account.
argon2 = { version = "0.5", default-features = false, features = ["alloc"] }
chacha20poly1305 = { version = "0.10", default-features = false, features = ["alloc"] }
getrandom = "0.2"
tauri = { version = "2", features = ["unstable"], optional = true }
# Native OS notifications (alerts::notify); the app registers the plugin.
tauri-plugin-notification = { version = "2", optional = true }
# Signed native updates (updater, with `net`); the app registers the plugin with its endpoint and key.
tauri-plugin-updater = { version = "2", optional = true }
# The updater loop's waits.
tokio = { version = "1", features = ["time"], optional = true }
# Opt-in local clipboard history (media::clipboard), polled natively.
arboard = { version = "3", optional = true }
# `app`: single-instance (a second launch focuses the window and hands over its link), install
# links, window geometry, external links, relaunch after an update, and native dialogs.
tauri-plugin-single-instance = { version = "2", optional = true, features = ["deep-link"] }
tauri-plugin-deep-link = { version = "2", optional = true }
tauri-plugin-window-state = { version = "2", optional = true }
tauri-plugin-opener = { version = "2", optional = true }
tauri-plugin-process = { version = "2", optional = true }
tauri-plugin-dialog = { version = "2", optional = true }
reqwest = { version = "0.13", default-features = false, features = ["rustls-no-provider"], optional = true }
rustls = { version = "0.23", default-features = false, features = ["ring"], optional = true }
[target.'cfg(windows)'.dependencies]
windows = { version = "0.62", features = ["Win32_Foundation", "Win32_System_Com", "Win32_System_Threading", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"], optional = true }
# The WebView2 COM interfaces wry already links (hidden tabs: low memory target).
webview2-com = { version = "0.39", optional = true }
# Clipboard sequence number (skip unchanged polls) and password-manager exclusion formats.
clipboard-win = { version = "5", optional = true }
[target.'cfg(target_os = "linux")'.dependencies]
# The GTK version tauri/wry link: child webviews are laid out in a GtkOverlay (host::place_child).
gtk = { version = "0.18", optional = true }
[target.'cfg(target_os = "macos")'.dependencies]
# The AppKit bindings wry already links (host::raise_shell re-orders the shell's WKWebView).
objc2-app-kit = { version = "0.3", optional = true, default-features = false, features = ["std", "NSGraphics", "NSResponder", "NSView", "NSWindow"] }
[dev-dependencies]
tempfile = "3"
tokio = { version = "1", features = ["rt"] }