From 75d507ba8c3c885433a5a0674b1c983c97b08a8f Mon Sep 17 00:00:00 2001 From: CRT Date: Thu, 1 Oct 2026 16:05:27 +0700 Subject: [PATCH] host: AlertsConfig and ThemeConfig live in ungated modules, so the host compiles and tests without the tauri feature --- crates/waybetter-host/src/alerts.rs | 10 ++++++++++ crates/waybetter-host/src/alerts_commands.rs | 9 +-------- crates/waybetter-host/src/theme.rs | 12 ++++++++++++ crates/waybetter-host/src/theme_commands.rs | 13 ++----------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/crates/waybetter-host/src/alerts.rs b/crates/waybetter-host/src/alerts.rs index d3a1708..0c040b5 100644 --- a/crates/waybetter-host/src/alerts.rs +++ b/crates/waybetter-host/src/alerts.rs @@ -7,6 +7,16 @@ use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet, VecDeque}; use std::time::{Duration, Instant}; +/// What an app declares about its alerts for the host's settings commands +/// ([`crate::alerts_commands`]): where they are saved and how the page runtime takes the keywords +/// (`window...set(keywords)`, else parked in `window.`). +#[derive(Clone, Copy, Debug)] +pub struct AlertsConfig { + pub file: &'static str, + pub member: &'static str, + pub queue: &'static str, +} + pub const MAX_KEYWORDS: usize = 32; pub const MIN_KEYWORD_CHARS: usize = 2; pub const MAX_KEYWORD_CHARS: usize = 64; diff --git a/crates/waybetter-host/src/alerts_commands.rs b/crates/waybetter-host/src/alerts_commands.rs index a27ea06..b26fc62 100644 --- a/crates/waybetter-host/src/alerts_commands.rs +++ b/crates/waybetter-host/src/alerts_commands.rs @@ -11,14 +11,7 @@ use crate::tabs::deliver_script; use std::sync::{Mutex, MutexGuard}; use tauri::{AppHandle, Manager, Webview}; -/// What an app declares about its alerts: where they are saved and how the page runtime takes the -/// keywords (`window...set(keywords)`, else parked in `window.`). -#[derive(Clone, Copy, Debug)] -pub struct AlertsConfig { - pub file: &'static str, - pub member: &'static str, - pub queue: &'static str, -} +pub use crate::alerts::AlertsConfig; struct AlertState(Mutex); diff --git a/crates/waybetter-host/src/theme.rs b/crates/waybetter-host/src/theme.rs index 9e49b21..095a677 100644 --- a/crates/waybetter-host/src/theme.rs +++ b/crates/waybetter-host/src/theme.rs @@ -16,6 +16,18 @@ use serde::{Deserialize, Serialize}; use serde_json::{Map, Value}; use std::collections::BTreeMap; +/// What an app declares about its themes for the host's theme commands +/// ([`crate::theme_commands`]): the built-in ones and where the owner's choice is saved (app data +/// file names). +#[derive(Clone, Copy, Debug)] +pub struct ThemeConfig { + pub site: &'static ThemeSite, + /// The owner's theme choice (absent = the site's own look). + pub file: &'static str, + /// Account and pane themes and the chrome setting (absent = defaults). + pub scopes_file: &'static str, +} + /// A site's built-in themes. The first preset is the site's own look (the default choice). #[derive(Clone, Copy, Debug)] pub struct ThemeSite { diff --git a/crates/waybetter-host/src/theme_commands.rs b/crates/waybetter-host/src/theme_commands.rs index 4ead26e..1f06a14 100644 --- a/crates/waybetter-host/src/theme_commands.rs +++ b/crates/waybetter-host/src/theme_commands.rs @@ -10,20 +10,11 @@ use crate::app::{config, tab_profile}; use crate::host::{data_file, read_json, shell_only, write_json}; -use crate::theme::{ThemeChoice, ThemeScopes, ThemeSite}; +use crate::theme::{ThemeChoice, ThemeScopes}; use std::sync::{Mutex, MutexGuard}; use tauri::{AppHandle, Manager, Webview}; -/// What an app declares about its themes: the built-in ones and where the owner's choice is saved -/// (app data file names). -#[derive(Clone, Copy, Debug)] -pub struct ThemeConfig { - pub site: &'static ThemeSite, - /// The owner's theme choice (absent = the site's own look). - pub file: &'static str, - /// Account and pane themes and the chrome setting (absent = defaults). - pub scopes_file: &'static str, -} +pub use crate::theme::ThemeConfig; #[derive(Default)] struct Themes {