From bbc6027c0948b62a8bc4cb3db8dde8ee23d3fdd1 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Mon, 18 Mar 2019 22:02:45 +0900 Subject: [PATCH] Change Twemoji CDN (#4527) --- src/client/app/common/views/components/autocomplete.vue | 5 +++-- src/client/app/common/views/components/emoji.vue | 3 ++- src/misc/twemoji-base.ts | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/misc/twemoji-base.ts diff --git a/src/client/app/common/views/components/autocomplete.vue b/src/client/app/common/views/components/autocomplete.vue index 8a5a63722..b66da49d7 100644 --- a/src/client/app/common/views/components/autocomplete.vue +++ b/src/client/app/common/views/components/autocomplete.vue @@ -30,6 +30,7 @@ import Vue from 'vue'; import * as emojilib from 'emojilib'; import contains from '../../../common/scripts/contains'; +import { twemojiBase } from '../../../../../misc/twemoji-base'; type EmojiDef = { emoji: string; @@ -54,7 +55,7 @@ const emjdb: EmojiDef[] = lib.map((x: any) => ({ emoji: x[1].char, name: x[0], aliasOf: null, - url: `https://twemoji.maxcdn.com/2/svg/${char2file(x[1].char)}.svg` + url: `${twemojiBase}/2/svg/${char2file(x[1].char)}.svg` })); for (const x of lib as any) { @@ -64,7 +65,7 @@ for (const x of lib as any) { emoji: x[1].char, name: k, aliasOf: x[0], - url: `https://twemoji.maxcdn.com/2/svg/${char2file(x[1].char)}.svg` + url: `${twemojiBase}/2/svg/${char2file(x[1].char)}.svg` }); } } diff --git a/src/client/app/common/views/components/emoji.vue b/src/client/app/common/views/components/emoji.vue index 65b5683c2..0cc78a337 100644 --- a/src/client/app/common/views/components/emoji.vue +++ b/src/client/app/common/views/components/emoji.vue @@ -10,6 +10,7 @@ import Vue from 'vue'; // スクリプトサイズがデカい //import { lib } from 'emojilib'; import { getStaticImageUrl } from '../../../common/scripts/get-static-image-url'; +import { twemojiBase } from '../../../../../misc/twemoji-base'; export default Vue.extend({ props: { @@ -77,7 +78,7 @@ export default Vue.extend({ if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f'); codes = codes.filter(x => x && x.length); - this.url = `https://twemoji.maxcdn.com/2/svg/${codes.join('-')}.svg`; + this.url = `${twemojiBase}/2/svg/${codes.join('-')}.svg`; } } }); diff --git a/src/misc/twemoji-base.ts b/src/misc/twemoji-base.ts new file mode 100644 index 000000000..74611a488 --- /dev/null +++ b/src/misc/twemoji-base.ts @@ -0,0 +1,4 @@ +export const twemojiBase = 'https://cdn.jsdelivr.net/npm/twemoji@11.3.0'; +// https://cdn.jsdelivr.net/npm/twemoji@11.3.0 +// https://cdnjs.cloudflare.com/ajax/libs/twemoji/11.3.0 +// https://twemoji.maxcdn.com