diff --git a/appview/oauth/accounts.go b/appview/oauth/accounts.go index 5197715e..08dd45a5 100644 --- a/appview/oauth/accounts.go +++ b/appview/oauth/accounts.go @@ -34,13 +34,6 @@ func (m *MultiAccountUser) Did() string { 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 index 7b35626c..db4e8c4c 100644 --- a/appview/oauth/accounts_test.go +++ b/appview/oauth/accounts_test.go @@ -249,7 +249,7 @@ func TestAccountRegistry_OtherAccounts(t *testing.T) { 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 index 4aa90221..414a80cb 100644 --- a/appview/oauth/oauth.go +++ b/appview/oauth/oauth.go @@ -233,7 +233,6 @@ func (o *OAuth) RemoveAccount(w http.ResponseWriter, r *http.Request, targetDid type User struct { Did string - Pds string } func (o *OAuth) GetUser(r *http.Request) *User { @@ -244,7 +243,6 @@ func (o *OAuth) GetUser(r *http.Request) *User { return &User{ Did: sess.Data.AccountDID.String(), - Pds: sess.Data.HostURL, } } diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index 63340d80..d63b3e51 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -76,6 +76,13 @@ func (p *Pages) funcMap() template.FuncMap { 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 index 5c9a874e..65ca5282 100644 --- 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 }}