Bluesky app fork with some witchin' additions 💫

Remove unneeded spaces from PR ('Refactor code formatting for consistency in imports and object destructuring')

xan.lol 9e7d80ca f8263abe

verified
+27 -27
+23 -23
src/lib/api/index.ts
··· 14 14 type ComAtprotoRepoStrongRef, 15 15 RichText, 16 16 } from '@atproto/api' 17 - import { TID } from '@atproto/common-web' 17 + import {TID} from '@atproto/common-web' 18 18 import * as dcbor from '@ipld/dag-cbor' 19 - import { t } from '@lingui/macro' 20 - import { type QueryClient } from '@tanstack/react-query' 21 - import { sha256 } from 'js-sha256' 22 - import { CID } from 'multiformats/cid' 19 + import {t} from '@lingui/macro' 20 + import {type QueryClient} from '@tanstack/react-query' 21 + import {sha256} from 'js-sha256' 22 + import {CID} from 'multiformats/cid' 23 23 import * as Hasher from 'multiformats/hashes/hasher' 24 24 25 - import { isNetworkError } from '#/lib/strings/errors' 26 - import { shortenLinks, stripInvalidMentions, parseMarkdownLinks } from '#/lib/strings/rich-text-manip' 27 - import { logger } from '#/logger' 28 - import { compressImage } from '#/state/gallery' 25 + import {isNetworkError} from '#/lib/strings/errors' 26 + import {shortenLinks, stripInvalidMentions, parseMarkdownLinks} from '#/lib/strings/rich-text-manip' 27 + import {logger} from '#/logger' 28 + import {compressImage} from '#/state/gallery' 29 29 import { 30 30 fetchResolveGifQuery, 31 31 fetchResolveLinkQuery, ··· 39 39 type PostDraft, 40 40 type ThreadDraft, 41 41 } from '#/view/com/composer/state/composer' 42 - import { createGIFDescription } from '../gif-alt-text' 43 - import { uploadBlob } from './upload-blob' 42 + import {createGIFDescription} from '../gif-alt-text' 43 + import {uploadBlob} from './upload-blob' 44 44 45 - export { uploadBlob } 45 + export {uploadBlob} 46 46 47 47 interface PostOpts { 48 48 thread: ThreadDraft ··· 96 96 if (draft.labels.length) { 97 97 labels = { 98 98 $type: 'com.atproto.label.defs#selfLabels', 99 - values: draft.labels.map(val => ({ val })), 99 + values: draft.labels.map(val => ({val})), 100 100 } 101 101 } 102 102 ··· 190 190 } 191 191 } 192 192 193 - return { uris } 193 + return {uris} 194 194 } 195 195 196 196 async function resolveRT(agent: BskyAgent, richtext: RichText) { ··· 200 200 // Trim any trailing whitespace. 201 201 .trimEnd() 202 202 203 - const { text: parsedText, facets: markdownFacets } = 203 + const {text: parsedText, facets: markdownFacets} = 204 204 parseMarkdownLinks(trimmedText) 205 205 206 - let rt = new RichText({ text: parsedText }, { cleanNewlines: true }) 206 + let rt = new RichText({text: parsedText}, {cleanNewlines: true}) 207 207 await rt.detectFacets(agent) 208 208 209 209 if (markdownFacets.length > 0) { ··· 325 325 const images: AppBskyEmbedImages.Image[] = await Promise.all( 326 326 imagesDraft.map(async (image, i) => { 327 327 logger.debug(`Compressing image #${i}`) 328 - const { path, width, height, mime } = await compressImage(image) 328 + const {path, width, height, mime} = await compressImage(image) 329 329 logger.debug(`Uploading image #${i}`) 330 330 const res = await uploadBlob(agent, path, mime) 331 331 return { 332 332 image: res.data.blob, 333 333 alt: image.alt, 334 - aspectRatio: { width, height }, 334 + aspectRatio: {width, height}, 335 335 } 336 336 }), 337 337 ) ··· 349 349 videoDraft.captions 350 350 .filter(caption => caption.lang !== '') 351 351 .map(async caption => { 352 - const { data } = await agent.uploadBlob(caption.file, { 352 + const {data} = await agent.uploadBlob(caption.file, { 353 353 encoding: 'text/vtt', 354 354 }) 355 - return { lang: caption.lang, file: data.blob } 355 + return {lang: caption.lang, file: data.blob} 356 356 }), 357 357 ) 358 358 ··· 362 362 363 363 // aspect ratio values must be >0 - better to leave as unset otherwise 364 364 // posting will fail if aspect ratio is set to 0 365 - const aspectRatio = width > 0 && height > 0 ? { width, height } : undefined 365 + const aspectRatio = width > 0 && height > 0 ? {width, height} : undefined 366 366 367 367 if (!aspectRatio) { 368 368 logger.error( ··· 388 388 let blob: BlobRef | undefined 389 389 if (resolvedGif.thumb) { 390 390 onStateChange?.(t`Uploading link thumbnail...`) 391 - const { path, mime } = resolvedGif.thumb.source 391 + const {path, mime} = resolvedGif.thumb.source 392 392 const response = await uploadBlob(agent, path, mime) 393 393 blob = response.data.blob 394 394 } ··· 412 412 let blob: BlobRef | undefined 413 413 if (resolvedLink.thumb) { 414 414 onStateChange?.(t`Uploading link thumbnail...`) 415 - const { path, mime } = resolvedLink.thumb.source 415 + const {path, mime} = resolvedLink.thumb.source 416 416 const response = await uploadBlob(agent, path, mime) 417 417 blob = response.data.blob 418 418 }
+4 -4
src/lib/strings/rich-text-manip.ts
··· 1 - import { AppBskyRichtextFacet, type RichText, UnicodeString } from '@atproto/api' 1 + import {AppBskyRichtextFacet,type RichText,UnicodeString} from '@atproto/api' 2 2 3 - import { toShortUrl } from './url-helpers' 3 + import {toShortUrl} from './url-helpers' 4 4 5 5 export function shortenLinks(rt: RichText): RichText { 6 6 if (!rt.facets?.length) { ··· 16 16 } 17 17 18 18 // extract and shorten the URL 19 - const { byteStart, byteEnd } = facet.index 19 + const {byteStart, byteEnd} = facet.index 20 20 const url = rt.unicodeText.slice(byteStart, byteEnd) 21 21 const shortened = new UnicodeString(toShortUrl(url)) 22 22 ··· 90 90 91 91 newText += text.slice(lastIndex) 92 92 93 - return { text: newText, facets } 93 + return {text: newText, facets} 94 94 }