Monorepo for Tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/oauth/handler: fix client metadata json file path

According to this patch:
https://github.com/bluesky-social/atproto/blob/5f37211cf550b31a693cb174f1fe1d0cfee78294/packages/oauth/oauth-provider-ui/CHANGELOG.md?plain=1#L143

the client metadata json files must be served exactly at
<hostname>/oauth-client-metadata.json in order to not have
the PDS authentication page display an ugly json url.

The file handler is also introduced on the main router because of
the wildcard user handle routes.

Signed-off-by: edouardparis <m@edouard.paris>

+6 -3
+4 -2
appview/oauth/handler.go
··· 31 31 func (o *OAuth) Router() http.Handler { 32 32 r := chi.NewRouter() 33 33 34 - r.Get("/oauth/client-metadata.json", o.clientMetadata) 34 + r.Get("/oauth-client-metadata.json", o.ClientMetadata) 35 35 r.Get("/oauth/jwks.json", o.jwks) 36 36 r.Get("/oauth/callback", o.callback) 37 37 return r 38 38 } 39 39 40 - func (o *OAuth) clientMetadata(w http.ResponseWriter, r *http.Request) { 40 + func (o *OAuth) ClientMetadata(w http.ResponseWriter, r *http.Request) { 41 41 doc := o.ClientApp.Config.ClientMetadata() 42 42 doc.JWKSURI = &o.JwksUri 43 43 doc.ClientName = &o.ClientName 44 44 doc.ClientURI = &o.ClientUri 45 45 doc.Scope = doc.Scope + " identity:handle" 46 + logoURI := o.ClientUri + "/static/logos/dolly_white.png" 47 + doc.LogoURI = &logoURI 46 48 47 49 w.Header().Set("Content-Type", "application/json") 48 50 if err := json.NewEncoder(w).Encode(doc); err != nil {
+1 -1
appview/oauth/oauth.go
··· 50 50 oauthConfig = oauth.NewLocalhostConfig(callbackUri, TangledScopes) 51 51 } else { 52 52 clientUri = "https://" + config.Core.AppviewHost 53 - clientId := fmt.Sprintf("%s/oauth/client-metadata.json", clientUri) 53 + clientId := fmt.Sprintf("%s/oauth-client-metadata.json", clientUri) 54 54 callbackUri := clientUri + "/oauth/callback" 55 55 oauthConfig = oauth.NewPublicConfig(clientId, callbackUri, TangledScopes) 56 56 }
+1
appview/state/router.go
··· 40 40 router.Get("/pwa-manifest.json", s.WebAppManifest) 41 41 router.Get("/robots.txt", s.RobotsTxt) 42 42 router.Get("/.well-known/security.txt", s.SecurityTxt) 43 + router.Get("/oauth-client-metadata.json", s.oauth.ClientMetadata) 43 44 44 45 userRouter := s.UserRouter(&middleware) 45 46 standardRouter := s.StandardRouter(&middleware)