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
9 changes: 9 additions & 0 deletions src/everything/transports/sse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ app.use(
})
);

// Optional token-based authentication middleware
const API_KEY = process.env.API_KEY;
app.use((req, res, next) => {
if (!API_KEY) { next(); return; }
const auth = req.headers.authorization;
if (auth === `Bearer ${API_KEY}`) { next(); return; }
res.status(401).json({ error: "Unauthorized" });
});

// Map sessionId to transport for each client
const transports: Map<string, SSEServerTransport> = new Map<
string,
Expand Down
Loading