-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06d40ef
commit 992ff35
Showing
15 changed files
with
185 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import db from '#/datastore' | ||
import { ipcMain } from 'electron' | ||
import { showMessageBox } from '~/main/utils/common' | ||
import { SHOW_PRIVACY_MESSAGE } from '~/universal/events/constants' | ||
|
||
class PrivacyManager { | ||
async init () { | ||
ipcMain.on(SHOW_PRIVACY_MESSAGE, () => { | ||
this.show(false) | ||
}) | ||
if (db.get('settings.privacyEnsure') !== true) { | ||
const res = await this.show(true) | ||
// cancel | ||
if (res.result === 1) { | ||
return false | ||
} else { | ||
db.set('settings.privacyEnsure', true) | ||
return true | ||
} | ||
} | ||
return true | ||
} | ||
|
||
async show (showCancel = true) { | ||
const res = await showMessageBox({ | ||
type: 'info', | ||
buttons: showCancel ? ['Yes', 'No'] : ['Yes'], | ||
title: '隐私协议', | ||
message: ` | ||
本软件尊重并保护所有使用服务用户的个人隐私权。为了给您提供更准确、更优质的服务,本软件会按照本隐私权政策的规定使用和收集您的一些行为信息。您在同意本软件服务使用协议之时,即视为您已经同意本隐私权政策全部内容。本隐私权政策属于本软件服务使用协议不可分割的一部分,如果不同意将无法使用。本协议会定期更新。 | ||
1.适用范围 | ||
a)在您使用本软件时,本软件会记录的您对本软件的一些操作行为信息,包括但不限于您使用本软件进行文件上传的耗时、类型、数量等信息。 | ||
2.信息的使用 | ||
a)在获得您的使用数据之后,本软件会将其上传至数据分析服务器,以便分析数据后,提供给您更好的服务。 | ||
3.信息披露 | ||
a)本软件不会将您的信息披露给不受信任的第三方。 | ||
b)根据法律的有关规定,或者行政或司法机构的要求,向第三方或者行政、司法机构披露; | ||
c)如您出现违反中国有关法律、法规或者相关规则的情况,需要向第三方披露; | ||
4.信息安全 | ||
a)本软件不会收集您的个人信息、密钥信息等隐私信息,所收集的信息仅仅作为改善软件、优化体验、了解软件日活等用途。 | ||
` | ||
}) | ||
return res | ||
} | ||
} | ||
|
||
const privacyManager = new PrivacyManager() | ||
|
||
export { | ||
privacyManager | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
/* eslint-disable camelcase */ | ||
import { ipcRenderer } from 'electron' | ||
import { | ||
BAIDU_TONGJI_INIT, | ||
BAIDU_TONGJI_INIT_RES, | ||
BAIDU_TONGJI_EVENT | ||
TALKING_DATA_APPID, TALKING_DATA_EVENT | ||
} from '~/universal/events/constants' | ||
import { handleBaiduTongJiEvent } from './common' | ||
import pkg from 'root/package.json' | ||
import { ipcRenderer } from 'electron' | ||
import { handleTalkingDataEvent } from './common' | ||
const { version } = pkg | ||
|
||
ipcRenderer.on(BAIDU_TONGJI_INIT_RES, (_, scriptContent) => { | ||
window._hmt = window._hmt || [] | ||
const hm = document.createElement('script') | ||
hm.text = scriptContent | ||
const head = document.getElementsByTagName('head')[0] | ||
head.appendChild(hm) | ||
}) | ||
export const initTalkingData = () => { | ||
setTimeout(() => { | ||
const talkingDataScript = document.createElement('script') | ||
|
||
ipcRenderer.on(BAIDU_TONGJI_EVENT, (_, data: IBaiduTongJiOptions) => { | ||
handleBaiduTongJiEvent(data) | ||
}) | ||
talkingDataScript.src = `http://sdk.talkingdata.com/app/h5/v1?appid=${TALKING_DATA_APPID}&vn=${version}&vc=${version}` | ||
|
||
export const initBaiduTongJi = () => { | ||
setTimeout(() => { | ||
ipcRenderer.send(BAIDU_TONGJI_INIT) | ||
const head = document.getElementsByTagName('head')[0] | ||
head.appendChild(talkingDataScript) | ||
}, 0) | ||
} | ||
|
||
ipcRenderer.on(TALKING_DATA_EVENT, (_, data: ITalkingDataOptions) => { | ||
handleTalkingDataEvent(data) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
const isDevelopment = process.env.NODE_ENV !== 'production' | ||
/* eslint-disable camelcase */ | ||
export const handleBaiduTongJiEvent = (data: IBaiduTongJiOptions) => { | ||
const { category, action, opt_label = '', opt_value = Date.now() } = data | ||
window._hmt.push(['_trackEvent', category, action, opt_label, opt_value]) | ||
export const handleTalkingDataEvent = (data: ITalkingDataOptions) => { | ||
const { EventId, Label = '', MapKv = {} } = data | ||
MapKv.from = window.location.href | ||
window.TDAPP.onEvent(EventId, Label, MapKv) | ||
if (isDevelopment) { | ||
console.log('baidu tongji', data) | ||
console.log('talkingData', data) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
export const SHOW_INPUT_BOX = 'SHOW_INPUT_BOX' | ||
export const SHOW_INPUT_BOX_RESPONSE = 'SHOW_INPUT_BOX_RESPONSE' | ||
export const TOGGLE_SHORTKEY_MODIFIED_MODE = 'TOGGLE_SHORTKEY_MODIFIED_MODE' | ||
export const BAIDU_TONGJI_INIT = 'BAIDU_TONDJI_INIT' | ||
export const BAIDU_TONGJI_INIT_RES = 'BAIDU_TONDJI_INIT_RES' | ||
export const BAIDU_TONGJI_CODE = '19a7ebdbb87f2403773c7ab0cae16d21' | ||
export const BAIDU_TONGJI_EVENT = 'BAIDU_TONGJI_EVENT' | ||
export const TALKING_DATA_APPID = '7E6832BCE3F1438696579E541DFEBFDA' | ||
export const TALKING_DATA_EVENT = 'TALKING_DATA_EVENT' | ||
export const SHOW_PRIVACY_MESSAGE = 'SHOW_PRIVACY_MESSAGE' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.