Skip to content

Commit

Permalink
fix(server): fix server implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 10, 2023
1 parent 823998a commit 040162a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@satorijs/server",
"description": "Basic API server for Satori protocol",
"version": "1.0.0",
"version": "1.0.4",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"exports": {
Expand Down
8 changes: 4 additions & 4 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export function apply(ctx: Context, config: Config) {
}

const json = koa.request.body
const selfId = koa.request.headers['X-Self-ID']
const platform = koa.request.headers['X-Platform']
const selfId = koa.request.headers['x-self-id']
const platform = koa.request.headers['x-platform']
const bot = ctx.bots.find(bot => bot.selfId === selfId && bot.platform === platform)
if (!bot) {
koa.body = 'bot not found'
Expand Down Expand Up @@ -139,8 +139,8 @@ export function apply(ctx: Context, config: Config) {

function dispatch(socket: WebSocket, session: Session) {
socket.send(JSON.stringify({
op: 'event',
body: transformKey(session.event, snakeCase),
op: Universal.Opcode.EVENT,
body: transformKey(session.toJSON(), snakeCase),
}))
}

Expand Down

0 comments on commit 040162a

Please sign in to comment.