@bbki.ng/site 5.5.2 → 5.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 5.5.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 45f9fae: fix: hash
8
+ - Updated dependencies [45f9fae]
9
+ - @bbki.ng/ui@0.2.4
10
+
11
+ ## 5.5.3
12
+
13
+ ### Patch Changes
14
+
15
+ - 71ce23d: hash error
16
+ - Updated dependencies [71ce23d]
17
+ - @bbki.ng/ui@0.2.3
18
+
3
19
  ## 5.5.2
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "5.5.2",
3
+ "version": "5.5.4",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "react-dom": "^18.0.0",
15
15
  "react-router-dom": "6",
16
16
  "swr": "^2.2.5",
17
- "@bbki.ng/ui": "0.2.2"
17
+ "@bbki.ng/ui": "0.2.4"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@eslint/compat": "^1.0.0",
@@ -263,7 +263,7 @@ async function getAudioFingerprint(): Promise<string | undefined> {
263
263
  }
264
264
 
265
265
  // 主采集函数
266
- export async function getFingerprint(): Promise<FingerprintData> {
266
+ async function getFingerprint(): Promise<FingerprintData> {
267
267
  const components: Partial<FingerprintComponents> = {
268
268
  userAgent: navigator.userAgent,
269
269
  language: navigator.language,
@@ -330,11 +330,12 @@ export async function getStableDeviceId(): Promise<{ id: string; fp: Fingerprint
330
330
 
331
331
  // 生成新ID
332
332
  const fp = await getFingerprint();
333
+ const id = fp.hash.slice(0, 16);
333
334
 
334
335
  localStorage.setItem(
335
336
  STORAGE_KEY,
336
337
  JSON.stringify({
337
- id: fp.hash.slice(0, 16),
338
+ id,
338
339
  ts: Date.now(),
339
340
  ua: navigator.userAgent.slice(0, 50),
340
341
  })
@@ -1,6 +1,6 @@
1
1
  import { API_ENDPOINT } from '@/constants/routes';
2
2
  import { FontType } from '@/types/font';
3
- import { getFingerprint, getStableDeviceId } from './fingerprints';
3
+ import { getStableDeviceId } from './fingerprints';
4
4
 
5
5
  type Fetcher = (resource: string, init?: any) => Promise<any>;
6
6
 
@@ -10,8 +10,8 @@ export const floatNumberToPercentageString = (num: number): string => {
10
10
 
11
11
  export const baseFetcher = async (resource: string, init: RequestInit = {}) => {
12
12
  const headers = new Headers(init.headers || {});
13
- const fp = await getFingerprint();
14
- headers.set('X-Device-Fingerprint', fp.hash);
13
+ const fp = await getStableDeviceId();
14
+ headers.set('X-Device-Fingerprint', fp.id);
15
15
  return fetch(resource, {
16
16
  ...init,
17
17
  headers,