Skip to content

Commit

Permalink
CORS headers for buildinfo routes (#6450)
Browse files Browse the repository at this point in the history
  • Loading branch information
fm3 authored Sep 8, 2022
1 parent f92c355 commit 37571e2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
6 changes: 3 additions & 3 deletions app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class Application @Inject()(multiUserDAO: MultiUserDAO,
schemaVersion <- releaseInformationDAO.getSchemaVersion.futureBox
token <- webKnossosToken(request.identity)
} yield {
Ok(
Json.obj(
addRemoteOriginHeaders(
Ok(Json.obj(
"webknossos" -> webknossos.BuildInfo.toMap.mapValues(_.toString),
"webknossos-wrap" -> webknossoswrap.BuildInfo.toMap.mapValues(_.toString),
"schemaVersion" -> schemaVersion.toOption,
"token" -> token,
"localDataStoreEnabled" -> storeModules.localDataStoreEnabled,
"localTracingStoreEnabled" -> storeModules.localTracingStoreEnabled
))
)))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import scala.concurrent.ExecutionContext

class StandaloneDatastore @Inject()(implicit ec: ExecutionContext) extends Controller {

override def allowRemoteOrigin: Boolean = true

def buildInfo: Action[AnyContent] = Action.async { implicit request =>
Fox.successful(
Ok(Json.obj(
"webknossosDatastore" -> webknossosDatastore.BuildInfo.toMap.mapValues(_.toString),
"webknossos-wrap" -> webknossoswrap.BuildInfo.toMap.mapValues(_.toString)
)))
def buildInfo: Action[AnyContent] = Action { implicit request =>
addRemoteOriginHeaders(
Ok(
Json.obj(
"webknossosDatastore" -> webknossosDatastore.BuildInfo.toMap.mapValues(_.toString),
"webknossos-wrap" -> webknossoswrap.BuildInfo.toMap.mapValues(_.toString)
))
)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.scalableminds.webknossos.tracingstore.controllers

import com.scalableminds.util.tools.Fox
import com.scalableminds.webknossos.datastore.controllers.Controller
import play.api.libs.json.Json
import play.api.mvc.{Action, AnyContent}
Expand All @@ -10,15 +9,12 @@ import scala.concurrent.ExecutionContext

class StandaloneTracingstore @Inject()(implicit ec: ExecutionContext) extends Controller {

override def allowRemoteOrigin: Boolean = true

def buildInfo: Action[AnyContent] = Action.async { implicit request =>
Fox.successful(
def buildInfo: Action[AnyContent] = Action { implicit request =>
addRemoteOriginHeaders(
Ok(
Json.obj(
"webknossosTracingstore" -> webknossosTracingstore.BuildInfo.toMap.mapValues(_.toString)
)
)
)
))
}
}

0 comments on commit 37571e2

Please sign in to comment.