From 0e0e41197f209044e8dcf50c3a230a226abb4563 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 12 Jun 2026 03:17:32 +0200 Subject: [PATCH] fix(settings): normalize tgCpu on load so a bad value can't block saving (#5091) The settings page validates the whole AllSetting object before saving, so a tgCpu value that isn't an integer in 0-100 (left over from an older or corrupt setting) failed validation with "tgCpu: Invalid input" and blocked saving every other setting too. Clamp/round tgCpu to a valid integer in the model constructor, defaulting to 80 when it isn't a finite number. --- frontend/src/models/setting.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/models/setting.ts b/frontend/src/models/setting.ts index 33f5b93b5..5ccfc8756 100644 --- a/frontend/src/models/setting.ts +++ b/frontend/src/models/setting.ts @@ -95,6 +95,8 @@ export class AllSetting { if (data != null) { ObjectUtil.cloneProps(this, data); } + const cpu = Math.round(Number(this.tgCpu)); + this.tgCpu = Number.isFinite(cpu) ? Math.min(100, Math.max(0, cpu)) : 80; } equals(other: AllSetting): boolean {