Ask for the password once and retry when a machine requires elevation

Carry the protocol error code, wrap each machine's gateway so an
elevation_required refusal shows one native password dialog, elevates that
connection and retries; send the upload token with file uploads; add a Settings
sign-in security section with the weak-password warning and sign out
everywhere; accept the __Host- session cookie.
This commit is contained in:
2026-11-10 01:21:28 +00:00
parent e43f9fa50c
commit 9702d68d2d
30 changed files with 1464 additions and 31 deletions
+14 -1
View File
@@ -3,6 +3,8 @@ import 'dart:async';
import 'package:flutter/foundation.dart';
import '../core/api_gateway.dart';
import '../core/servers/elevation/elevating_gateway.dart';
import '../core/servers/elevation/machine_elevation.dart';
import '../core/transport/pipelines_client.dart';
/// Whether this connection's send-only `subscribe` was accepted.
@@ -32,8 +34,17 @@ class AppSession extends ChangeNotifier {
_everConnected = knownServer {
_states = _client.states.listen(_onState);
_frames = _client.frames.listen(_onFrame);
_elevation = MachineElevation(
name: endpoint?.host.isNotEmpty == true ? endpoint!.host : 'this server',
gateway: _client,
states: _client.states,
);
_gateway = ElevatingGateway(_client, _elevation);
}
late final MachineElevation _elevation;
late final ElevatingGateway _gateway;
final Uri? _initialEndpoint;
final List<Uri>? _initialAddresses;
final PipelinesClient _client;
@@ -47,7 +58,8 @@ class AppSession extends ChangeNotifier {
String _subscriptionError = '';
String? _subscribeRequest;
ApiGateway get gateway => _client;
/// Feature requests; a step-up refusal asks for the password and retries.
ApiGateway get gateway => _gateway;
/// Settings controls the same transport; it must never create another socket.
PipelinesClient get client => _client;
@@ -180,6 +192,7 @@ class AppSession extends ChangeNotifier {
_disposed = true;
_sendUnsubscribe();
unawaited(_states.cancel());
unawaited(_elevation.dispose());
unawaited(_frames.cancel());
unawaited(_client.dispose());
super.dispose();