diff --git a/src/constants.ts b/src/constants.ts index e36773e..35f79df 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -6,3 +6,5 @@ export enum TIME_FROM_AGO { ONE_WEEK = 'ONE_WEEK', ONE_YEAR = 'ONE_YEAR', } + +export const allowedOrigins = ['https://*.jup.ag', 'https://*.meteora.ag', '*wowcats.vercel.app']; diff --git a/src/index.ts b/src/index.ts index 9c23130..f1fbdb0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import { Hono } from 'hono'; import { BlankSchema } from 'hono/types'; import { cors } from 'hono/cors'; import { callAPI, computeTimeAgo } from './utils'; -import { TIME_FROM_AGO } from './constants'; +import { allowedOrigins, TIME_FROM_AGO } from './constants'; const app = new Hono< { @@ -18,9 +18,10 @@ app.all( '*', cors({ allowHeaders: ['*'], - origin: '*', + origin: allowedOrigins, + credentials: true, maxAge: 7200, - allowMethods: ['GET', 'POST'], + allowMethods: ['GET', 'POST', 'OPTIONS'], }), );