Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
thecybernanny-webapp
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
asranov0003
thecybernanny-webapp
Commits
0c26337e
Commit
0c26337e
authored
Jun 30, 2025
by
asranov0003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: generate device id
parent
6eeaed06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
utils.ts
src/utils/utils.ts
+10
-1
No files found.
src/utils/utils.ts
View file @
0c26337e
...
...
@@ -4,7 +4,16 @@ export const generateDeviceId = (): string => {
let
id
=
localStorage
.
getItem
(
`device_id-
${
TG_USER_ID
}
`
);
if
(
!
id
)
{
id
=
crypto
.
randomUUID
();
if
(
crypto
.
randomUUID
)
{
id
=
crypto
.
randomUUID
();
}
else
{
id
=
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
.
replace
(
/
[
xy
]
/g
,
(
c
)
=>
{
const
r
=
(
Math
.
random
()
*
16
)
|
0
;
const
v
=
c
===
"x"
?
r
:
(
r
&
0x3
)
|
0x8
;
return
v
.
toString
(
16
);
});
}
localStorage
.
setItem
(
`device_id-
${
TG_USER_ID
}
`
,
id
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment