1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-16 23:58:59 +09:00
cherrypick/src/client/app/common/scripts/get-static-image-url.ts

10 lines
374 B
TypeScript
Raw Normal View History

import { url as instanceUrl } from '../../config';
export function getStaticImageUrl(url: string): string {
const u = new URL(url);
const dummy = `${u.host}${u.pathname}`; // 拡張子がないとキャッシュしてくれないCDNがあるので
let result = `${instanceUrl}/proxy/${dummy}?url=${encodeURIComponent(u.href)}`;
result += '&static=1';
return result;
}