Scope native session credentials to trusted logical servers

This commit is contained in:
2026-10-24 02:27:39 +01:00
parent 54f74ade33
commit ae72e0fcf3
8 changed files with 496 additions and 19 deletions
@@ -14,7 +14,7 @@ Future<ArtifactFetchResult> fetchArtifact(Uri uri) async {
final request = await client.getUrl(uri);
request.followRedirects = false;
// A phone behind the web login carries its kept session.
ServerSession.headers.forEach(request.headers.set);
ServerSession.headersFor(uri).forEach(request.headers.set);
final response = await request.close();
final bytes = BytesBuilder(copy: false);
await for (final chunk in response) {
@@ -16,7 +16,7 @@ Future<ChatUploadReply> postChatUpload(
final request = await client.postUrl(uri);
request.followRedirects = false;
// A phone behind the web login carries its kept session.
ServerSession.headers.forEach(request.headers.set);
ServerSession.headersFor(uri).forEach(request.headers.set);
request.headers
..set(chatUploadNameHeader, Uri.encodeComponent(name))
..set(HttpHeaders.contentTypeHeader, mime)
+2 -1
View File
@@ -16,8 +16,9 @@ Future<int?> installedVersionCode() async {
Future<HttpClientResponse> _get(HttpClient client, Uri uri) async {
final request = await client.getUrl(uri);
request.followRedirects = false;
// The updates sit behind the same web login the app signed in to.
ServerSession.headers.forEach(request.headers.set);
ServerSession.headersFor(uri).forEach(request.headers.set);
final response = await request.close();
if (response.statusCode == 401 || response.statusCode == 302) {
await response.drain<void>();