Make /api/v1/instance and /api/v1/custom_emojis better (#3118)
* Separate commits From commitdca110ebaa
. * Re-separate commits From commit9719387bee
.
This commit is contained in:
committed by
syuilo
parent
712802e682
commit
0d23ce3d45
35
src/models/mastodon/emoji.ts
Normal file
35
src/models/mastodon/emoji.ts
Normal file
@ -0,0 +1,35 @@
|
||||
export type IMastodonEmoji = {
|
||||
shortcode: string,
|
||||
url: string,
|
||||
static_url: string,
|
||||
visible_in_picker: boolean
|
||||
};
|
||||
|
||||
export async function toMastodonEmojis(emoji: any): Promise<IMastodonEmoji[]> {
|
||||
return [{
|
||||
shortcode: emoji.name,
|
||||
url: emoji.url,
|
||||
static_url: emoji.url, // TODO: Implement ensuring static emoji
|
||||
visible_in_picker: true
|
||||
}, ...(emoji.aliases as string[] || []).map(x => ({
|
||||
shortcode: x,
|
||||
url: emoji.url,
|
||||
static_url: emoji.url,
|
||||
visible_in_picker: true
|
||||
}))];
|
||||
}
|
||||
|
||||
export function toMisskeyEmojiSync(emoji: IMastodonEmoji) {
|
||||
return {
|
||||
name: emoji.shortcode,
|
||||
url: emoji.url
|
||||
};
|
||||
}
|
||||
|
||||
export function toMisskeyEmojiWithAliasesSync(emoji: IMastodonEmoji, ...aliases: string[]) {
|
||||
return {
|
||||
name: emoji.shortcode,
|
||||
aliases,
|
||||
url: emoji.url
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user