diff --git a/app/Global.scala b/app/Global.scala index 34fe9b3..ecf2724 100644 --- a/app/Global.scala +++ b/app/Global.scala @@ -29,6 +29,10 @@ import play.api.libs.concurrent.Execution.Implicits.defaultContext import java.io.File import scala.concurrent._ +import scala.concurrent.duration._ + +import akka.actor.ActorSystem +import play.api.libs.concurrent.Akka /** Application global object, serves to control startup and control cross-cutting concerns */ object Global extends WithFilters(LoggingFilter) with Response { @@ -68,6 +72,16 @@ object Global extends WithFilters(LoggingFilter) with Response { Logger.error(s"$peers not a directory") System.exit(1) } + + val actorSystem = Akka.system(app) + val ec = actorSystem.dispatcher + + actorSystem.scheduler.schedule( + initialDelay = 10.seconds, + interval = 10.seconds + )(() => { + println("Executing something (Global)...") + })(ec) } /** global error handler */ diff --git a/app/models/Models.scala b/app/models/Models.scala index 8bc2ff0..ffa38f2 100644 --- a/app/models/Models.scala +++ b/app/models/Models.scala @@ -28,6 +28,7 @@ import play.api.db.slick.Config.driver.simple._ import scala.slick.lifted.Tag import play.api.libs.json._ +import org.apache.commons.text.StringEscapeUtils import java.sql.Timestamp import java.util.Date @@ -861,7 +862,11 @@ case class Question( url => (url.url == "true" && url.title == "isCategoryList") }.length > 0 } - .map { answer => answer.text.replace("&", "&").replace("+", "+") } + .map { answer => + answer.copy( + text = StringEscapeUtils.unescapeHtml4(answer.text) + ) + } .toSet assert( categoryNames == answerCategoryNames, diff --git a/build.sbt b/build.sbt index 551f2be..caba0a6 100644 --- a/build.sbt +++ b/build.sbt @@ -43,6 +43,7 @@ libraryDependencies ++= Seq( jdbc, cache, ws, + "org.apache.commons" % "commons-text" % "1.10.0", "com.typesafe.play" %% "play-slick" % "0.8.0", "org.postgresql" % "postgresql" % "42.7.2", "org.bouncycastle" % "bcprov-jdk15to18" % "1.76",