Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/opencode/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Hono } from "hono"
import { cors } from "hono/cors"
import { stream, streamSSE } from "hono/streaming"
import { proxy } from "hono/proxy"
import { rateLimitMiddleware } from "hono/rate-limit"
import { Session } from "../session"
import z from "zod"
import { Provider } from "../provider/provider"
Expand Down Expand Up @@ -93,6 +94,10 @@ export namespace Server {
timer.stop()
}
})
.use(rateLimitMiddleware({
windowMs: 15 * 60 * 1000, // 15 minutes
limit: 100, // limit each IP to 100 requests per windowMs
}))
.use(cors())
.get(
"/global/event",
Expand Down