update klipy cdn path

This commit is contained in:
vineyardbovines
2026-04-15 13:33:26 -04:00
parent c402fbbe26
commit ceea6bcf3c
4 changed files with 19 additions and 14 deletions
+4 -2
View File
@@ -684,9 +684,11 @@ export function parseKlipyGif(urlp: URL):
}
// Use the base URL without dimension params as the player URI,
// routed through the bsky proxy (t.gifs.bsky.app) — matching Tenor.
// routed through the bsky KLIPY proxy (k.gifs.bsky.app). Mirrors
// Tenor's t.gifs.bsky.app rewrite, but on a separate hostname so
// the two upstreams can be routed independently.
const playerUrl = new URL(urlp.href)
playerUrl.hostname = 't.gifs.bsky.app'
playerUrl.hostname = 'k.gifs.bsky.app'
playerUrl.searchParams.delete('hh')
playerUrl.searchParams.delete('ww')
+4 -2
View File
@@ -91,7 +91,9 @@ function createKlipyApi<Input extends object>(
/**
* Rewrites a KLIPY static CDN URL through the bsky proxy
* (t.gifs.bsky.app), matching the behavior of `tenorUrlToBskyGifUrl`.
* (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 klipyUrlToBskyGifUrl(klipyUrl: string) {
let url
@@ -101,6 +103,6 @@ export function klipyUrlToBskyGifUrl(klipyUrl: string) {
logger.debug('invalid url passed to klipyUrlToBskyGifUrl()')
return ''
}
url.hostname = 't.gifs.bsky.app'
url.hostname = 'k.gifs.bsky.app'
return url.href
}
+7 -6
View File
@@ -105,19 +105,20 @@ export function tenorUrlToBskyGifUrl(tenorUrl: string) {
/**
* Returns the appropriate URL for a GIF preview image.
* Both Tenor (media.tenor.com) and KLIPY (static.klipy.com) URLs are
* rewritten through the bsky proxy at t.gifs.bsky.app.
* 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' ||
url.hostname === 'static.klipy.com'
) {
if (url.hostname === 'media.tenor.com') {
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) {
logger.debug('invalid url passed to gifPreviewUrl()')