Smart disconnect + human-readable room IDs + expanded word lists

- Add currentServerUrl tracking: only disconnect/reconnect when server URL actually
  changes, otherwise reuse existing connection and just switch rooms
- Add resolveServerUrl() helper for consistent URL resolution across handlers
- forceDisconnect() now resets currentServerUrl to null
- CONNECT and WEB_JOIN_REQUEST handlers: smart comparison before reconnecting
- Add generateRoomId(): human-readable 'ADJECTIVE-NOUN-Number' format (e.g. HAPPY-KOALA-16)
- Replace Math.random() room IDs with generateRoomId() in joinBtn and handleCreateRoom()
- Expand USERNAME_ADJECTIVES: +16 words (Turbo, Zen, Pixel, Cyber, Solar, etc.)
- Expand USERNAME_NOUNS: +12 words (Yeti, Goblin, Pirate, Ninja, Wizard, Storm, etc.)
- Add emoji mappings for all new words
This commit is contained in:
Timo
2026-06-01 13:29:02 +02:00
parent f2669ed769
commit a1f921407c
3 changed files with 65 additions and 8 deletions
+18 -1
View File
@@ -19,7 +19,9 @@ export const USERNAME_ADJECTIVES = [
'Happy', 'Cool', 'Fast', 'Smart', 'Brave', 'Calm', 'Sneaky', 'Lazy',
'Wild', 'Chill', 'Lucky', 'Epic', 'Swift', 'Bold', 'Mighty',
'Cosmic', 'Neon', 'Shadow', 'Crystal', 'Thunder', 'Silent', 'Golden',
'Fierce', 'Noble', 'Mystic', 'Frozen', 'Blazing', 'Sapphire', 'Iron', 'Crimson'
'Fierce', 'Noble', 'Mystic', 'Frozen', 'Blazing', 'Sapphire', 'Iron', 'Crimson',
'Turbo', 'Zen', 'Pixel', 'Cyber', 'Solar', 'Lunar', 'Astro', 'Hyper',
'Steel', 'Rogue', 'Alpha', 'Omega', 'Royal', 'Pixel', 'Warp', 'Frost',
];
export const USERNAME_NOUNS = [
@@ -44,6 +46,8 @@ export const USERNAME_NOUNS = [
'Beetle', 'Snail', 'Dragonfly', 'Caterpillar',
'Alien', 'Robot', 'Mermaid', 'Ghoul', 'Sprite', 'Cyborg',
'Dinosaur', 'Reaper', 'Wraith', 'Sphinx',
'Yeti', 'Goblin', 'Pirate', 'Ninja', 'Samurai', 'Wizard', 'Knight',
'Bandit', 'Storm', 'Comet', 'Nebula', 'Quasar', 'Vortex',
];
export const ANIMAL_EMOJI_MAP = {
@@ -262,6 +266,19 @@ export const ANIMAL_EMOJI_MAP = {
'croc': '🐊',
'gnat': '🦟',
'gnu': '🦬',
'yeti': '🦍',
'goblin': '👺',
'pirate': '🏴',
'ninja': '🥷',
'samurai': '🥷',
'wizard': '🧙',
'knight': '⚔️',
'bandit': '🦹',
'storm': '🌩️',
'comet': '☄️',
'nebula': '🌌',
'quasar': '🌟',
'vortex': '🌪️',
};
export function getAvatarForName(username) {