feat: 增加关闭自动更新的开关 (#283)

* Add Web Client Auto Update feature with localization support

- Introduced a new setting for automatic updates of the web client, available in both English and Chinese.
- Added a new component for managing the auto-update feature in the settings overview.
- Updated localization files to include descriptions and titles for the new feature.

* chore: Update to v0.9.38
This commit is contained in:
haorwen
2025-12-26 00:26:02 +08:00
committed by GitHub
parent 6d8505a16a
commit 37199506e3
5 changed files with 58 additions and 1 deletions
@@ -0,0 +1,42 @@
import { useEffect } from "react";
import { toast } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import SettingBlock from "@/components/SettingBlock";
import {
useGetSystemCommonQuery,
useUpdateSystemCommonMutation
} from "../../../app/services/server";
import { useAppSelector } from "../../../app/store";
import { shallowEqual } from "react-redux";
import Toggle from "@/components/styled/Toggle";
const WebClientAutoUpdate = () => {
const currStatus = useAppSelector(
(store) => !!store.server.webclient_auto_update,
shallowEqual
);
const { t } = useTranslation("setting", { keyPrefix: "overview.webclient_auto_update" });
const { t: ct } = useTranslation();
const { refetch } = useGetSystemCommonQuery();
const [updateSetting, { isSuccess }] = useUpdateSystemCommonMutation();
useEffect(() => {
if (isSuccess) {
refetch();
toast.success(ct("tip.update"));
}
}, [isSuccess]);
const handleToggle = () => {
updateSetting({ webclient_auto_update: !currStatus });
};
return (
<SettingBlock
title={t("title")}
desc={t("desc")}
toggler={<Toggle onClick={handleToggle} checked={currStatus} />}
></SettingBlock>
);
};
export default WebClientAutoUpdate;
+3
View File
@@ -19,6 +19,7 @@ import GuestMode from "./GuestMode";
import WhoCanSignUpSetting from "./WhoCanSignUpSetting";
import UserMsgEmailNotify from "./UserMsgEmailNotify";
import WhoCanInviteUsers from "./WhoCanInviteUsers";
import WebClientAutoUpdate from "./WebClientAutoUpdate";
export default function Overview() {
const { t } = useTranslation("setting");
@@ -54,6 +55,8 @@ export default function Overview() {
<ChatLayout />
{/* 联系人验证模式 */}
<ContactVerification />
{/* 前端自动更新 */}
<WebClientAutoUpdate />
</>
)}