From 1ef27cc47ad56a2c66aaa40e398a0063be2573d4 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 9 May 2022 14:18:23 +0200 Subject: FSM/State: Profile correctness and connect name change Also add a force tcp flag --- internal/api.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'internal/api.go') diff --git a/internal/api.go b/internal/api.go index a987f00..b615976 100644 --- a/internal/api.go +++ b/internal/api.go @@ -24,8 +24,12 @@ func apiAuthorized(server Server, method string, endpoint string, opts *HTTPOpti url := base.Endpoints.API.V3.API + endpoint // Ensure we have valid tokens + stateBefore := base.FSM.Current oauthErr := EnsureTokens(server) + // we reset the state so that we go from the authorized state to the state we want + base.FSM.Current = stateBefore + if oauthErr != nil { return nil, nil, oauthErr } @@ -83,7 +87,11 @@ func APIInfo(server Server) error { if baseErr != nil { return &APIInfoError{Err: baseErr} } + + // Store the profiles and make sure that the current profile is not overwritten + previousProfile := base.Profiles.Current base.Profiles = structure + base.Profiles.Current = previousProfile base.ProfilesRaw = string(body) return nil } -- cgit v1.2.3