a tool for shared writing and social publishing
0
fork

Configure Feed

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

don't optimisitcally add image if in env w/o sw

+14 -15
+14 -15
src/utils/addImage.ts
··· 28 28 }, 29 29 }), 30 30 ); 31 - //This may reach other clients before the image has been uploaded. 32 - // Maybe we should set the state to uploaded-by (client_ID) or something 33 - // and then set the real one after. 31 + 34 32 let thumbhash = await getThumbHash(file); 35 - await rep.mutate.assertFact({ 36 - entity: args.entityID, 37 - attribute: "block/image", 38 - data: { 39 - fallback: thumbhash, 40 - type: "image", 41 - local: rep.clientID, 42 - src: url, 43 - height: dimensions.height, 44 - width: dimensions.width, 45 - }, 46 - }); 33 + if (navigator.serviceWorker) 34 + await rep.mutate.assertFact({ 35 + entity: args.entityID, 36 + attribute: "block/image", 37 + data: { 38 + fallback: thumbhash, 39 + type: "image", 40 + local: rep.clientID, 41 + src: url, 42 + height: dimensions.height, 43 + width: dimensions.width, 44 + }, 45 + }); 47 46 await client.storage.from("minilink-user-assets").upload(fileID, file); 48 47 await rep.mutate.assertFact({ 49 48 entity: args.entityID,