allow special chars in nicks again, make nicklength customizable
This commit is contained in:
parent
9d66085623
commit
b27922a15f
@ -52,7 +52,8 @@ services:
|
|||||||
TURN_PASSWORD: "$TURN_PASSWORD"
|
TURN_PASSWORD: "$TURN_PASSWORD"
|
||||||
TURN_SERVER: "$TURN_SERVER"
|
TURN_SERVER: "$TURN_SERVER"
|
||||||
TURN_USER: "$TURN_USER"
|
TURN_USER: "$TURN_USER"
|
||||||
MAX_PER_GROUP: "$MAX_PER_GROUP"
|
MAX_PER_GROUP: $MAX_PER_GROUP
|
||||||
|
MAX_USERNAME_LENGTH: $MAX_USERNAME_LENGTH
|
||||||
labels:
|
labels:
|
||||||
- "traefik.http.routers.front.rule=Host(`${BASE_DOMAIN}`) && PathPrefix(`/`)"
|
- "traefik.http.routers.front.rule=Host(`${BASE_DOMAIN}`) && PathPrefix(`/`)"
|
||||||
- "traefik.http.routers.front.entryPoints=web,websecure"
|
- "traefik.http.routers.front.entryPoints=web,websecure"
|
||||||
|
@ -30,6 +30,8 @@ ARG STUN_SERVER
|
|||||||
ARG TURN_SERVER
|
ARG TURN_SERVER
|
||||||
ARG TURN_USER
|
ARG TURN_USER
|
||||||
ARG TURN_PASSWORD
|
ARG TURN_PASSWORD
|
||||||
|
ARG MAX_USERNAME_LENGTH
|
||||||
|
ARG MAX_PER_GROUP
|
||||||
|
|
||||||
COPY front .
|
COPY front .
|
||||||
COPY --from=builder /usr/src/generated src/Messages/generated
|
COPY --from=builder /usr/src/generated src/Messages/generated
|
||||||
@ -50,7 +52,8 @@ ARG UPLOADER_URL=uploader.$BASE_DOMAIN
|
|||||||
RUN ./templater.sh
|
RUN ./templater.sh
|
||||||
RUN API_URL=$API_URL UPLOADER_URL=$UPLOADER_URL ADMIN_URL=$ADMIN_URL START_ROOM_URL=$START_ROOM_URL \
|
RUN API_URL=$API_URL UPLOADER_URL=$UPLOADER_URL ADMIN_URL=$ADMIN_URL START_ROOM_URL=$START_ROOM_URL \
|
||||||
JITSI_URL=$JITSI_URL JITSI_PRIVATE_MODE=$JITSI_PRIVATE_MODE \
|
JITSI_URL=$JITSI_URL JITSI_PRIVATE_MODE=$JITSI_PRIVATE_MODE \
|
||||||
STUN_SERVER=$STUN_SERVER TURN_SERVER=$TURN_SERVER TURN_USER=$TURN_USER TURN_PASSWORD=$TURN_PASSWORD \
|
STUN_SERVER=$STUN_SERVER TURN_SERVER=$TURN_SERVER TURN_USER=$TURN_USER \
|
||||||
|
TURN_PASSWORD=$TURN_PASSWORD MAX_USERNAME_LENGTH=$MAX_USERNAME_LENGTH MAX_PER_GROUP=$MAX_PER_GROUP \
|
||||||
yarn run build
|
yarn run build
|
||||||
|
|
||||||
# final production image
|
# final production image
|
||||||
|
@ -7,10 +7,8 @@ export interface CharacterTexture {
|
|||||||
rights: string
|
rights: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const maxUserNameLength: number = MAX_USERNAME_LENGTH;
|
|
||||||
|
|
||||||
export function isUserNameValid(value: string): boolean {
|
export function isUserNameValid(value: string): boolean {
|
||||||
const regexp = new RegExp('^[A-Za-z0-9]{1,'+maxUserNameLength+'}$');
|
const regexp = new RegExp('^[A-Za-z0-9\-\+\?\_\&\!]{1,'+MAX_USERNAME_LENGTH+'}$');
|
||||||
return regexp.test(value);
|
return regexp.test(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ const JITSI_URL : string|undefined = (process.env.JITSI_URL === '') ? undefined
|
|||||||
const JITSI_PRIVATE_MODE : boolean = process.env.JITSI_PRIVATE_MODE == "true";
|
const JITSI_PRIVATE_MODE : boolean = process.env.JITSI_PRIVATE_MODE == "true";
|
||||||
const POSITION_DELAY = 200; // Wait 200ms between sending position events
|
const POSITION_DELAY = 200; // Wait 200ms between sending position events
|
||||||
const MAX_EXTRAPOLATION_TIME = 100; // Extrapolate a maximum of 250ms if no new movement is sent by the player
|
const MAX_EXTRAPOLATION_TIME = 100; // Extrapolate a maximum of 250ms if no new movement is sent by the player
|
||||||
export const MAX_USERNAME_LENGTH = parseInt(process.env.MAX_USERNAME_LENGTH || '') || 8;
|
const MAX_USERNAME_LENGTH = parseInt(process.env.MAX_USERNAME_LENGTH || '8');
|
||||||
export const MAX_PER_GROUP = parseInt(process.env.MAX_PER_GROUP || '4');
|
const MAX_PER_GROUP = parseInt(process.env.MAX_PER_GROUP || '4');
|
||||||
|
|
||||||
export const isMobile = ():boolean => ( ( window.innerWidth <= 800 ) || ( window.innerHeight <= 600 ) );
|
export const isMobile = ():boolean => ( ( window.innerWidth <= 800 ) || ( window.innerHeight <= 600 ) );
|
||||||
|
|
||||||
@ -31,5 +31,7 @@ export {
|
|||||||
TURN_USER,
|
TURN_USER,
|
||||||
TURN_PASSWORD,
|
TURN_PASSWORD,
|
||||||
JITSI_URL,
|
JITSI_URL,
|
||||||
JITSI_PRIVATE_MODE
|
JITSI_PRIVATE_MODE,
|
||||||
|
MAX_USERNAME_LENGTH,
|
||||||
|
MAX_PER_GROUP
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import {ResizableScene} from "./ResizableScene";
|
|||||||
import { localUserStore } from "../../Connexion/LocalUserStore";
|
import { localUserStore } from "../../Connexion/LocalUserStore";
|
||||||
import {MenuScene} from "../Menu/MenuScene";
|
import {MenuScene} from "../Menu/MenuScene";
|
||||||
import { isUserNameValid } from "../../Connexion/LocalUser";
|
import { isUserNameValid } from "../../Connexion/LocalUser";
|
||||||
|
import { MAX_USERNAME_LENGTH } from "../../Enum/EnvironmentVariable";
|
||||||
|
|
||||||
export const LoginSceneName = "LoginScene";
|
export const LoginSceneName = "LoginScene";
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ export class LoginScene extends ResizableScene {
|
|||||||
inputElement.value = localUserStore.getName() ?? '';
|
inputElement.value = localUserStore.getName() ?? '';
|
||||||
inputElement.focus();
|
inputElement.focus();
|
||||||
inputElement.addEventListener('keypress', (event: KeyboardEvent) => {
|
inputElement.addEventListener('keypress', (event: KeyboardEvent) => {
|
||||||
if(inputElement.value.length > 7){
|
if(inputElement.value.length >= MAX_USERNAME_LENGTH){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import "jasmine";
|
import "jasmine";
|
||||||
import {areCharacterLayersValid, isUserNameValid, maxUserNameLength} from "../../../src/Connexion/LocalUser";
|
import {areCharacterLayersValid, isUserNameValid} from "../../../src/Connexion/LocalUser";
|
||||||
|
import {MAX_USERNAME_LENGTH} from "../../../src/Enum/EnvironmentVariable";
|
||||||
|
|
||||||
describe("isUserNameValid()", () => {
|
describe("isUserNameValid()", () => {
|
||||||
it("should validate name with letters", () => {
|
it("should validate name with letters", () => {
|
||||||
@ -11,7 +12,7 @@ describe("isUserNameValid()", () => {
|
|||||||
});
|
});
|
||||||
it("should not validate string with too many letters", () => {
|
it("should not validate string with too many letters", () => {
|
||||||
let testString = '';
|
let testString = '';
|
||||||
for (let i = 0; i < maxUserNameLength + 2; i++) {
|
for (let i = 0; i < MAX_USERNAME_LENGTH + 2; i++) {
|
||||||
testString += 'a';
|
testString += 'a';
|
||||||
}
|
}
|
||||||
expect(isUserNameValid(testString)).toBe(false);
|
expect(isUserNameValid(testString)).toBe(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user