絵文字のライセンスを表示できるように
This commit is contained in:
parent
2be93b1fe6
commit
ed51209172
@ -223,6 +223,7 @@ import * as ep___i_webhooks_update from './endpoints/i/webhooks/update.js';
|
|||||||
import * as ep___i_webhooks_delete from './endpoints/i/webhooks/delete.js';
|
import * as ep___i_webhooks_delete from './endpoints/i/webhooks/delete.js';
|
||||||
import * as ep___meta from './endpoints/meta.js';
|
import * as ep___meta from './endpoints/meta.js';
|
||||||
import * as ep___emojis from './endpoints/emojis.js';
|
import * as ep___emojis from './endpoints/emojis.js';
|
||||||
|
import * as ep___emoji from './endpoints/emoji.js';
|
||||||
import * as ep___miauth_genToken from './endpoints/miauth/gen-token.js';
|
import * as ep___miauth_genToken from './endpoints/miauth/gen-token.js';
|
||||||
import * as ep___mute_create from './endpoints/mute/create.js';
|
import * as ep___mute_create from './endpoints/mute/create.js';
|
||||||
import * as ep___mute_delete from './endpoints/mute/delete.js';
|
import * as ep___mute_delete from './endpoints/mute/delete.js';
|
||||||
@ -550,6 +551,7 @@ const $i_webhooks_update: Provider = { provide: 'ep:i/webhooks/update', useClass
|
|||||||
const $i_webhooks_delete: Provider = { provide: 'ep:i/webhooks/delete', useClass: ep___i_webhooks_delete.default };
|
const $i_webhooks_delete: Provider = { provide: 'ep:i/webhooks/delete', useClass: ep___i_webhooks_delete.default };
|
||||||
const $meta: Provider = { provide: 'ep:meta', useClass: ep___meta.default };
|
const $meta: Provider = { provide: 'ep:meta', useClass: ep___meta.default };
|
||||||
const $emojis: Provider = { provide: 'ep:emojis', useClass: ep___emojis.default };
|
const $emojis: Provider = { provide: 'ep:emojis', useClass: ep___emojis.default };
|
||||||
|
const $emoji: Provider = { provide: 'ep:emoji', useClass: ep___emoji.default };
|
||||||
const $miauth_genToken: Provider = { provide: 'ep:miauth/gen-token', useClass: ep___miauth_genToken.default };
|
const $miauth_genToken: Provider = { provide: 'ep:miauth/gen-token', useClass: ep___miauth_genToken.default };
|
||||||
const $mute_create: Provider = { provide: 'ep:mute/create', useClass: ep___mute_create.default };
|
const $mute_create: Provider = { provide: 'ep:mute/create', useClass: ep___mute_create.default };
|
||||||
const $mute_delete: Provider = { provide: 'ep:mute/delete', useClass: ep___mute_delete.default };
|
const $mute_delete: Provider = { provide: 'ep:mute/delete', useClass: ep___mute_delete.default };
|
||||||
@ -881,6 +883,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
|||||||
$i_webhooks_delete,
|
$i_webhooks_delete,
|
||||||
$meta,
|
$meta,
|
||||||
$emojis,
|
$emojis,
|
||||||
|
$emoji,
|
||||||
$miauth_genToken,
|
$miauth_genToken,
|
||||||
$mute_create,
|
$mute_create,
|
||||||
$mute_delete,
|
$mute_delete,
|
||||||
@ -1206,6 +1209,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
|||||||
$i_webhooks_delete,
|
$i_webhooks_delete,
|
||||||
$meta,
|
$meta,
|
||||||
$emojis,
|
$emojis,
|
||||||
|
$emoji,
|
||||||
$miauth_genToken,
|
$miauth_genToken,
|
||||||
$mute_create,
|
$mute_create,
|
||||||
$mute_delete,
|
$mute_delete,
|
||||||
|
@ -223,6 +223,7 @@ import * as ep___i_webhooks_update from './endpoints/i/webhooks/update.js';
|
|||||||
import * as ep___i_webhooks_delete from './endpoints/i/webhooks/delete.js';
|
import * as ep___i_webhooks_delete from './endpoints/i/webhooks/delete.js';
|
||||||
import * as ep___meta from './endpoints/meta.js';
|
import * as ep___meta from './endpoints/meta.js';
|
||||||
import * as ep___emojis from './endpoints/emojis.js';
|
import * as ep___emojis from './endpoints/emojis.js';
|
||||||
|
import * as ep___emoji from './endpoints/emoji.js';
|
||||||
import * as ep___miauth_genToken from './endpoints/miauth/gen-token.js';
|
import * as ep___miauth_genToken from './endpoints/miauth/gen-token.js';
|
||||||
import * as ep___mute_create from './endpoints/mute/create.js';
|
import * as ep___mute_create from './endpoints/mute/create.js';
|
||||||
import * as ep___mute_delete from './endpoints/mute/delete.js';
|
import * as ep___mute_delete from './endpoints/mute/delete.js';
|
||||||
@ -548,6 +549,7 @@ const eps = [
|
|||||||
['i/webhooks/delete', ep___i_webhooks_delete],
|
['i/webhooks/delete', ep___i_webhooks_delete],
|
||||||
['meta', ep___meta],
|
['meta', ep___meta],
|
||||||
['emojis', ep___emojis],
|
['emojis', ep___emojis],
|
||||||
|
['emoji', ep___emoji],
|
||||||
['miauth/gen-token', ep___miauth_genToken],
|
['miauth/gen-token', ep___miauth_genToken],
|
||||||
['mute/create', ep___mute_create],
|
['mute/create', ep___mute_create],
|
||||||
['mute/delete', ep___mute_delete],
|
['mute/delete', ep___mute_delete],
|
||||||
|
56
packages/backend/src/server/api/endpoints/emoji.ts
Normal file
56
packages/backend/src/server/api/endpoints/emoji.ts
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
import { IsNull } from 'typeorm';
|
||||||
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
import type { EmojisRepository } from '@/models/index.js';
|
||||||
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
|
import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js';
|
||||||
|
import type { Config } from '@/config.js';
|
||||||
|
import { DI } from '@/di-symbols.js';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
tags: ['meta'],
|
||||||
|
|
||||||
|
requireCredential: false,
|
||||||
|
allowGet: true,
|
||||||
|
cacheSec: 3600,
|
||||||
|
|
||||||
|
res: {
|
||||||
|
type: 'object',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
ref: 'EmojiDetailed',
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const paramDef = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
name: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: ['name'],
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
@Injectable()
|
||||||
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
|
constructor(
|
||||||
|
@Inject(DI.config)
|
||||||
|
private config: Config,
|
||||||
|
|
||||||
|
@Inject(DI.emojisRepository)
|
||||||
|
private emojisRepository: EmojisRepository,
|
||||||
|
|
||||||
|
private emojiEntityService: EmojiEntityService,
|
||||||
|
) {
|
||||||
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
const emoji = await this.emojisRepository.findOneOrFail({
|
||||||
|
where: {
|
||||||
|
name: ps.name,
|
||||||
|
host: IsNull(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.emojiEntityService.packDetailed(emoji);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -23,24 +23,7 @@ export const meta = {
|
|||||||
items: {
|
items: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
properties: {
|
ref: 'EmojiSimple',
|
||||||
name: {
|
|
||||||
type: 'string',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
},
|
|
||||||
aliases: {
|
|
||||||
type: 'array',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
items: {
|
|
||||||
type: 'string',
|
|
||||||
optional: false, nullable: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
category: {
|
|
||||||
type: 'string',
|
|
||||||
optional: false, nullable: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -34,6 +34,17 @@ function menu(ev) {
|
|||||||
copyToClipboard(`:${props.emoji.name}:`);
|
copyToClipboard(`:${props.emoji.name}:`);
|
||||||
os.success();
|
os.success();
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
text: i18n.ts.info,
|
||||||
|
icon: 'ti ti-info-circle',
|
||||||
|
action: () => {
|
||||||
|
os.apiGet('emoji', { name: props.emoji.name }).then(res => {
|
||||||
|
os.alert({
|
||||||
|
type: 'info',
|
||||||
|
text: `License: ${res.license}`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
}], ev.currentTarget ?? ev.target);
|
}], ev.currentTarget ?? ev.target);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user