Merge branch 'app-2066' into app-2067

# Conflicts:
#	src/components/dialogs/GifSelect.tsx
This commit is contained in:
vineyardbovines
2026-04-15 13:55:22 -04:00
5 changed files with 52 additions and 20 deletions
+11 -8
View File
@@ -140,7 +140,7 @@ function createKlipyApi<Input extends object>(
},
})
if (!res.ok) {
throw new Error('Failed to fetch KLIPY API')
throw new Error(`Failed to fetch KLIPY API (status ${res.status})`)
}
const body: {next: string; results: Gif[]} = await res.json()
return {
@@ -151,18 +151,21 @@ function createKlipyApi<Input extends object>(
}
/**
* Returns the static URL for a KLIPY GIF preview image.
* KLIPY images are served directly from their CDN (static.klipy.com),
* unlike Tenor which routes through t.gifs.bsky.app.
* Rewrites a KLIPY static CDN URL through the bsky proxy
* (k.gifs.bsky.app). Mirrors `tenorUrlToBskyGifUrl`, but uses a
* separate hostname from Tenor's t.gifs.bsky.app so the two
* upstreams can be routed independently.
*/
export function klipyStaticUrl(gifUrl: string) {
export function klipyUrlToBskyGifUrl(klipyUrl: string) {
let url
try {
new URL(gifUrl)
return gifUrl
url = new URL(klipyUrl)
} catch (e) {
logger.debug('invalid url passed to klipyStaticUrl()')
logger.debug('invalid url passed to klipyUrlToBskyGifUrl()')
return ''
}
url.hostname = 'k.gifs.bsky.app'
return url.href
}
type KlipyAutocompleteResponse = {
+8 -3
View File
@@ -105,14 +105,19 @@ export function tenorUrlToBskyGifUrl(tenorUrl: string) {
/**
* Returns the appropriate URL for a GIF preview image.
* Rewrites Tenor URLs through the bsky proxy (t.gifs.bsky.app);
* KLIPY URLs pass through directly to their CDN.
* Tenor URLs (media.tenor.com) are routed through t.gifs.bsky.app;
* KLIPY URLs (static.klipy.com) are routed through k.gifs.bsky.app.
*/
export function gifPreviewUrl(gifUrl: string) {
try {
const url = new URL(gifUrl)
if (url.hostname === 'media.tenor.com') {
return tenorUrlToBskyGifUrl(gifUrl)
url.hostname = 't.gifs.bsky.app'
return url.href
}
if (url.hostname === 'static.klipy.com') {
url.hostname = 'k.gifs.bsky.app'
return url.href
}
return gifUrl
} catch (e) {