Skip to content

Commit

Permalink
fix: versions (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
uonr authored Dec 21, 2024
1 parent 75965c0 commit 416fce5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 43 deletions.
3 changes: 1 addition & 2 deletions apps/legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"reselect": "^5.1.1",
"sanitize.css": "^13.0.0",
"swr": "^2.2.5",
"uuid": "^10.0.0"
"uuid": "^11.0.3"
},
"scripts": {
"dev": "webpack-dev-server --color --output-public-path / --progress",
Expand All @@ -50,7 +50,6 @@
"@types/react-redux": "^7.1.33",
"@types/react-router-dom": "^5.3.3",
"@types/react-transition-group": "^4.4.10",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"babel-loader": "^9.1.3",
Expand Down
11 changes: 8 additions & 3 deletions apps/legacy/src/utils/id.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { v1 as uuidV1 } from 'uuid';

const getNodeId = (): number[] => {
const getNodeId = (): Uint8Array => {
const key = 'client-node-id';
const serializedId = localStorage.getItem(key);
if (serializedId) {
try {
return JSON.parse(serializedId) as number[];
const parsed = JSON.parse(serializedId);
if (Array.isArray(parsed) && parsed.length === 6 && parsed.every((x) => typeof x === 'number')) {
return new Uint8Array(parsed);
} else {
throw new Error('Invalid node ID');
}
} catch (e) {
localStorage.removeItem(key);
return getNodeId();
Expand All @@ -15,7 +20,7 @@ const getNodeId = (): number[] => {
window.crypto.getRandomValues(bytes);
const nodeId = Array.from(bytes);
localStorage.setItem(key, JSON.stringify(nodeId));
return nodeId;
return bytes;
}
};

Expand Down
42 changes: 7 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.0",
"react-intl": "^6.6.2",
"react-intl": "^7.0.4",
"swr": "^2.2.5"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
"license": "GPL-3.0",
"dependencies": {
"react": "^18.2.0",
"uuid": "^10.0.0"
"uuid": "^11.0.3"
},
"sideEffects": false,
"devDependencies": {
"@types/react": "^18.2.46",
"@types/uuid": "^10.0.0",
"eslint": "^8.56.0",
"@boluo/eslint-config": "*",
"@boluo/typescript-config": "*",
Expand Down

0 comments on commit 416fce5

Please sign in to comment.