Clear the refusal of the route a proxy sign-in renewed, not the one in use after it

This commit is contained in:
cogwheel 2026-10-08 17:46:38 +05:30
parent 8d072c99ba
commit f1b5cb87cc
3 changed files with 30 additions and 8 deletions

View file

@ -164,6 +164,9 @@ class _ConnectionIssuePageState extends ConsumerState<ConnectionIssuePage> {
ServerConfig activeServer,
AppLocalizations l10n,
) async {
// The route [activeServer] was read from, which the cookies are saved
// to; the app can move to another while the sign-in is open.
final renewedRoute = ref.read(openWebUiRouteResolverProvider).endpointId;
final result = await context.pushNamed<ProxyAuthResult>(
RouteNames.proxyAuth,
extra: ProxyAuthConfig(serverConfig: activeServer),
@ -199,7 +202,9 @@ class _ConnectionIssuePageState extends ConsumerState<ConnectionIssuePage> {
ref.invalidate(serverConfigsProvider);
ref.invalidate(activeServerProvider);
// Its refusals were of the session just replaced.
ref.read(openWebUiRouteResolverProvider.notifier).proxySessionRenewed();
ref
.read(openWebUiRouteResolverProvider.notifier)
.proxySessionRenewed(renewedRoute);
await ref.read(activeServerProvider.future);
if (!mounted) return;

View file

@ -483,11 +483,11 @@ class OpenWebUiRouteResolver extends Notifier<OpenWebUiRouteStatus> {
ref.read(accountChangeReplyGuardProvider)() ||
ref.read(openWebUiSignInPendingProvider)();
/// The proxy session of the route in use was signed in to again: its
/// refusals were of the session replaced. Another route's stand.
void proxySessionRenewed() {
final route = _inUseRouteId;
if (route != null) _refused.remove(route);
/// The proxy session of [endpointId], the route in use when its sign-in
/// began, was signed in to again: its refusals were of the session
/// replaced. Another route's stand, though the app moved to it meanwhile.
void proxySessionRenewed(String? endpointId) {
if (endpointId != null) _refused.remove(endpointId);
}
/// The addresses of [serverId] were saved, and checked again. A refusal

View file

@ -667,7 +667,7 @@ void main() {
ConnectivityService.reportRouteRejected(Uri.parse(_lan));
await until(() => routes.state.noneAnswered);
routes.proxySessionRenewed();
routes.proxySessionRenewed(routes.state.endpointId);
answers[_public] = true;
await routes.resolve(reason: 'resumed');
@ -684,12 +684,29 @@ void main() {
ConnectivityService.reportRouteRejected(Uri.parse(_lan));
await until(() => routes.state.endpointId == 'public');
routes.proxySessionRenewed();
routes.proxySessionRenewed(routes.state.endpointId);
await routes.resolve(reason: 'resumed');
check(await routeInUse()).equals(_public);
});
// The app can move away from the route while its sign-in is open; the
// renewed session is still that route's.
test('is taken up again when renewed after a move away from it', () async {
answers = {_lan: true, _tailscale: false, _public: true};
final routes = await resolver();
await routes.resolve();
// In use as its sign-in begins.
final renewed = routes.state.endpointId;
ConnectivityService.reportRouteRejected(Uri.parse(_lan));
await until(() => routes.state.endpointId == 'public');
routes.proxySessionRenewed(renewed);
await routes.resolve(reason: 'resumed');
check(await routeInUse()).equals(_lan);
});
test('moves even while a reply is being written', () async {
answers = {_lan: false, _tailscale: false, _public: true};
final routes = await resolver();