From 1614459dc4f0756200b386b767c1afa15fcc82ea Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Sun, 25 Jan 2026 11:57:12 +0000 Subject: [PATCH] appview/oauth: remove `AuthReturnInfo` Signed-off-by: Seongmin Lee --- appview/oauth/accounts.go | 12 +++--------- appview/oauth/handler.go | 8 +++----- 2 file(s) changed, 6 insertion(s)(+), 14 deletion(s)(-) diff --git a/appview/oauth/accounts.go b/appview/oauth/accounts.go --- a/appview/oauth/accounts.go +++ b/appview/oauth/accounts.go @@ -126,10 +126,6 @@ Accounts: registry.Accounts, } } -type AuthReturnInfo struct { - ReturnURL string -} - func (o *OAuth) SetAuthReturn(w http.ResponseWriter, r *http.Request, returnURL string) error { session, err := o.SessStore.Get(r, AuthReturnName) if err != nil { @@ -145,17 +141,15 @@ return session.Save(r, w) } -func (o *OAuth) GetAuthReturn(r *http.Request) *AuthReturnInfo { +func (o *OAuth) GetAuthReturn(r *http.Request) string { session, err := o.SessStore.Get(r, AuthReturnName) if err != nil || session.IsNew { - return &AuthReturnInfo{} + return "" } returnURL, _ := session.Values[AuthReturnURL].(string) - return &AuthReturnInfo{ - ReturnURL: returnURL, - } + return returnURL } func (o *OAuth) ClearAuthReturn(w http.ResponseWriter, r *http.Request) error { diff --git a/appview/oauth/handler.go b/appview/oauth/handler.go --- a/appview/oauth/handler.go +++ b/appview/oauth/handler.go @@ -100,12 +100,10 @@ o.Logger.Error("failed to enqueue posthog event", "err", err) } } - redirectURL := "/" - if authReturn.ReturnURL != "" { - redirectURL = authReturn.ReturnURL + if authReturn == "" { + authReturn = "/" } - - http.Redirect(w, r, redirectURL, http.StatusFound) + http.Redirect(w, r, authReturn, http.StatusFound) } func (o *OAuth) addToDefaultSpindle(did string) { -- tangled.sh