mizzkey/src/client/scripts/get-static-image-url.ts

12 lines
394 B
TypeScript
Raw Normal View History

2021-03-23 09:30:14 +01:00
import { url as instanceUrl } from '@client/config';
import * as url from '../../prelude/url';
export function getStaticImageUrl(baseUrl: string): string {
const u = new URL(baseUrl);
const dummy = `${u.host}${u.pathname}`; // 拡張子がないとキャッシュしてくれないCDNがあるので
return `${instanceUrl}/proxy/${dummy}?${url.query({
url: u.href,
static: '1'
})}`;
}