41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
import { Emojis } from "../../../../models/index.js";
|
|
import { IsNull, In } from "typeorm";
|
|
import { FILE_TYPE_BROWSERSAFE } from "../../../../const.js";
|
|
import define from "../../define.js";
|
|
export const meta = {
|
|
requireCredential: false,
|
|
requireCredentialPrivateMode: true,
|
|
allowGet: true,
|
|
tags: [
|
|
"meta"
|
|
]
|
|
};
|
|
export const paramDef = {
|
|
type: "object",
|
|
properties: {},
|
|
required: []
|
|
};
|
|
export default define(meta, paramDef, async ()=>{
|
|
const now = Date.now();
|
|
const emojis = await Emojis.find({
|
|
where: {
|
|
host: IsNull(),
|
|
type: In(FILE_TYPE_BROWSERSAFE)
|
|
},
|
|
select: [
|
|
"name",
|
|
"originalUrl",
|
|
"publicUrl",
|
|
"category"
|
|
]
|
|
});
|
|
const emojiList = emojis.map((emoji)=>({
|
|
shortcode: emoji.name,
|
|
url: emoji.originalUrl,
|
|
static_url: emoji.publicUrl,
|
|
visible_in_picker: true,
|
|
category: emoji.category
|
|
}));
|
|
return emojiList;
|
|
});
|