backend for xcvr appview
3
fork

Configure Feed

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

fix nil deref

+12 -9
+4 -4
lexicons/org/xcvr/notes.lex
··· 94 94 media: record 95 95 signetURI: uri 96 96 union 97 - image 97 + image: image 98 98 | 99 - video 99 + video: video 100 100 nick?: string, bytes<=16 101 101 color?: int, [0 16777215] 102 102 postedAt?: date ··· 136 136 uri: uri 137 137 author: org.xcvr.lrc.profileView 138 138 union 139 - imageView 139 + imageView: imageView 140 140 | 141 - videoView 141 + videoView: videoView 142 142 nick?: string, bytes<=16 143 143 color?: int, [0 16777215] 144 144 signetURI: uri
+7 -4
server/internal/model/channelLexiconStream.go
··· 145 145 if err != nil { 146 146 return errors.New("failed to get profile view: " + err.Error()) 147 147 } 148 - ar := lex.AspectRatio{ 149 - Width: *media.Width, 150 - Height: *media.Height, 148 + var ar *lex.AspectRatio 149 + if media.Width != nil && media.Height != nil { 150 + ar = &lex.AspectRatio{ 151 + Width: *media.Width, 152 + Height: *media.Height, 153 + } 151 154 } 152 155 src := fmt.Sprintf("%s/xrpc/org.xcvr.lrc.getImage?uri=%s", os.Getenv("MY_IDENTITY"), media.URI) 153 156 154 157 img := types.ImageView{ 155 158 Alt: media.Alt, 156 159 Src: &src, 157 - AspectRatio: &ar, 160 + AspectRatio: ar, 158 161 } 159 162 mv := types.MediaView{ 160 163 URI: media.URI,
+1 -1
server/internal/types/lexicons.go
··· 231 231 Type string `json:"$type,const=org.xcvr.lrc.defs#mediaView"` 232 232 URI string `json:"uri"` 233 233 Author ProfileView `json:"author"` 234 - Image *ImageView `json:"imageView,omitempty"` 234 + Image *ImageView `json:"image,omitempty"` 235 235 Nick *string `json:"nick,omitempty"` 236 236 Color *uint32 `json:"color,omitempty"` 237 237 SignetURI string `json:"signetURI"`