We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 774d7d2 commit ff2f728Copy full SHA for ff2f728
apps/cookie-butler/static/js/core.js
@@ -31,10 +31,16 @@ class QRCodeHandler {
31
static generateUUID() {
32
if (crypto && typeof crypto.randomUUID === 'function') {
33
return crypto.randomUUID();
34
- } else {
+ } else if (crypto && typeof crypto.getRandomValues === 'function') {
35
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
36
(+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16)
37
);
38
+ } else {
39
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
40
+ const r = (Math.random() * 16) | 0,
41
+ v = c == 'x' ? r : (r & 0x3) | 0x8;
42
+ return v.toString(16);
43
+ });
44
}
45
46
0 commit comments