We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0f6f886 commit 20fb9c4Copy full SHA for 20fb9c4
1 file changed
src/modules/stats/index.ts
@@ -20,7 +20,12 @@ export const statsModule = new Elysia({
20
query: StatsPeriodQuery,
21
response: StatsSummaryResponse,
22
beforeHandle({ headers }) {
23
- if (headers["x-admin-key"] !== env.ADMIN_API_KEY) {
+ const origin = headers.origin ?? "";
24
+ const isNedaa =
25
+ origin === "https://nedaa.dev" || origin === "https://www.nedaa.dev";
26
+ const isAdmin = headers["x-admin-key"] === env.ADMIN_API_KEY;
27
+
28
+ if (!isNedaa && !isAdmin) {
29
throw new AppError("Unauthorized", 401, CODES.UNAUTHORIZED);
30
}
31
},
0 commit comments