Custom channel emoticons WIP (#130)
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
|
||||
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
||||
import type { Router, Request, Response, NextFunction } from 'express'
|
||||
import type { ChannelInfos } from '../../../../shared/lib/types'
|
||||
import type { ChannelInfos, ChannelEmojis } from '../../../../shared/lib/types'
|
||||
import { asyncMiddleware } from '../../middlewares/async'
|
||||
import { getCheckConfigurationChannelMiddleware } from '../../middlewares/configuration/channel'
|
||||
import { checkConfigurationEnabledMiddleware } from '../../middlewares/configuration/configuration'
|
||||
@ -110,6 +110,30 @@ async function initConfigurationApiRouter (options: RegisterServerOptions, route
|
||||
res.json(result)
|
||||
}
|
||||
]))
|
||||
|
||||
router.get('/configuration/channel/emojis/:channelId', asyncMiddleware([
|
||||
checkConfigurationEnabledMiddleware(options),
|
||||
getCheckConfigurationChannelMiddleware(options, true),
|
||||
async (req: Request, res: Response, _next: NextFunction): Promise<void> => {
|
||||
if (!res.locals.channelInfos) {
|
||||
logger.error('Missing channelInfos in res.locals, should not happen')
|
||||
res.sendStatus(500)
|
||||
return
|
||||
}
|
||||
// const channelInfos = res.locals.channelInfos as ChannelInfos
|
||||
|
||||
const channelEmojis: ChannelEmojis = {
|
||||
customEmojis: [{
|
||||
sn: ':test:',
|
||||
url: '/dist/images/custom_emojis/xmpp.png',
|
||||
isCategoryEmoji: true
|
||||
}]
|
||||
}
|
||||
|
||||
res.status(200)
|
||||
res.json(channelEmojis)
|
||||
}
|
||||
]))
|
||||
}
|
||||
|
||||
export {
|
||||
|
Reference in New Issue
Block a user