forked from Nexus/nexus
add room directory support
This commit is contained in:
parent
033c7f9c05
commit
e382499a2a
1 changed files with 868 additions and 245 deletions
|
|
@ -4,6 +4,12 @@ extension GetLocalpart on String {
|
|||
/// Whether this looks like a valid Matrix user ID, e.g. `@user:example.com`.
|
||||
bool get isValidUserId => RegExp(r"^@[^:\s]+:[^\s]+$").hasMatch(this);
|
||||
|
||||
/// Whether this is a valid Matrix server name, e.g. `example.com:8448`.
|
||||
bool get isValidServerName => RegExp(
|
||||
r"^(\[[0-9a-f:.]+\]|[a-z0-9.-]{1,255})(:\d{1,5})?$",
|
||||
caseSensitive: false,
|
||||
).hasMatch(this);
|
||||
|
||||
String? get serverName {
|
||||
final index = indexOf(":");
|
||||
return index == -1 ? null : substring(index + 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue