diff --git a/netlify/functions/getLastFmSongs.ts b/netlify/functions/getLastFmSongs.ts index 7d49f87..2c9f48f 100755 --- a/netlify/functions/getLastFmSongs.ts +++ b/netlify/functions/getLastFmSongs.ts @@ -23,6 +23,13 @@ const handler: Handler = async () => { // Origin for CORS const origin = process.env.NODE_ENV === 'production' ? 'https://toshiki.dev' : 'http://localhost:3000' + const allowedOrigins = ['https://toshiki.dev', 'http://localhost:3000', 'https://toshiki-home-nuxt3.netlify.app/'] + if (!allowedOrigins.includes(origin)) { + return { + statusCode: 403, + body: 'Forbidden' + } + } // Map track function const mapTrack = (track: any): any => {