From 4af8985686916c843da9eabf2eab013aa4d581a7 Mon Sep 17 00:00:00 2001 From: Il Harper Date: Fri, 8 Mar 2024 19:43:47 +0800 Subject: [PATCH] fix(shell): satori: server: fix routes --- packages/engine-chronocat-api/src/index.ts | 2 +- packages/shell/src/satori/routes/guild/member/get.ts | 5 +++-- packages/shell/src/satori/routes/guild/remove.ts | 2 +- packages/shell/src/satori/routes/index.ts | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/engine-chronocat-api/src/index.ts b/packages/engine-chronocat-api/src/index.ts index 424d115..168fcbc 100644 --- a/packages/engine-chronocat-api/src/index.ts +++ b/packages/engine-chronocat-api/src/index.ts @@ -52,11 +52,11 @@ export const apply = async (ctx: ChronocatContext) => { register('guild.member.list', buildGuildMemberList(ctx)) register('guild.member.kick', buildGuildMemberKick(ctx)) register('message.create', buildMessageCreate(ctx)) + register('chronocat.internal.message.create.forward', buildMessageCreate(ctx)) register('message.get', buildMessageGet(ctx)) register('message.delete', buildMessageDelete(ctx)) register('message.list', buildMessageList(ctx)) register('login.get', buildLoginGet(ctx)) - register('chronocat.internal.message.create.forward', buildMessageCreate(ctx)) register('user.get', buildUserGet(ctx)) register('friend.list', buildFriendList(ctx)) register('friend.approve', buildFriendApprove(ctx)) diff --git a/packages/shell/src/satori/routes/guild/member/get.ts b/packages/shell/src/satori/routes/guild/member/get.ts index 0aa8115..138e2cb 100644 --- a/packages/shell/src/satori/routes/guild/member/get.ts +++ b/packages/shell/src/satori/routes/guild/member/get.ts @@ -10,8 +10,9 @@ export const guildMemberGet = async ({ }: RouteContext) => { const payload = (await json()) as GuildMemberGetPayload - const validateResult = - await cctx.chronocat.validate('ChannelMutePayload')(payload) + const validateResult = await cctx.chronocat.validate('GuildMemberGetPayload')( + payload, + ) if (validateResult) { const err = `解析 ${path} 请求时出现问题,来自 ${req.socket.remoteAddress}。${validateResult}` diff --git a/packages/shell/src/satori/routes/guild/remove.ts b/packages/shell/src/satori/routes/guild/remove.ts index 998871f..5f09016 100644 --- a/packages/shell/src/satori/routes/guild/remove.ts +++ b/packages/shell/src/satori/routes/guild/remove.ts @@ -11,7 +11,7 @@ export const guildRemove = async ({ const payload = (await json()) as GuildRemovePayload const validateResult = - await cctx.chronocat.validate('ChannelMutePayload')(payload) + await cctx.chronocat.validate('GuildRemovePayload')(payload) if (validateResult) { const err = `解析 ${path} 请求时出现问题,来自 ${req.socket.remoteAddress}。${validateResult}` diff --git a/packages/shell/src/satori/routes/index.ts b/packages/shell/src/satori/routes/index.ts index 50c7cb4..769b76f 100644 --- a/packages/shell/src/satori/routes/index.ts +++ b/packages/shell/src/satori/routes/index.ts @@ -12,7 +12,7 @@ import { guildMemberGet } from './guild/member/get' import { guildMemberKick } from './guild/member/kick' import { guildMemberList } from './guild/member/list' import { guildRemove } from './guild/remove' -// import { loginGet } from './login/get' +import { loginGet } from './login/get' import { messageCreate } from './message/create' import { messageDelete } from './message/delete' import { messageGet } from './message/get' @@ -45,7 +45,7 @@ const routesIntl = { 'guild.role.create': notImplemented, 'guild.role.update': notImplemented, 'guild.role.delete': notImplemented, - // 'login.get': loginGet, + 'login.get': loginGet, 'message.create': messageCreate, 'message.get': messageGet, 'message.delete': messageDelete,