Add feed sharing
This commit is contained in:
parent
84990c509e
commit
1ecf0da81b
5 changed files with 141 additions and 48 deletions
|
@ -2,9 +2,9 @@ import {useState, useEffect} from 'react'
|
|||
import {useStores} from 'state/index'
|
||||
import * as apilib from 'lib/api/index'
|
||||
import {getLinkMeta} from 'lib/link-meta/link-meta'
|
||||
import {getPostAsQuote} from 'lib/link-meta/bsky'
|
||||
import {getPostAsQuote, getFeedAsEmbed} from 'lib/link-meta/bsky'
|
||||
import {downloadAndResize} from 'lib/media/manip'
|
||||
import {isBskyPostUrl} from 'lib/strings/url-helpers'
|
||||
import {isBskyPostUrl, isBskyCustomFeedUrl} from 'lib/strings/url-helpers'
|
||||
import {ComposerOpts} from 'state/models/ui/shell'
|
||||
import {POST_IMG_MAX} from 'lib/constants'
|
||||
|
||||
|
@ -41,6 +41,24 @@ export function useExternalLinkFetch({
|
|||
setExtLink(undefined)
|
||||
},
|
||||
)
|
||||
} else if (isBskyCustomFeedUrl(extLink.uri)) {
|
||||
getFeedAsEmbed(store, extLink.uri).then(
|
||||
({embed, meta}) => {
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
setExtLink({
|
||||
uri: extLink.uri,
|
||||
isLoading: false,
|
||||
meta,
|
||||
embed,
|
||||
})
|
||||
},
|
||||
err => {
|
||||
store.log.error('Failed to fetch feed for embedding', {err})
|
||||
setExtLink(undefined)
|
||||
},
|
||||
)
|
||||
} else {
|
||||
getLinkMeta(store, extLink.uri).then(meta => {
|
||||
if (aborted) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue