-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #379 from ganeshrvel/release/3.2.24
Fixed exception thrown while machine id generation.
- Loading branch information
Showing
9 changed files
with
57 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
import { machineId } from 'node-machine-id'; | ||
import { settingsStorage } from './storageHelper'; | ||
import { v6 as uuidv6 } from 'uuid'; | ||
|
||
export async function getMachineId() { | ||
const settings = settingsStorage.getItems(['machineId']); | ||
import { identifierStorage } from './storageHelper'; | ||
import { isEmpty } from '../utils/funcs'; | ||
|
||
if (!settings?.machineId) { | ||
const _machineId = await machineId(); | ||
export function getMachineId() { | ||
try { | ||
const settings = identifierStorage.getItems(['machineId']); | ||
|
||
settingsStorage.setItems({ | ||
machineId: _machineId, | ||
}); | ||
if (!settings?.machineId || isEmpty(settings?.machineId)) { | ||
const _machineId = uuidv6(); | ||
|
||
return _machineId; | ||
} | ||
identifierStorage.setItems({ | ||
machineId: _machineId, | ||
}); | ||
|
||
return _machineId; | ||
} | ||
|
||
return settings.machineId; | ||
return settings.machineId; | ||
} catch (e) { | ||
console.error(`Unable to find machineId. Error: ${e}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { PATHS } from '../constants/paths'; | ||
import Storage from '../classes/Storage'; | ||
|
||
const { settingsFile } = PATHS; | ||
const { settingsFile, identifierFile } = PATHS; | ||
|
||
export const settingsStorage = new Storage(settingsFile); | ||
export const identifierStorage = new Storage(identifierFile, true); | ||
|
||
export const settingsStorage = new Storage(settingsFile, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8877,7 +8877,7 @@ node-mac-permissions@^2.2.1: | |
bindings "^1.5.0" | ||
node-addon-api "^3.0.2" | ||
|
||
node-machine-id@^1.1.12, node-machine-id@^1.1.9: | ||
node-machine-id@^1.1.9: | ||
version "1.1.12" | ||
resolved "https://registry.yarnpkg.com/node-machine-id/-/node-machine-id-1.1.12.tgz#37904eee1e59b320bb9c5d6c0a59f3b469cb6267" | ||
integrity sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ== | ||
|
@@ -13167,6 +13167,11 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" | ||
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= | ||
|
||
uuid@^10.0.0: | ||
version "10.0.0" | ||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-10.0.0.tgz#5a95aa454e6e002725c79055fd42aaba30ca6294" | ||
integrity sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ== | ||
|
||
uuid@^3.0.1, uuid@^3.3.2: | ||
version "3.4.0" | ||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" | ||
|