oEmbed API should use CORS (#6562)

* oEmbed API should use CORS

* Simplify cors function call

---------

Co-authored-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
David Baumgold 2024-09-05 16:16:44 +02:00 committed by GitHub
parent 82c15dd48e
commit 7de5e13b25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import express from 'express' import express from 'express'
import cors from 'cors'
import { escapeHTML, forceNumber } from '@peertube/peertube-core-utils' import { escapeHTML, forceNumber } from '@peertube/peertube-core-utils'
import { MChannelSummary } from '@server/types/models/index.js' import { MChannelSummary } from '@server/types/models/index.js'
import { EMBED_SIZE, PREVIEWS_SIZE, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants.js' import { EMBED_SIZE, PREVIEWS_SIZE, THUMBNAILS_SIZE, WEBSERVER } from '../initializers/constants.js'
@ -8,6 +9,7 @@ import { accountNameWithHostGetValidator } from '../middlewares/validators/index
const servicesRouter = express.Router() const servicesRouter = express.Router()
servicesRouter.use('/oembed', servicesRouter.use('/oembed',
cors(),
apiRateLimiter, apiRateLimiter,
asyncMiddleware(oembedValidator), asyncMiddleware(oembedValidator),
generateOEmbed generateOEmbed