mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 02:47:52 +01:00
Use crypto UUID for UI
This commit is contained in:
parent
d1ed983106
commit
b3e57dae85
@ -1261,6 +1261,9 @@ export async function waitUntilCondition(condition, timeout = 1000, interval = 1
|
||||
* uuidv4(); // '3e2fd9e1-0a7a-4f6d-9aaf-8a7a4babe7eb'
|
||||
*/
|
||||
export function uuidv4() {
|
||||
if ('randomUUID' in crypto) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
const r = Math.random() * 16 | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user