An atproto PDS written in Go
at main 515 B view raw
1package server 2 3import ( 4 "encoding/json" 5 6 "github.com/haileyok/cocoon/models" 7 "github.com/labstack/echo/v4" 8) 9 10// This is kinda lame. Not great to implement app.bsky in the pds, but alas 11 12func (s *Server) handleActorGetPreferences(e echo.Context) error { 13 repo := e.Get("repo").(*models.RepoActor) 14 15 var prefs map[string]any 16 err := json.Unmarshal(repo.Preferences, &prefs) 17 if err != nil || prefs["preferences"] == nil { 18 prefs = map[string]any{ 19 "preferences": []any{}, 20 } 21 } 22 23 return e.JSON(200, prefs) 24}