From 861302f0fd2c47d78f6b9c78697a649fcf1342c8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 5 Feb 2019 03:51:54 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=8B=E3=83=A1=E3=83=BC=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E7=94=BB=E5=83=8F=E3=82=92=E7=84=A1=E5=8A=B9?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B=E9=9A=9B=E3=80=81=E3=82=B5=E3=83=BC?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B5=E3=82=A4=E3=83=89=E3=81=A7=E3=81=AF?= =?UTF-8?q?=E3=81=AA=E3=81=8F=E3=82=AF=E3=83=A9=E3=82=A4=E3=82=A2=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=B5=E3=82=A4=E3=83=89=E3=81=A7URL=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 2 +- .../common/scripts/get-static-image-url.ts | 9 +++++++++ .../app/common/views/components/avatar.vue | 8 +++++++- .../app/common/views/components/emoji.vue | 5 ++++- .../common/views/components/media-image.vue | 7 ++++++- .../app/desktop/views/components/settings.vue | 4 ++-- .../app/mobile/views/pages/settings.vue | 4 ++-- src/client/app/store.ts | 4 ++-- src/misc/wrap-url.ts | 20 ------------------- src/models/drive-file.ts | 10 +--------- src/models/note.ts | 10 +++------- src/models/user.ts | 10 ++-------- src/server/api/endpoints/drive/stream.ts | 2 +- src/server/proxy/proxy-media.ts | 1 - 14 files changed, 40 insertions(+), 56 deletions(-) create mode 100644 src/client/app/common/scripts/get-static-image-url.ts delete mode 100644 src/misc/wrap-url.ts diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 92f27a2bf0..4064f3f352 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -121,7 +121,7 @@ common: use-avatar-reversi-stones: "リバーシの石にアバターを使う" verified-user: "公式アカウント" disable-animated-mfm: "投稿内の動きのあるテキストを無効にする" - do-not-autoplay-animation: "アニメーションを自動再生しない" + do-not-autoplay-animation: "アニメーション画像を再生しない" suggest-recent-hashtags: "最近のハッシュタグを投稿フォームに表示する" always-show-nsfw: "常に閲覧注意のメディアを表示する" always-mark-nsfw: "常にメディアを閲覧注意として投稿" 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; +} diff --git a/src/client/app/common/views/components/avatar.vue b/src/client/app/common/views/components/avatar.vue index 698873833d..205b4a6d79 100644 --- a/src/client/app/common/views/components/avatar.vue +++ b/src/client/app/common/views/components/avatar.vue @@ -15,6 +15,7 @@