mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-15 14:46:03 +00:00
Remove "uuid" dependency (#3811)
## Description: One dependency less: remove uuid. It is only used to get the three random digits after "Anon" if no name is present in localStorage. Crypto.randomUUID also gives us a UUID v4 and can already be used from Utils > generateCryptoRandomUUID. Not noticable when it comes to speed either. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: tryout33
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { LitElement, html } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators.js";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { translateText } from "../client/Utils";
|
||||
import { generateCryptoRandomUUID, translateText } from "../client/Utils";
|
||||
import { sanitizeClanTag } from "../core/Util";
|
||||
import {
|
||||
MAX_CLAN_TAG_LENGTH,
|
||||
@@ -224,7 +223,7 @@ export class UsernameInput extends LitElement {
|
||||
}
|
||||
|
||||
export function genAnonUsername(): string {
|
||||
const uuid = uuidv4();
|
||||
const uuid = generateCryptoRandomUUID();
|
||||
const cleanUuid = uuid.replace(/-/g, "").toLowerCase();
|
||||
const decimal = BigInt(`0x${cleanUuid}`);
|
||||
const threeDigits = decimal % 1000n;
|
||||
|
||||
Reference in New Issue
Block a user