mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-05 20:25:27 +00:00
* updata validation on public games
This commit is contained in:
@@ -11,7 +11,6 @@ import { Client } from './Client';
|
||||
import { GamePhase, GameServer } from './GameServer';
|
||||
import { archive } from './Archive';
|
||||
import { DiscordBot } from './DiscordBot';
|
||||
import {MAX_USERNAME_LENGTH, MIN_USERNAME_LENGTH} from "../core/Util";
|
||||
import {validateUsername} from "../core/validations/username";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
@@ -121,16 +120,6 @@ app.get('/private_lobby/:id', (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/validate-username', (req, res) => {
|
||||
const { username } = req.body;
|
||||
|
||||
if (!username || username.length < MIN_USERNAME_LENGTH || username.length > MAX_USERNAME_LENGTH) {
|
||||
return res.status(400).json({ success: false, error: `Username must be between ${MIN_USERNAME_LENGTH} and ${MAX_USERNAME_LENGTH} characters.` });
|
||||
}
|
||||
|
||||
res.json({ success: true, message: 'Username is valid.' });
|
||||
});
|
||||
|
||||
wss.on('connection', (ws, req) => {
|
||||
ws.on('message', (message: string) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user