grain.social is a photo sharing platform built on atproto.

fix: update photo schema to make alt optional and require aspectRatio and createdAt

Changed files
+10 -12
__generated__
types
social
grain
lexicons
social
grain
src
api
lib
routes
+2 -2
__generated__/lexicons.ts
··· 4269 4269 defs: { 4270 4270 photoView: { 4271 4271 type: 'object', 4272 - required: ['uri', 'cid', 'thumb', 'fullsize', 'alt'], 4272 + required: ['uri', 'cid', 'thumb', 'fullsize', 'aspectRatio'], 4273 4273 properties: { 4274 4274 uri: { 4275 4275 type: 'string', ··· 4682 4682 key: 'tid', 4683 4683 record: { 4684 4684 type: 'object', 4685 - required: ['photo', 'alt'], 4685 + required: ['photo', 'aspectRatio', 'createdAt'], 4686 4686 properties: { 4687 4687 photo: { 4688 4688 type: 'blob',
+3 -3
__generated__/types/social/grain/photo.ts
··· 15 15 $type: 'social.grain.photo' 16 16 photo: BlobRef 17 17 /** Alt text description of the image, for accessibility. */ 18 - alt: string 19 - aspectRatio?: SocialGrainDefs.AspectRatio 20 - createdAt?: string 18 + alt?: string 19 + aspectRatio: SocialGrainDefs.AspectRatio 20 + createdAt: string 21 21 [k: string]: unknown 22 22 } 23 23
+2 -2
__generated__/types/social/grain/photo/defs.ts
··· 24 24 /** Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. */ 25 25 fullsize: string 26 26 /** Alt text description of the image, for accessibility. */ 27 - alt: string 28 - aspectRatio?: SocialGrainDefs.AspectRatio 27 + alt?: string 28 + aspectRatio: SocialGrainDefs.AspectRatio 29 29 exif?: ExifView 30 30 gallery?: GalleryState 31 31 }
+1 -1
lexicons/social/grain/photo/defs.json
··· 4 4 "defs": { 5 5 "photoView": { 6 6 "type": "object", 7 - "required": ["uri", "cid", "thumb", "fullsize", "alt"], 7 + "required": ["uri", "cid", "thumb", "fullsize", "aspectRatio"], 8 8 "properties": { 9 9 "uri": { "type": "string", "format": "at-uri" }, 10 10 "cid": { "type": "string", "format": "cid" },
+1 -1
lexicons/social/grain/photo/photo.json
··· 7 7 "key": "tid", 8 8 "record": { 9 9 "type": "object", 10 - "required": ["photo", "alt"], 10 + "required": ["photo", "aspectRatio", "createdAt"], 11 11 "properties": { 12 12 "photo": { 13 13 "type": "blob",
-1
src/api/mod.ts
··· 264 264 const photoUri = await createPhoto( 265 265 { 266 266 photo: blobRef, 267 - alt: "", // @TODO: make this optional 268 267 aspectRatio: { 269 268 width, 270 269 height,
+1 -1
src/lib/photo.ts
··· 290 290 "social.grain.photo", 291 291 { 292 292 photo: data.photo, 293 - alt: data.alt || "", 293 + alt: data.alt, 294 294 aspectRatio: data.aspectRatio || undefined, 295 295 createdAt: new Date().toISOString(), 296 296 },
-1
src/routes/actions.tsx
··· 645 645 height, 646 646 } 647 647 : undefined, 648 - alt: "", 649 648 createdAt: new Date().toISOString(), 650 649 }, ctx); 651 650