@bbki.ng/site 5.5.1 → 5.5.2

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,13 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 5.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 039575f: fix hash str
8
+ - Updated dependencies [039575f]
9
+ - @bbki.ng/ui@0.2.2
10
+
3
11
  ## 5.5.1
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "5.5.1",
3
+ "version": "5.5.2",
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.1"
17
+ "@bbki.ng/ui": "0.2.2"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@eslint/compat": "^1.0.0",
@@ -2,13 +2,13 @@ import { useRef } from 'react';
2
2
  import { useFingerprint } from '@/hooks/use_fingerprint';
3
3
 
4
4
  export const useFingerprintUniforms = () => {
5
- const { fingerprint, loading } = useFingerprint();
5
+ const { deviceId, loading } = useFingerprint();
6
6
 
7
7
  const charsRef = useRef<number[] | null>(null);
8
8
  const appliedRef = useRef(false);
9
9
 
10
- if (!loading && fingerprint && !charsRef.current) {
11
- const hash = fingerprint.hash.slice(0, 16);
10
+ if (!loading && deviceId && !charsRef.current) {
11
+ const hash = deviceId;
12
12
  const chars = [...hash].map(c => parseInt(c, 16) || 0);
13
13
  while (chars.length < 16) chars.push(0);
14
14
  charsRef.current = chars;
@@ -42,13 +42,6 @@ export const useFingerprintUniforms = () => {
42
42
  inst.uniforms.uFpChars4.value[2] = chars[14];
43
43
  inst.uniforms.uFpChars4.value[3] = chars[15];
44
44
 
45
- // console.log('[Fingerprint] Uniforms set:', {
46
- // uFpChars1: inst.uniforms.uFpChars1.value,
47
- // uFpChars2: inst.uniforms.uFpChars2.value,
48
- // uFpChars3: inst.uniforms.uFpChars3.value,
49
- // uFpChars4: inst.uniforms.uFpChars4.value,
50
- // });
51
-
52
45
  appliedRef.current = true;
53
46
  };
54
47
 
@@ -330,12 +330,11 @@ export async function getStableDeviceId(): Promise<{ id: string; fp: Fingerprint
330
330
 
331
331
  // 生成新ID
332
332
  const fp = await getFingerprint();
333
- const id = `dev_${fp.hash.slice(0, 16)}_${Date.now().toString(36)}`;
334
333
 
335
334
  localStorage.setItem(
336
335
  STORAGE_KEY,
337
336
  JSON.stringify({
338
- id,
337
+ id: fp.hash.slice(0, 16),
339
338
  ts: Date.now(),
340
339
  ua: navigator.userAgent.slice(0, 50),
341
340
  })