summaryrefslogtreecommitdiff
path: root/src/client/app/common/scripts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-02-05 03:51:54 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-02-05 03:51:54 +0900
commit861302f0fd2c47d78f6b9c78697a649fcf1342c8 (patch)
tree297a327fb3dff61f78251d175733fa48ee8e27e7 /src/client/app/common/scripts
parentアニメーションを自動再生しないオプション (#4131) (diff)
downloadsharkey-861302f0fd2c47d78f6b9c78697a649fcf1342c8.tar.gz
sharkey-861302f0fd2c47d78f6b9c78697a649fcf1342c8.tar.bz2
sharkey-861302f0fd2c47d78f6b9c78697a649fcf1342c8.zip
アニメーション画像を無効にする際、サーバーサイドではなくクライアントサイドでURLを変更するように
Diffstat (limited to 'src/client/app/common/scripts')
-rw-r--r--src/client/app/common/scripts/get-static-image-url.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client/app/common/scripts/get-static-image-url.ts b/src/client/app/common/scripts/get-static-image-url.ts
new file mode 100644
index 0000000000..f84adf709c
--- /dev/null
+++ b/src/client/app/common/scripts/get-static-image-url.ts
@@ -0,0 +1,9 @@
+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;
+}