summaryrefslogtreecommitdiff
path: root/src/misc
diff options
context:
space:
mode:
authorrinsuki <428rinsuki+git@gmail.com>2021-05-27 22:40:48 +0900
committerGitHub <noreply@github.com>2021-05-27 22:40:48 +0900
commit466c083233d5f44cfcdfdfa02d8a6bb090382400 (patch)
tree0ced1762b2688f4e2c943aa180ea3fb32d4fc9c4 /src/misc
parentwip #7533 (diff)
downloadsharkey-466c083233d5f44cfcdfdfa02d8a6bb090382400.tar.gz
sharkey-466c083233d5f44cfcdfdfa02d8a6bb090382400.tar.bz2
sharkey-466c083233d5f44cfcdfdfa02d8a6bb090382400.zip
カスタム絵文字をproxyに通すように (#7526)
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/populate-emojis.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/misc/populate-emojis.ts b/src/misc/populate-emojis.ts
index 8052c71489..a3f67ccb98 100644
--- a/src/misc/populate-emojis.ts
+++ b/src/misc/populate-emojis.ts
@@ -5,6 +5,8 @@ import { Note } from '../models/entities/note';
import { Cache } from './cache';
import { isSelfHost, toPunyNullable } from './convert-host';
import { decodeReaction } from './reaction-lib';
+import config from '@/config';
+import { query } from '@/prelude/url';
const cache = new Cache<Emoji | null>(1000 * 60 * 60 * 12);
@@ -59,9 +61,12 @@ export async function populateEmoji(emojiName: string, noteUserHost: string | nu
if (emoji == null) return null;
+ const isLocal = emojiName.endsWith('@.');
+ const url = isLocal ? emoji.url : `${config.url}/proxy/image.png?${query({url: emoji.url})}`;
+
return {
name: emojiName,
- url: emoji.url,
+ url,
};
}