Add an authenticated route that sends Discord direct messages for trusted apps
Some checks failed
Deploy Palico Bot / deploy (push) Failing after 3s
Some checks failed
Deploy Palico Bot / deploy (push) Failing after 3s
- POST /api/notifications/dm takes a user id and a text, sends it as a direct message with no active mentions, and answers 204, 400, 404 or 422. - The send logic lives in src/features/directMessages.js with its own tests; the route gets its own per-minute rate limit behind the existing API key. - Sokko TCG uses it for its opt-in Expedition alerts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
20624a5c9c
commit
3655b1ad74
6 changed files with 183 additions and 56 deletions
|
|
@ -6,6 +6,7 @@ import path from "path";
|
|||
import { config } from "../config.js";
|
||||
import { authMiddleware } from "./middlewares/auth.js";
|
||||
import { libraryRouter } from "./routes/library.js";
|
||||
import { notificationsRouter } from "./routes/notifications.js";
|
||||
import { playerRouter } from "./routes/player.js";
|
||||
import { queueRouter } from "./routes/queue.js";
|
||||
import { uploadsRouter } from "./routes/uploads.js";
|
||||
|
|
@ -62,6 +63,16 @@ function startWebServer(dependencies) {
|
|||
apiRouter.use("/queue", queueRouter(dependencies));
|
||||
apiRouter.use("/library", libraryRouter(dependencies));
|
||||
apiRouter.use("/player", playerRouter(dependencies));
|
||||
apiRouter.use(
|
||||
"/notifications",
|
||||
rateLimit({
|
||||
windowMs: 60_000,
|
||||
limit: 60,
|
||||
standardHeaders: "draft-8",
|
||||
legacyHeaders: false,
|
||||
}),
|
||||
notificationsRouter(dependencies)
|
||||
);
|
||||
|
||||
app.use("/api", apiRouter);
|
||||
app.get(["/jukebox", "/jukebox/"], (_req, res) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue