# Conflicts:
#	app/lib/features/chat/ui/transcript/chat_markdown_view.dart
This commit is contained in:
2026-11-21 17:11:45 +00:00
23 changed files with 1267 additions and 43 deletions
+21 -5
View File
@@ -1,3 +1,5 @@
import '../core/servers/chat/chat_identity.dart';
part 'app_route_codec.dart';
/// The destinations the app has a URL for.
@@ -174,11 +176,25 @@ class AppRoute {
/// A chat session id is nonempty, bounded and URL-safe, matching the web
/// parser. Anything else is malformed rather than a stale session the
/// destination has to guess about.
static bool isChatSessionId(String value) =>
value.isNotEmpty &&
value.length <= 200 &&
RegExp(r'^[A-Za-z0-9_-]+$').hasMatch(value);
/// destination has to guess about. With several machines connected, a
/// chat's id is its machine-scoped `chat@<base64url>` form
/// ([federatedChatId]); it is valid when it decodes to a machine and a
/// valid native id.
static bool isChatSessionId(String value) {
if (value.startsWith('chat@')) {
if (value.length > 1024 || !_urlSafe.hasMatch(value.substring(5))) {
return false;
}
final federated = parseFederatedChatId(value);
return federated != null && _isNativeChatId(federated.native);
}
return _isNativeChatId(value);
}
static final _urlSafe = RegExp(r'^[A-Za-z0-9_-]+$');
static bool _isNativeChatId(String value) =>
value.isNotEmpty && value.length <= 200 && _urlSafe.hasMatch(value);
@override
bool operator ==(Object other) =>