Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

[APP-2044] Gate image blob size increase (#10178)

authored by

Eric Bailey and committed by
GitHub
cfeac097 c42940b0

+9 -1
+1
src/analytics/features/types.ts
··· 10 10 ImportContactsSettingsDisable = 'import_contacts:settings:disable', 11 11 LiveNowBetaDisable = 'live_now_beta:disable', 12 12 ImageUploadsHighResolution = 'image_uploads:high_resolution', 13 + ImageUploadsBlobSize2mbEnabled = 'image_uploads:blob_size_2mb:enabled', 13 14 GroupChatsEnable = 'group_chats:enable', 14 15 DmsNewMessageComposerEnable = 'dms:new_message_composer:enable', 15 16
+2
src/lib/api/index.ts
··· 53 53 54 54 type FeatureFlags = { 55 55 highResolutionImages?: boolean 56 + increasedBlobSizeLimit?: boolean 56 57 } 57 58 58 59 export async function post( ··· 320 321 logger.debug(`Compressing image #${i}`) 321 322 const {path, width, height, mime} = await compressImage(image, { 322 323 highResolution: featureFlags?.highResolutionImages, 324 + increasedBlobSizeLimit: featureFlags?.increasedBlobSizeLimit, 323 325 }) 324 326 logger.debug(`Uploading image #${i}`) 325 327 const res = await uploadBlob(agent, path, mime)
+3 -1
src/state/gallery.ts
··· 204 204 img: ComposerImage, 205 205 options?: { 206 206 highResolution?: boolean 207 + increasedBlobSizeLimit?: boolean 207 208 }, 208 209 ): Promise<PickerImage> { 209 210 const source = img.transformed || img.source ··· 211 212 212 213 let attempts = 0 213 214 let maxDimension = highResolution ? 4000 : POST_IMG_MAX.width 215 + let maxBytes = options?.increasedBlobSizeLimit ? 2000000 : POST_IMG_MAX.size 214 216 215 217 let minQualityPercentage = 0 216 218 let maxQualityPercentage = 101 // exclusive ··· 251 253 252 254 const base64 = res.base64 253 255 const size = base64 ? getDataUriSize(base64) : 0 254 - if (base64 && size <= POST_IMG_MAX.size) { 256 + if (base64 && size <= maxBytes) { 255 257 minQualityPercentage = qualityPercentage 256 258 newDataUri = { 257 259 path: await moveIfNecessary(res.uri),
+3
src/view/com/composer/Composer.tsx
··· 838 838 highResolutionImages: ax.features.enabled( 839 839 ax.features.ImageUploadsHighResolution, 840 840 ), 841 + increasedBlobSizeLimit: ax.features.enabled( 842 + ax.features.ImageUploadsBlobSize2mbEnabled, 843 + ), 841 844 }, 842 845 ) 843 846 ).uris[0]