From d106fb39abf8fe17c00e562c1237fcacfe158345 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 26 Dec 2022 16:04:56 +0900 Subject: [PATCH] feat: introduce fluent emoji --- .dockerignore | 1 + .gitmodules | 3 +++ CHANGELOG.md | 1 + fluent-emojis | 1 + locales/ja-JP.yml | 3 ++- misskey-assets | 2 +- .../src/server/web/ClientServerService.ts | 15 ++++++++++++++ .../client/src/components/MkAutocomplete.vue | 10 ++++++---- .../components/MkReactionsViewer.details.vue | 1 + .../client/src/components/global/MkEmoji.vue | 8 +++++--- .../client/src/pages/settings/general.vue | 16 ++++++++++----- .../pages/settings/preferences-backups.vue | 2 +- packages/client/src/scripts/emoji-base.ts | 20 +++++++++++++++++++ packages/client/src/scripts/twemoji-base.ts | 12 ----------- packages/client/src/store.ts | 4 ++-- 15 files changed, 70 insertions(+), 29 deletions(-) create mode 160000 fluent-emojis create mode 100644 packages/client/src/scripts/emoji-base.ts delete mode 100644 packages/client/src/scripts/twemoji-base.ts diff --git a/.dockerignore b/.dockerignore index 84fd34f8e..854e643d3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,6 +14,7 @@ packages/*/node_modules redis/ files/ misskey-assets/ +fluent-emojis/ .pnp.* .yarn/* !.yarn/patches diff --git a/.gitmodules b/.gitmodules index 9246e09b8..225a69a65 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "misskey-assets"] path = misskey-assets url = https://github.com/misskey-dev/assets.git +[submodule "fluent-emojis"] + path = fluent-emojis + url = https://github.com/misskey-dev/emojis.git diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f633d43c..f7b939d62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ You should also include the user name that made the change. - Client: Implement the toggle to or not to close push notifications when notifications or messages are read @tamaina - Client: show Unicode emoji tooltip with its name in MkReactionsViewer.reaction @saschanaz - Client: add user list widget @syuilo +- Client: introduce fluent emoji @syuilo - Client: improve overall performance of client @syuilo ### Bugfixes diff --git a/fluent-emojis b/fluent-emojis new file mode 160000 index 000000000..cae981eb4 --- /dev/null +++ b/fluent-emojis @@ -0,0 +1 @@ +Subproject commit cae981eb4c5189ea9ea3230e83b876a5068df7d1 diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6ebeaf65b..8add6348d 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -456,7 +456,8 @@ language: "言語" uiLanguage: "UIの表示言語" groupInvited: "グループに招待されました" aboutX: "{x}について" -useOsNativeEmojis: "OSネイティブの絵文字を使用" +emojiStyle: "絵文字のスタイル" +native: "ネイティブ" disableDrawer: "メニューをドロワーで表示しない" youHaveNoGroups: "グループがありません" joinOrCreateGroup: "既存のグループに招待してもらうか、新しくグループを作成してください。" diff --git a/misskey-assets b/misskey-assets index 0179793ec..cf3ce27b2 160000 --- a/misskey-assets +++ b/misskey-assets @@ -1 +1 @@ -Subproject commit 0179793ec891856d6f37a3be16ba4c22f67a81b5 +Subproject commit cf3ce27b2eb8417233072e3d6d2fb7c5356c2364 diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index 1932f8842..97acfcb91 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -217,6 +217,21 @@ export class ClientServerService { return reply.sendFile('/apple-touch-icon.png', staticAssets); }); + fastify.get<{ Params: { path: string } }>('/fluent-emoji/:path(.*)', async (request, reply) => { + const path = request.params.path; + + if (!path.match(/^[0-9a-f-]+\.png$/)) { + reply.code(404); + return; + } + + reply.header('Content-Security-Policy', 'default-src \'none\'; style-src \'unsafe-inline\''); + + return await reply.sendFile(path, `${_dirname}/../../../../../fluent-emojis/dist/`, { + maxAge: ms('30 days'), + }); + }); + fastify.get<{ Params: { path: string } }>('/twemoji/:path(.*)', async (request, reply) => { const path = request.params.path; diff --git a/packages/client/src/components/MkAutocomplete.vue b/packages/client/src/components/MkAutocomplete.vue index e1fd5693b..72783921d 100644 --- a/packages/client/src/components/MkAutocomplete.vue +++ b/packages/client/src/components/MkAutocomplete.vue @@ -18,7 +18,7 @@
  1. - + {{ emoji.emoji }} @@ -36,7 +36,7 @@