アニメーション画像を無効にする際、サーバーサイドではなくクライアントサイドでURLを変更するように
This commit is contained in:
parent
f014b7ae0e
commit
861302f0fd
14 changed files with 40 additions and 56 deletions
|
@ -1,20 +0,0 @@
|
|||
import { URL } from 'url';
|
||||
import config from '../config';
|
||||
|
||||
/**
|
||||
* avatar, thumbnail, custom-emoji 等のURLをクライアント設定等によって置き換える
|
||||
*/
|
||||
export default function(url: string, me: any) {
|
||||
if (url == null) return url;
|
||||
|
||||
// アニメーション再生無効
|
||||
if (me && me.clientSettings && me.clientSettings.doNotAutoplayAnimation) {
|
||||
const u = new URL(url);
|
||||
const dummy = `${u.host}${u.pathname}`; // 拡張子がないとキャッシュしてくれないCDNがあるので
|
||||
let result = `${config.url}/proxy/${dummy}?url=${encodeURI(u.href)}`;
|
||||
result += '&static=1';
|
||||
return result;
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue