Skip to content

Commit

Permalink
fix(server): preview endpoint OPTIONS CORS settings not being set (sp…
Browse files Browse the repository at this point in the history
  • Loading branch information
fabis94 authored Dec 15, 2022
1 parent c19815f commit d9b1fce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/server/modules/previews/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ exports.init = (app) => {
return { hasPermissions: true, httpErrorCode: 200 }
}

app.options('/preview/:streamId/:angle?', cors())
app.get('/preview/:streamId/:angle?', cors(), async (req, res) => {
const { hasPermissions, httpErrorCode } = await checkStreamPermissions(req)
if (!hasPermissions) {
Expand All @@ -181,6 +182,7 @@ exports.init = (app) => {
)
})

app.options('/preview/:streamId/branches/:branchName/:angle?', cors())
app.get(
'/preview/:streamId/branches/:branchName/:angle?',
cors(),
Expand Down Expand Up @@ -217,6 +219,7 @@ exports.init = (app) => {
}
)

app.options('/preview/:streamId/commits/:commitId/:angle?', cors())
app.get('/preview/:streamId/commits/:commitId/:angle?', cors(), async (req, res) => {
const { hasPermissions, httpErrorCode } = await checkStreamPermissions(req)
if (!hasPermissions) {
Expand All @@ -239,6 +242,7 @@ exports.init = (app) => {
)
})

app.options('/preview/:streamId/objects/:objectId/:angle?', cors())
app.get('/preview/:streamId/objects/:objectId/:angle?', cors(), async (req, res) => {
const { hasPermissions } = await checkStreamPermissions(req)
if (!hasPermissions) {
Expand Down

0 comments on commit d9b1fce

Please sign in to comment.