diff --git a/src/main.ts b/src/main.ts
index 116de7a..61e76e0 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -8,7 +8,6 @@ import VueLazyLoad from 'vue3-lazyload'
import axios from 'axios'
import { mainMixin } from './renderer/utils/mainMixin'
import { dragMixin } from '@/utils/mixin'
-import { initTalkingData } from './renderer/utils/analytics'
import db from './renderer/utils/db'
import { i18nManager, T } from './renderer/i18n/index'
import { getConfig, saveConfig, sendToMain, triggerRPC } from '@/utils/dataSender'
@@ -65,5 +64,3 @@ console.log(hljsCommon.highlightAuto('
Highlight.js has been registered succe
app.use(hljsVuePlugin)
app.use(VueVideoPlayer)
app.mount('#app')
-
-initTalkingData()
diff --git a/src/main/apis/app/uploader/index.ts b/src/main/apis/app/uploader/index.ts
index 9f16225..07e1168 100644
--- a/src/main/apis/app/uploader/index.ts
+++ b/src/main/apis/app/uploader/index.ts
@@ -12,8 +12,8 @@ import windowManager from 'apis/app/window/windowManager'
import { IWindowList } from '#/types/enum'
import util from 'util'
import { IPicGo } from 'piclist'
-import { showNotification, calcDurationRange, getClipboardFilePath } from '~/main/utils/common'
-import { RENAME_FILE_NAME, TALKING_DATA_EVENT } from '~/universal/events/constants'
+import { showNotification, getClipboardFilePath } from '~/main/utils/common'
+import { RENAME_FILE_NAME } from '~/universal/events/constants'
import logger from '@core/picgo/logger'
import { T } from '~/main/i18n'
import fse from 'fs-extra'
@@ -45,20 +45,6 @@ const waitForRename = (window: BrowserWindow, id: number): Promise
})
}
-const handleTalkingData = (webContents: WebContents, options: IAnalyticsData) => {
- const data: ITalkingDataOptions = {
- EventId: 'upload',
- Label: options.type,
- MapKv: {
- by: options.fromClipboard ? 'clipboard' : 'files', // 上传剪贴板图片还是选择的文文件
- count: options.count, // 上传的数量
- duration: calcDurationRange(options.duration || 0), // 上传耗时
- type: options.type
- }
- }
- webContents.send(TALKING_DATA_EVENT, data)
-}
-
class Uploader {
private webContents: WebContents | null = null
// private uploading: boolean = false
@@ -152,17 +138,8 @@ class Uploader {
if (!privacyCheckRes) {
throw Error(T('PRIVACY_TIPS'))
}
- const startTime = Date.now()
const output = await picgo.upload(img)
if (Array.isArray(output) && output.some((item: ImgInfo) => item.imgUrl)) {
- if (this.webContents) {
- handleTalkingData(this.webContents, {
- fromClipboard: !img,
- type: db.get('picBed.uploader') || db.get('picBed.current') || 'smms',
- count: img ? img.length : 1,
- duration: Date.now() - startTime
- } as IAnalyticsData)
- }
output.forEach((item: ImgInfo) => {
item.config = JSON.parse(JSON.stringify(db.get(`picBed.${item.type}`)))
})
diff --git a/src/main/utils/common.ts b/src/main/utils/common.ts
index f3dfec3..733677c 100644
--- a/src/main/utils/common.ts
+++ b/src/main/utils/common.ts
@@ -53,23 +53,6 @@ export const showMessageBox = (options: any) => {
})
}
-const thresholds = [
- { limit: 1000, value: 500 },
- { limit: 1500, value: 1000 },
- { limit: 3000, value: 2000 },
- { limit: 5000, value: 3000 },
- { limit: 7000, value: 5000 },
- { limit: 10000, value: 8000 },
- { limit: 12000, value: 10000 },
- { limit: 20000, value: 15000 },
- { limit: 30000, value: 20000 }
-]
-
-export const calcDurationRange = (duration: number) => {
- const foundThreshold = thresholds.find(({ limit }) => duration < limit)
- return foundThreshold ? foundThreshold.value : 100000
-}
-
/**
* macOS public.file-url will get encoded file path,
* so we need to decode it
diff --git a/src/renderer/utils/analytics.ts b/src/renderer/utils/analytics.ts
deleted file mode 100644
index 1c85a4d..0000000
--- a/src/renderer/utils/analytics.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/* eslint-disable camelcase */
-import {
- TALKING_DATA_APPID, TALKING_DATA_EVENT
-} from '~/universal/events/constants'
-import pkg from 'root/package.json'
-import { ipcRenderer } from 'electron'
-import { handleTalkingDataEvent } from './common'
-const { version } = pkg
-
-export const initTalkingData = () => {
- setTimeout(() => {
- const talkingDataScript = document.createElement('script')
-
- talkingDataScript.src = `http://sdk.talkingdata.com/app/h5/v1?appid=${TALKING_DATA_APPID}&vn=${version}&vc=${version}`
-
- const head = document.getElementsByTagName('head')[0]
- head.appendChild(talkingDataScript)
- }, 0)
-}
-
-ipcRenderer.on(TALKING_DATA_EVENT, (_, data: ITalkingDataOptions) => {
- handleTalkingDataEvent(data)
-})
diff --git a/src/renderer/utils/common.ts b/src/renderer/utils/common.ts
index 18102ab..31843d3 100644
--- a/src/renderer/utils/common.ts
+++ b/src/renderer/utils/common.ts
@@ -1,16 +1,5 @@
import { isReactive, isRef, toRaw, unref } from 'vue'
-const isDevelopment = process.env.NODE_ENV !== 'production'
-/* eslint-disable camelcase */
-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('talkingData', data)
- }
-}
-
/**
* get raw data from reactive or ref
*/
diff --git a/src/universal/events/constants.ts b/src/universal/events/constants.ts
index 4433fe0..464bdcc 100644
--- a/src/universal/events/constants.ts
+++ b/src/universal/events/constants.ts
@@ -1,9 +1,7 @@
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 TALKING_DATA_APPID = 'B743C16E2989419A9B02EDE9D1E6A530'
export const C1N = 'WjJoeFdWWklhVTlXYVRKTU5EUmFOVkEwUlVRPQ=='
-export const TALKING_DATA_EVENT = 'TALKING_DATA_EVENT'
export const SHOW_PRIVACY_MESSAGE = 'SHOW_PRIVACY_MESSAGE'
export const PICGO_SAVE_CONFIG = 'PICGO_SAVE_CONFIG'
export const PICGO_GET_CONFIG = 'PICGO_GET_CONFIG'
diff --git a/src/universal/types/types.d.ts b/src/universal/types/types.d.ts
index c48b6f4..03893e2 100644
--- a/src/universal/types/types.d.ts
+++ b/src/universal/types/types.d.ts
@@ -337,12 +337,6 @@ interface IAppNotification {
icon?: string
}
-interface ITalkingDataOptions {
- EventId: string
- Label?: string
- MapKv?: IStringKeyMap
-}
-
interface IAnalyticsData {
fromClipboard: boolean
type: string
diff --git a/src/universal/utils/common.ts b/src/universal/utils/common.ts
index 67e1a93..33e9769 100644
--- a/src/universal/utils/common.ts
+++ b/src/universal/utils/common.ts
@@ -41,9 +41,7 @@ export const simpleClone = (obj: any) => {
return JSON.parse(JSON.stringify(obj))
}
-export const enforceNumber = (num: number | string) => {
- return isNaN(+num) ? 0 : +num
-}
+export const enforceNumber = (num: number | string) => isNaN(+num) ? 0 : +num
export const isDev = process.env.NODE_ENV === 'development'
diff --git a/src/universal/utils/getLatestVersion.ts b/src/universal/utils/getLatestVersion.ts
index a8e4106..0eaacde 100644
--- a/src/universal/utils/getLatestVersion.ts
+++ b/src/universal/utils/getLatestVersion.ts
@@ -4,11 +4,8 @@ import { RELEASE_URL, RELEASE_URL_BACKUP } from './static'
export const getLatestVersion = async (): Promise => {
try {
- const { data } = await axios.get(RELEASE_URL)
- const releases = data as IStringKeyMap[]
- const normalList = releases.filter(item => !item.name.includes('beta'))
- const latestRelease = normalList[0]
- return latestRelease.name
+ const { data: normalList } = await axios.get(RELEASE_URL)
+ return normalList[0].name
} catch (err) {
console.log(err)
try {