diff --git a/appview/oauth/accounts.go b/appview/oauth/accounts.go --- a/appview/oauth/accounts.go +++ b/appview/oauth/accounts.go @@ -34,13 +34,6 @@ return m.Active.Did } -func (m *MultiAccountUser) Pds() string { - if m.Active == nil { - return "" - } - return m.Active.Pds -} - func (o *OAuth) GetAccounts(r *http.Request) *AccountRegistry { session, err := o.SessStore.Get(r, AccountsName) if err != nil || session.IsNew { diff --git a/appview/oauth/accounts_test.go b/appview/oauth/accounts_test.go --- a/appview/oauth/accounts_test.go +++ b/appview/oauth/accounts_test.go @@ -249,7 +249,7 @@ func TestMultiAccountUser_Did(t *testing.T) { t.Run("with active user", func(t *testing.T) { user := &MultiAccountUser{ - Active: &User{Did: "did:plc:test", Pds: "https://bsky.social"}, + Active: &User{Did: "did:plc:test"}, } if user.Did() != "did:plc:test" { t.Errorf("Did() = %s, want did:plc:test", user.Did()) diff --git a/appview/oauth/oauth.go b/appview/oauth/oauth.go --- a/appview/oauth/oauth.go +++ b/appview/oauth/oauth.go @@ -233,7 +233,6 @@ type User struct { Did string - Pds string } func (o *OAuth) GetUser(r *http.Request) *User { @@ -244,7 +243,6 @@ return &User{ Did: sess.Data.AccountDID.String(), - Pds: sess.Data.HostURL, } } diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -76,6 +76,13 @@ return identity.Handle.String() }, + "resolvePds": func(s string) string { + identity, err := p.resolver.ResolveIdent(context.Background(), s) + if err != nil { + return "" + } + return identity.PDSEndpoint() + }, "ownerSlashRepo": func(repo *models.Repo) string { ownerId, err := p.resolver.ResolveIdent(context.Background(), repo.Did) if err != nil { diff --git a/appview/pages/templates/user/settings/profile.html b/appview/pages/templates/user/settings/profile.html --- a/appview/pages/templates/user/settings/profile.html +++ b/appview/pages/templates/user/settings/profile.html @@ -54,7 +54,7 @@ Personal Data Server (PDS) - {{ .LoggedInUser.Pds }} + {{ resolvePds .LoggedInUser.Did }}