Compare commits

..

3 Commits
main ... dev

Author SHA1 Message Date
hicccc77
6d652130e6 chore: 更新资源文件 2026-03-30 20:10:35 +08:00
hicccc77
9e6f8077f7 fix: 数据匿名收集受 analyticsConsent 开关控制 (#589)
- 新增 analyticsConsent state 追踪用户同意状态
- initCloudControl() 仅在用户明确同意后执行
- recordPage() 同样受 analyticsConsent 守卫
- handleAnalyticsAllow 同步更新 state,用户同意后立即生效

Fixes #589
2026-03-30 12:05:41 +08:00
hicccc77
40342ca824 fix(deps): 修复 npm install postinstall 阶段 ajv-keywords 兼容性错误
将 npm overrides 中的 ajv 版本范围从 >=6.14.0 改为 ^6.14.0,
确保 electron-builder 依赖链使用 ajv v6,避免在 Node.js v22 上
@develar/schema-utils 加载 ajv-keywords 时访问 formats 返回 undefined 的问题。

Fixes #588
2026-03-30 11:04:44 +08:00
7 changed files with 12 additions and 6 deletions

View File

@@ -194,6 +194,6 @@
"picomatch": "^4.0.4", "picomatch": "^4.0.4",
"tar": "^7.5.13", "tar": "^7.5.13",
"immutable": "^5.1.5", "immutable": "^5.1.5",
"ajv": ">=6.14.0" "ajv": "^6.14.0"
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -103,6 +103,7 @@ function App() {
// 数据收集同意状态 // 数据收集同意状态
const [showAnalyticsConsent, setShowAnalyticsConsent] = useState(false) const [showAnalyticsConsent, setShowAnalyticsConsent] = useState(false)
const [analyticsConsent, setAnalyticsConsent] = useState<boolean | null>(null)
const [showWaylandWarning, setShowWaylandWarning] = useState(false) const [showWaylandWarning, setShowWaylandWarning] = useState(false)
@@ -252,6 +253,7 @@ function App() {
// 协议已同意,检查数据收集同意状态 // 协议已同意,检查数据收集同意状态
const consent = await configService.getAnalyticsConsent() const consent = await configService.getAnalyticsConsent()
const denyCount = await configService.getAnalyticsDenyCount() const denyCount = await configService.getAnalyticsDenyCount()
setAnalyticsConsent(consent)
// 如果未设置同意状态且拒绝次数小于2次显示弹窗 // 如果未设置同意状态且拒绝次数小于2次显示弹窗
if (consent === null && denyCount < 2) { if (consent === null && denyCount < 2) {
setShowAnalyticsConsent(true) setShowAnalyticsConsent(true)
@@ -266,18 +268,21 @@ function App() {
checkAgreement() checkAgreement()
}, []) }, [])
// 初始化数据收集 // 初始化数据收集(仅在用户同意后)
useEffect(() => { useEffect(() => {
cloudControl.initCloudControl() if (analyticsConsent === true) {
}, []) cloudControl.initCloudControl()
}
}, [analyticsConsent])
// 记录页面访问 // 记录页面访问(仅在用户同意后)
useEffect(() => { useEffect(() => {
if (analyticsConsent !== true) return
const path = location.pathname const path = location.pathname
if (path && path !== '/') { if (path && path !== '/') {
cloudControl.recordPage(path) cloudControl.recordPage(path)
} }
}, [location.pathname]) }, [location.pathname, analyticsConsent])
const handleAgree = async () => { const handleAgree = async () => {
if (!agreementChecked) return if (!agreementChecked) return
@@ -296,6 +301,7 @@ function App() {
const handleAnalyticsAllow = async () => { const handleAnalyticsAllow = async () => {
await configService.setAnalyticsConsent(true) await configService.setAnalyticsConsent(true)
setAnalyticsConsent(true)
setShowAnalyticsConsent(false) setShowAnalyticsConsent(false)
} }