feat: 添加 FingerprintJS 依赖,集成访客 ID 和指纹数据功能

This commit is contained in:
Sunwuyuan
2025-11-30 16:23:43 +08:00
parent ba96069a9b
commit 5f363aba38
5 changed files with 91 additions and 22 deletions
+22
View File
@@ -0,0 +1,22 @@
import FingerprintJS from '@fingerprintjs/fingerprintjs'
let fpPromise
export const loadFingerprint = () => {
if (!fpPromise) {
fpPromise = FingerprintJS.load()
}
return fpPromise
}
export const getVisitorId = async () => {
const fp = await loadFingerprint()
const result = await fp.get()
return result.visitorId
}
export const getFingerprintData = async () => {
const fp = await loadFingerprint()
const result = await fp.get()
return result
}