Change Twemoji CDN (#4527)

This commit is contained in:
MeiMei 2019-03-18 22:02:45 +09:00 committed by syuilo
parent c65256d02b
commit 763ae8f1a6
3 changed files with 9 additions and 3 deletions

View file

@ -30,6 +30,7 @@
import Vue from 'vue'; import Vue from 'vue';
import * as emojilib from 'emojilib'; import * as emojilib from 'emojilib';
import contains from '../../../common/scripts/contains'; import contains from '../../../common/scripts/contains';
import { twemojiBase } from '../../../../../misc/twemoji-base';
type EmojiDef = { type EmojiDef = {
emoji: string; emoji: string;
@ -54,7 +55,7 @@ const emjdb: EmojiDef[] = lib.map((x: any) => ({
emoji: x[1].char, emoji: x[1].char,
name: x[0], name: x[0],
aliasOf: null, 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) { for (const x of lib as any) {
@ -64,7 +65,7 @@ for (const x of lib as any) {
emoji: x[1].char, emoji: x[1].char,
name: k, name: k,
aliasOf: x[0], aliasOf: x[0],
url: `https://twemoji.maxcdn.com/2/svg/${char2file(x[1].char)}.svg` url: `${twemojiBase}/2/svg/${char2file(x[1].char)}.svg`
}); });
} }
} }

View file

@ -10,6 +10,7 @@ import Vue from 'vue';
// //
//import { lib } from 'emojilib'; //import { lib } from 'emojilib';
import { getStaticImageUrl } from '../../../common/scripts/get-static-image-url'; import { getStaticImageUrl } from '../../../common/scripts/get-static-image-url';
import { twemojiBase } from '../../../../../misc/twemoji-base';
export default Vue.extend({ export default Vue.extend({
props: { props: {
@ -77,7 +78,7 @@ export default Vue.extend({
if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f'); if (!codes.includes('200d')) codes = codes.filter(x => x != 'fe0f');
codes = codes.filter(x => x && x.length); 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`;
} }
} }
}); });

4
src/misc/twemoji-base.ts Normal file
View file

@ -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