feat: use t.gifs cdn for tenor search results (#8574)

This commit is contained in:
hailey
2025-06-30 13:24:53 -07:00
committed by GitHub
parent 5e20d5ffab
commit 806d3792a9
3 changed files with 34 additions and 4 deletions
+13
View File
@@ -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.