mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-21 03:40:59 +03:00
support Unicode IDs in whitelist settings
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -362,11 +362,11 @@ void changeIdWhiteList({Function()? callback}) async {
|
|||||||
.split(RegExp(r"[\s,;\n]+"))
|
.split(RegExp(r"[\s,;\n]+"))
|
||||||
.where((e) => e.isNotEmpty)
|
.where((e) => e.isNotEmpty)
|
||||||
.toList();
|
.toList();
|
||||||
// test id, wildcards '*' and '?' are allowed;
|
// Separators are handled above; allow all other Unicode characters.
|
||||||
// '@' '.' ':' '/' '[' ']' occur in cross-server IDs and WebSocket URIs
|
|
||||||
final idMatch = RegExp(r"^[a-zA-Z0-9_*?@.:/\[\]-]+$");
|
|
||||||
for (final id in ids) {
|
for (final id in ids) {
|
||||||
if (!idMatch.hasMatch(id)) {
|
final hasControlCharacters = id.runes.any(
|
||||||
|
(char) => char <= 0x1f || (char >= 0x7f && char <= 0x9f));
|
||||||
|
if (hasControlCharacters) {
|
||||||
msg = "${translate("Invalid ID")} $id";
|
msg = "${translate("Invalid ID")} $id";
|
||||||
setState(() {
|
setState(() {
|
||||||
isInProgress = false;
|
isInProgress = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user