feat: 界面缩放改用后端持久化 + 原生 webview zoom
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled

This commit is contained in:
AxTps committed 2026-10-01 16:21:30 +08:00
1 parent 81b7219085
commit 34cf186c33
7 files changed
+63 -35

No files matched your search

@@ -0,0 +1 @@
ALTER TABLE settings ADD COLUMN ui_scale REAL NOT NULL DEFAULT 100.0;
+12 -1
View File
@@ -141,6 +141,8 @@ pub struct Settings {
pub transparent_background_opacity: u32,
pub transparent_background_blur: bool,
pub sidebar_instance_count: u32,
#[serde(default = "default_ui_scale")]
pub ui_scale: f64,
#[serde(default)]
pub close_behavior: String,
#[serde(default)]
@@ -192,6 +194,10 @@ fn default_true() -> bool {
true
}
fn default_ui_scale() -> f64 {
100.0
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, Hash, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FeatureFlag {
@@ -242,6 +248,7 @@ impl Settings {
sidebar_instance_count, home_layout, minimal_home_instance_id,
json(home_widgets) as \"home_widgets?: String\", auto_hide_downloads_button,
json(terracotta_public_nodes) terracotta_public_nodes,
ui_scale,
version
FROM settings
"
@@ -308,6 +315,7 @@ impl Settings {
as u32,
transparent_background_blur: res.transparent_background_blur == 1,
sidebar_instance_count: res.sidebar_instance_count as u32,
ui_scale: res.ui_scale,
close_behavior,
auto_hide_downloads_button: res.auto_hide_downloads_button == 1,
home_layout: HomeLayout::from_string(&res.home_layout),
@@ -603,7 +611,10 @@ impl Settings {
.bind(self.force_unicode_font)
.execute(exec)
.await?;
sqlx::query("UPDATE settings SET ui_scale = ? WHERE id = 0")
.bind(self.ui_scale)
.execute(exec)
.await?;
Ok(())
}