tiny 88x31 lexicon for atproto
0
fork

Configure Feed

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

beebe

+17
+1
handler/handler.go
··· 39 39 mux.HandleFunc("GET /xrpc/store.88x31.getButton", h.WithCORS(h.getButton)) 40 40 mux.HandleFunc("GET /xrpc/store.88x31.getButtons", h.WithCORS(h.getButtons)) 41 41 mux.HandleFunc(oauthCallbackPath(), h.oauthCallback) 42 + mux.HandleFunc(clientMetadataPath(), h.WithCORS(h.serveClientMetadata)) 42 43 return h 43 44 } 44 45
+16
handler/oauthhandlers.go
··· 1 1 package handler 2 2 3 3 import ( 4 + "encoding/json" 4 5 "fmt" 5 6 "github.com/bluesky-social/indigo/atproto/auth/oauth" 6 7 "github.com/bluesky-social/indigo/atproto/syntax" ··· 9 10 "net/http" 10 11 "os" 11 12 "strings" 13 + myoauth "tangled.org/moth11.net/88x31/oauth" 12 14 ) 13 15 14 16 func (h *Handler) logout(cs *oauth.ClientSession, w http.ResponseWriter, r *http.Request) { ··· 49 51 func oauthCallbackPath() string { 50 52 mp := os.Getenv("MY_OAUTH_CALLBACK") 51 53 return fmt.Sprintf("GET %s", mp) 54 + } 55 + 56 + func clientMetadataPath() string { 57 + mp := os.Getenv("MY_METADATA_PATH") 58 + return fmt.Sprintf("GET %s", mp) 59 + } 60 + 61 + func (h *Handler) serveClientMetadata(w http.ResponseWriter, r *http.Request) { 62 + doc := h.oauth.App.Config.ClientMetadata() 63 + jwksuri := myoauth.GetClientMetadata().JWKSUri 64 + doc.JWKSURI = &jwksuri 65 + w.Header().Set("Content-Type", "application/json") 66 + encoder := json.NewEncoder(w) 67 + encoder.Encode(doc) 52 68 } 53 69 54 70 func (h *Handler) oauthCallback(w http.ResponseWriter, r *http.Request) {