Merge commit '394fd672'

This commit is contained in:
2026-11-08 16:49:58 +00:00
16 changed files with 615 additions and 58 deletions
+22
View File
@@ -85,6 +85,28 @@ class ServerSession {
return headers;
}
/// Read one profile without changing the selected socket or credentials.
static Future<Map<String, String> Function(Uri)> credentialReader({
required String id,
required Iterable<Uri> endpoints,
}) async {
final origins = endpoints.map(loginUriFor).whereType<Uri>().toSet();
final key = _scopeKey(id);
final version = _versions[key];
final value = id == _serverId
? cookie
: (await SharedPreferences.getInstance()).getString(key);
return (Uri uri) {
if (_versions[key] != version ||
!origins.contains(loginUriFor(uri)) ||
value == null ||
value.isEmpty) {
return const <String, String>{};
}
return <String, String>{'Cookie': value};
};
}
static Future<void> load() async {
final generation = ++_generation;
_serverId = null;