Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShishkevich D. <135337715+shishkevichd@users.noreply.github.com>2025-03-09 09:09:42 +0300
committerShishkevich D. <135337715+shishkevichd@users.noreply.github.com>2025-03-09 09:09:42 +0300
commit64fa0e97a30eb8f21b37f358b6382abcb4e4d9f2 (patch)
tree4e5e050df573dfec987186e179689b2a30355923
parenta45e9de47256710020cdf6ee0e21d88102979616 (diff)
chore: use `crypto.randomUUID()` for generating UUIDv4
-rw-r--r--web/assets/js/util/index.js9
1 files changed, 1 insertions, 8 deletions
diff --git a/web/assets/js/util/index.js b/web/assets/js/util/index.js
index cecc8dd4..0fea0592 100644
--- a/web/assets/js/util/index.js
+++ b/web/assets/js/util/index.js
@@ -126,14 +126,7 @@ class RandomUtil {
}
static randomUUID() {
- const template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
- return template.replace(/[xy]/g, function (c) {
- const randomValues = new Uint8Array(1);
- crypto.getRandomValues(randomValues);
- let randomValue = randomValues[0] % 16;
- let calculatedValue = (c === 'x') ? randomValue : (randomValue & 0x3 | 0x8);
- return calculatedValue.toString(16);
- });
+ return window.crypto.randomUUID()
}
static randomShadowsocksPassword() {