added chat 2

This commit is contained in:
2026-07-30 18:33:08 +03:30
parent 106b0ebbdf
commit 5b0bb45e52
21 changed files with 5243 additions and 25 deletions
+1576
View File
File diff suppressed because it is too large Load Diff
+23 -1
View File
@@ -113,6 +113,27 @@ function isToken() {
return !!token
}
function createUuid() {
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
return crypto.randomUUID()
}
if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
const bytes = new Uint8Array(16)
crypto.getRandomValues(bytes)
bytes[6] = (bytes[6] & 0x0f) | 0x40
bytes[8] = (bytes[8] & 0x3f) | 0x80
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('')
return [
hex.slice(0, 8),
hex.slice(8, 12),
hex.slice(12, 16),
hex.slice(16, 20),
hex.slice(20),
].join('-')
}
return `${Date.now()}-${Math.floor(Math.random() * 1e9)}`
}
export {
getToken,
setToken,
@@ -123,5 +144,6 @@ export {
removeFingerPrint,
getIsActiveFingerprint,
setFingerPrint,
isToken
isToken,
createUuid
}