Small changes
This commit is contained in:
@@ -8,6 +8,7 @@ import akka.pattern.ask
|
||||
import akka.stream._
|
||||
import akka.stream.scaladsl._
|
||||
import akka.util.Timeout
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import javax.inject._
|
||||
import org.reactivestreams.Publisher
|
||||
import play.api.libs.json._
|
||||
@@ -28,9 +29,6 @@ class AdminController @Inject()(cc: ControllerComponents) extends AbstractContro
|
||||
// Use a direct reference to SLF4J
|
||||
private val logger = org.slf4j.LoggerFactory.getLogger("controllers.HomeController")
|
||||
|
||||
val lobbiesActror: ActorRef = actorSystem.actorOf(Props[LobbiesActor]())
|
||||
val userParentActor: ActorRef = actorSystem.actorOf(Props(classOf[UserParentActor], actorSystem))
|
||||
|
||||
// Home page that renders template
|
||||
def viewAllLobbies() = Action { implicit request =>
|
||||
logger.info(s"Received request from: ${request.remoteAddress}")
|
||||
@@ -41,14 +39,9 @@ class AdminController @Inject()(cc: ControllerComponents) extends AbstractContro
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the value of the Origin header contains an acceptable value.
|
||||
*/
|
||||
def originMatches(origin: String): Boolean = {
|
||||
origin.contains("139.59.210.74") || origin.contains("localhost") || origin.contains("localhost:9000") || origin.contains("localhost:19001")
|
||||
def reloadConfig()= Action { implicit request =>
|
||||
ConfigFactory.invalidateCaches()
|
||||
logger.info("Config reloaded")
|
||||
Ok("Config reloaded")
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
|
||||
*/
|
||||
def sameOriginCheck(rh: RequestHeader): Boolean = {
|
||||
rh.headers.get("Origin") match {
|
||||
case Some(originValue) if originMatches(originValue) =>
|
||||
case Some(originValue) if originMatches(originValue, rh.remoteAddress) =>
|
||||
logger.debug(s"originCheck: originValue = $originValue")
|
||||
true
|
||||
|
||||
@@ -88,7 +88,7 @@ class HomeController @Inject()(cc: ControllerComponents) extends AbstractControl
|
||||
/**
|
||||
* Returns true if the value of the Origin header contains an acceptable value.
|
||||
*/
|
||||
def originMatches(origin: String): Boolean = {
|
||||
def originMatches(origin: String, remoteAddress: String): Boolean = {
|
||||
origin.contains("139.59.210.74") || origin.contains("localhost") || origin.contains("localhost:9000") || origin.contains("localhost:19001")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user