Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
9d29a2e85a | |||
c62a225542 | |||
d5d995a3e6 | |||
cbba03b376 | |||
f84e9c7dc8 | |||
a22ddb1fb9 | |||
0d23ce3d45 |
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "10.38.7",
|
"version": "10.38.8",
|
||||||
"clientVersion": "1.0.11530",
|
"clientVersion": "1.0.11537",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
@ -67,7 +67,7 @@ export default Vue.extend({
|
|||||||
(this as any).api('admin/emoji/add', {
|
(this as any).api('admin/emoji/add', {
|
||||||
name: this.name,
|
name: this.name,
|
||||||
url: this.url,
|
url: this.url,
|
||||||
aliases: this.aliases.split(' ')
|
aliases: this.aliases.split(' ').filter(x => x.length > 0)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$swal({
|
this.$swal({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
@ -95,7 +95,7 @@ export default Vue.extend({
|
|||||||
id: emoji.id,
|
id: emoji.id,
|
||||||
name: emoji.name,
|
name: emoji.name,
|
||||||
url: emoji.url,
|
url: emoji.url,
|
||||||
aliases: emoji.aliases.split(' ')
|
aliases: emoji.aliases.split(' ').filter(x => x.length > 0)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$swal({
|
this.$swal({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
@ -222,8 +222,6 @@ class Autocomplete {
|
|||||||
const trimmedBefore = before.substring(0, before.lastIndexOf(':'));
|
const trimmedBefore = before.substring(0, before.lastIndexOf(':'));
|
||||||
const after = source.substr(caret);
|
const after = source.substr(caret);
|
||||||
|
|
||||||
if (value.startsWith(':')) value = value + ' ';
|
|
||||||
|
|
||||||
// 挿入
|
// 挿入
|
||||||
this.text = trimmedBefore + value + after;
|
this.text = trimmedBefore + value + after;
|
||||||
|
|
||||||
|
35
src/server/api/mastodon/emoji.ts
Normal file
35
src/server/api/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
|
||||||
|
};
|
||||||
|
}
|
@ -1,21 +1,22 @@
|
|||||||
import * as Router from 'koa-router';
|
import * as Router from 'koa-router';
|
||||||
import User from '../../models/user';
|
import User from '../../../models/user';
|
||||||
import { toASCII } from 'punycode';
|
import { toASCII } from 'punycode';
|
||||||
import config from '../../config';
|
import config from '../../../config';
|
||||||
import Meta from '../../models/meta';
|
import Meta from '../../../models/meta';
|
||||||
import { ObjectID } from 'bson';
|
import { ObjectID } from 'bson';
|
||||||
import Emoji from '../../models/emoji';
|
import Emoji from '../../../models/emoji';
|
||||||
const pkg = require('../../../package.json');
|
import { toMastodonEmojis } from './emoji';
|
||||||
|
const pkg = require('../../../../package.json');
|
||||||
|
|
||||||
// Init router
|
// Init router
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
router.get('/v1/custom_emojis', async ctx => ctx.body =
|
router.get('/v1/custom_emojis', async ctx => ctx.body =
|
||||||
await Emoji.find({ host: null }, {
|
(await Emoji.find({ host: null }, {
|
||||||
fields: {
|
fields: {
|
||||||
_id: false
|
_id: false
|
||||||
}
|
}
|
||||||
}));
|
})).map(x => toMastodonEmojis(x)));
|
||||||
|
|
||||||
router.get('/v1/instance', async ctx => { // TODO: This is a temporary implementation. Consider creating helper methods!
|
router.get('/v1/instance', async ctx => { // TODO: This is a temporary implementation. Consider creating helper methods!
|
||||||
const meta = await Meta.findOne() || {};
|
const meta = await Meta.findOne() || {};
|
||||||
@ -40,6 +41,11 @@ router.get('/v1/instance', async ctx => { // TODO: This is a temporary implement
|
|||||||
notesCount: 0
|
notesCount: 0
|
||||||
};
|
};
|
||||||
const acct = maintainer.host ? `${maintainer.username}@${maintainer.host}` : maintainer.username;
|
const acct = maintainer.host ? `${maintainer.username}@${maintainer.host}` : maintainer.username;
|
||||||
|
const emojis = (await Emoji.find({ host: null }, {
|
||||||
|
fields: {
|
||||||
|
_id: false
|
||||||
|
}
|
||||||
|
})).map(toMastodonEmojis);
|
||||||
|
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
uri: config.hostname,
|
uri: config.hostname,
|
||||||
@ -79,7 +85,7 @@ router.get('/v1/instance', async ctx => { // TODO: This is a temporary implement
|
|||||||
followers_count: maintainer.followersCount,
|
followers_count: maintainer.followersCount,
|
||||||
following_count: maintainer.followingCount,
|
following_count: maintainer.followingCount,
|
||||||
statuses_count: maintainer.notesCount,
|
statuses_count: maintainer.notesCount,
|
||||||
emojis: [],
|
emojis: emojis,
|
||||||
moved: null,
|
moved: null,
|
||||||
fields: null
|
fields: null
|
||||||
}
|
}
|
Reference in New Issue
Block a user