2b13b764b4
* Public texture - Front => Get texture when user connected on public method - Front => Anonymous login will be make every connexion to get map details - Pusher => `/anonymLogin` permit to get map details and public texture load in customize scene * Improve texture local user - Permit to keep previous texture get with 'register' link * Texture public loading - Texture will be load with Room class - Fix issue on lazzy loading atttempt * Remove async await useless
30 lines
852 B
TypeScript
30 lines
852 B
TypeScript
import {MAX_USERNAME_LENGTH} from "../Enum/EnvironmentVariable";
|
|
|
|
export interface CharacterTexture {
|
|
id: number,
|
|
level: number,
|
|
url: string,
|
|
rights: string
|
|
}
|
|
|
|
export const maxUserNameLength: number = MAX_USERNAME_LENGTH;
|
|
|
|
export function isUserNameValid(value: unknown): boolean {
|
|
return typeof value === "string" && value.length > 0 && value.length <= maxUserNameLength && value.indexOf(' ') === -1;
|
|
}
|
|
|
|
export function areCharacterLayersValid(value: string[] | null): boolean {
|
|
if (!value || !value.length) return false;
|
|
for (let i = 0; i < value.length; i++) {
|
|
if (/^\w+$/.exec(value[i]) === null) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
export class LocalUser {
|
|
constructor(public readonly uuid:string, public readonly jwtToken: string, public textures: CharacterTexture[]) {
|
|
}
|
|
}
|