feat: use t.gifs cdn for tenor search results (#8574)
This commit is contained in:
@@ -3,6 +3,7 @@ import {getLocales} from 'expo-localization'
|
||||
import {keepPreviousData, useInfiniteQuery} from '@tanstack/react-query'
|
||||
|
||||
import {GIF_FEATURED, GIF_SEARCH} from '#/lib/constants'
|
||||
import {logger} from '#/logger'
|
||||
|
||||
export const RQKEY_ROOT = 'gif-service'
|
||||
export const RQKEY_FEATURED = [RQKEY_ROOT, 'featured']
|
||||
@@ -86,6 +87,18 @@ function createTenorApi<Input extends object>(
|
||||
}
|
||||
}
|
||||
|
||||
export function tenorUrlToBskyGifUrl(tenorUrl: string) {
|
||||
let url
|
||||
try {
|
||||
url = new URL(tenorUrl)
|
||||
} catch (e) {
|
||||
logger.debug('invalid url passed to tenorUrlToBskyGifUrl()')
|
||||
return ''
|
||||
}
|
||||
url.hostname = 't.gifs.bsky.app'
|
||||
return url.href
|
||||
}
|
||||
|
||||
export type Gif = {
|
||||
/**
|
||||
* A Unix timestamp that represents when this post was created.
|
||||
|
||||
Reference in New Issue
Block a user