From cc650b58d3181d1c07bd2cf1b1580c7d2e4bca73 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Mon, 22 Sep 2025 20:20:23 +0800 Subject: [PATCH] feat(privacy): add English and Chinese privacy policy pages and popup component - Introduced new HTML files for the privacy policy in English and Chinese. - Implemented a PrivacyPopup component to display the privacy policy within the application. - The popup dynamically loads the appropriate language based on user settings and includes options to accept or decline the policy. --- resources/cherry-studio/privacy-en.html | 252 ++++++++++++++++++ resources/cherry-studio/privacy-zh.html | 230 ++++++++++++++++ .../src/components/Popups/PrivacyPopup.tsx | 137 ++++++++++ 3 files changed, 619 insertions(+) create mode 100644 resources/cherry-studio/privacy-en.html create mode 100644 resources/cherry-studio/privacy-zh.html create mode 100644 src/renderer/src/components/Popups/PrivacyPopup.tsx diff --git a/resources/cherry-studio/privacy-en.html b/resources/cherry-studio/privacy-en.html new file mode 100644 index 000000000..612f18a70 --- /dev/null +++ b/resources/cherry-studio/privacy-en.html @@ -0,0 +1,252 @@ + + + + + + + Privacy Policy + + + + + +
+

Privacy Policy

+ +

+ Welcome to Cherry Studio (hereinafter referred to as "the Software" or "we"). We highly value your privacy + protection. This Privacy Policy explains how we process and protect your personal information and data. + Please read and understand this policy carefully before using the Software: +

+ +

1. Information We Collect

+

To optimize user experience and improve software quality, we may only collect the following anonymous, + non-personal information:

+ +

The above information is completely anonymous, does not involve any personal identity data, and cannot be + linked to your personal information.

+ +

2. Information We Do Not Collect

+

To maximize the protection of your privacy and security, we explicitly commit that we:

+ + +

3. Data Interaction Description

+

+ The Software uses API Keys from third-party model service providers that you apply for and configure + yourself to complete model calls and conversation functions. The model services you use (such as large + models, API interfaces, etc.) are directly provided by third-party providers of your choice. We do not + intervene, monitor, or interfere with the data transmission process. +

+

+ Data interactions between you and third-party model services are governed by the privacy policies and user + agreements of third-party service providers. We recommend that you fully understand the privacy terms of + relevant service providers before use. +

+ +

4. Local Data Security Protection

+

The Software is a localized application, and all data is stored on your local device by default. We have + taken the following measures to ensure data security:

+ + +

5. Third-Party Services

+

+ When using the Software, you may access third-party services (such as AI model APIs, translation services, + etc.). The use of these third-party services is governed by their respective terms of service and privacy + policies. We strongly recommend that you carefully read and understand the relevant terms before use. +

+ +

6. User Rights

+

You have complete control over your data:

+ + +

7. Children's Privacy Protection

+

The Software is not intended for minors under 18 years of age. If you are a minor, please use the Software + under the guidance of a guardian.

+ +

8. Privacy Policy Updates

+

+ We may update this Privacy Policy based on legal requirements or changes in product features. The updated + policy will be published in the Software and you will be notified before it takes effect. If you do not + agree with the updated terms, you can choose to stop using the Software. +

+ +

9. Contact Us

+

If you have any questions, suggestions, or complaints about this Privacy Policy, please contact us through + the following methods:

+ + + +
+ + + \ No newline at end of file diff --git a/resources/cherry-studio/privacy-zh.html b/resources/cherry-studio/privacy-zh.html new file mode 100644 index 000000000..db4195f68 --- /dev/null +++ b/resources/cherry-studio/privacy-zh.html @@ -0,0 +1,230 @@ + + + + + + + 隐私协议 + + + + + +
+

隐私协议

+ +

+ 欢迎使用 Cherry Studio(以下简称"本软件"或"我们")。我们高度重视您的隐私保护,本隐私协议将说明我们如何处理与保护您的个人信息和数据。请在使用本软件前仔细阅读并理解本协议: +

+ +

一、我们收集的信息范围

+

为了优化用户体验和提升软件质量,我们仅可能会匿名收集以下非个人化信息:

+ +

上述信息完全匿名,不会涉及任何个人身份数据,也无法关联到您的个人信息。

+ +

二、我们不会收集的任何信息

+

为了最大限度保护您的隐私安全,我们明确承诺:

+ + +

三、数据交互说明

+

+ 本软件采用您自行申请并配置的第三方模型服务提供商的 API Key,以完成相关模型的调用与对话功能。您使用的模型服务(例如大模型、API 接口等)由您选择的第三方提供商直接提供,我们不会介入、监控或干扰数据传输过程。 +

+

+ 您与第三方模型服务之间的数据交互受第三方服务提供商的隐私政策和用户协议约束,我们建议您在使用前充分了解相关服务商的隐私条款。 +

+ +

四、本地数据的安全保护

+

本软件为本地化应用程序,所有数据默认存储在您的本地设备上。我们采取了以下措施保障数据安全:

+ + +

五、第三方服务

+

+ 在使用本软件过程中,您可能会接入第三方服务(如 AI 模型 API、翻译服务等)。这些第三方服务的使用受其各自的服务条款和隐私政策约束。我们强烈建议您在使用前仔细阅读并理解相关条款。 +

+ +

六、用户权利

+

您对自己的数据拥有完全的控制权:

+ + +

七、儿童隐私保护

+

本软件不面向 18 岁以下的未成年人提供服务。如果您是未成年人,请在监护人的指导下使用本软件。

+ +

八、隐私政策的更新

+

+ 我们可能会根据法律法规要求或产品功能的变化更新本隐私协议。更新后的协议将在软件中发布,并在生效前通知您。如果您不同意更新后的条款,您可以选择停止使用本软件。 +

+ +

九、联系我们

+

如果您对本隐私协议有任何疑问、建议或投诉,请通过以下方式联系我们:

+ + + +
+ + + \ No newline at end of file diff --git a/src/renderer/src/components/Popups/PrivacyPopup.tsx b/src/renderer/src/components/Popups/PrivacyPopup.tsx new file mode 100644 index 000000000..1ec9639bf --- /dev/null +++ b/src/renderer/src/components/Popups/PrivacyPopup.tsx @@ -0,0 +1,137 @@ +import { TopView } from '@renderer/components/TopView' +import { useTheme } from '@renderer/context/ThemeProvider' +import { ThemeMode } from '@renderer/types' +import { runAsyncFunction } from '@renderer/utils' +import { Button, Modal } from 'antd' +import { useEffect, useState } from 'react' +import { useTranslation } from 'react-i18next' +import styled from 'styled-components' + +const WebViewContainer = styled.div` + width: 100%; + height: 500px; + overflow: hidden; + + webview { + width: 100%; + height: 100%; + border: none; + background: transparent; + } +` + +interface ShowParams { + title?: string + showDeclineButton?: boolean +} + +interface Props extends ShowParams { + resolve: (data: any) => void +} + +const PopupContainer: React.FC = ({ title, showDeclineButton = true, resolve }) => { + const [open, setOpen] = useState(true) + const [privacyUrl, setPrivacyUrl] = useState('') + const { theme } = useTheme() + const { i18n } = useTranslation() + + const getTitle = () => { + if (title) return title + const isChinese = i18n.language.startsWith('zh') + return isChinese ? '隐私协议' : 'Privacy Policy' + } + + const handleAccept = () => { + setOpen(false) + localStorage.setItem('privacy-popup-accepted', 'true') + resolve({ accepted: true }) + } + + const handleDecline = () => { + setOpen(false) + window.api.quit() + resolve({ accepted: false }) + } + + const onClose = () => { + if (!showDeclineButton) { + handleAccept() + } else { + handleDecline() + } + } + + useEffect(() => { + runAsyncFunction(async () => { + const { appPath } = await window.api.getAppInfo() + const isChinese = i18n.language.startsWith('zh') + const htmlFile = isChinese ? 'privacy-zh.html' : 'privacy-en.html' + const url = `file://${appPath}/resources/cherry-studio/${htmlFile}?theme=${theme === ThemeMode.dark ? 'dark' : 'light'}` + setPrivacyUrl(url) + }) + }, [theme, i18n.language]) + + PrivacyPopup.hide = () => setOpen(false) + + return ( + + {i18n.language.startsWith('zh') ? '拒绝' : 'Decline'} + + ), + + ].filter(Boolean)}> + + {privacyUrl && } + + + ) +} + +const TopViewKey = 'PrivacyPopup' + +export default class PrivacyPopup { + static topviewId = 0 + static hide() { + TopView.hide(TopViewKey) + } + static async show(props?: ShowParams) { + const accepted = localStorage.getItem('privacy-popup-accepted') + + if (accepted) { + return + } + + return new Promise<{ accepted: boolean }>((resolve) => { + TopView.show( + { + resolve(v) + TopView.hide(TopViewKey) + }} + />, + TopViewKey + ) + }) + } +}