added local play by pressing cancel on the JS prompt

removed the uncessesary null check in the validate_name
This commit is contained in:
2026-06-02 12:14:14 +01:00
parent 0e4d5d7686
commit 219f4086aa
4 changed files with 48 additions and 31 deletions
+5 -14
View File
@@ -444,21 +444,12 @@ async fn handle_socket
fn validate_name(input: &str) -> &str {
let input = input.trim();
if input == "null"
// Allow only letters, numbers, _ and -
let re = Regex::new(r"^[a-zA-Z0-9_-]+$").unwrap();
// Length check
if input.is_empty() || input.len() > 32 || !re.is_match(input)
{
return "anon";
}
// Length check
if input.is_empty() || input.len() > 32 {
return "anon";
}
// Allow only letters, numbers, _ and -
let re = Regex::new(r"^[a-zA-Z0-9_-]+$").unwrap();
if re.is_match(input) {
input
} else {
"anon"
}
input
}