カスタム絵文字をproxyに通すように (#7526)

This commit is contained in:
rinsuki
2021-05-27 22:40:48 +09:00
committed by GitHub
parent ae2267220b
commit 466c083233
2 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,11 @@ import * as url from '../../prelude/url';
export function getStaticImageUrl(baseUrl: string): string {
const u = new URL(baseUrl);
if (u.href.startsWith(`${instanceUrl}/proxy/`)) {
// もう既にproxyっぽそうだったらsearchParams付けるだけ
u.searchParams.set('static', '1');
return u.href;
}
const dummy = `${u.host}${u.pathname}`; // 拡張子がないとキャッシュしてくれないCDNがあるので
return `${instanceUrl}/proxy/${dummy}?${url.query({
url: u.href,