2019-09-20 09:57:26 -06:00
|
|
|
package controllers
|
|
|
|
|
2020-04-29 08:58:36 -06:00
|
|
|
import scala.annotation.nowarn
|
2019-12-08 10:35:26 -07:00
|
|
|
|
2019-09-20 09:57:26 -06:00
|
|
|
import lila.app._
|
2019-12-06 09:39:42 -07:00
|
|
|
import lila.app.http.ResponseHeaders.allowMethods
|
2019-12-08 10:35:26 -07:00
|
|
|
import lila.common.HTTPRequest.isApiOrApp
|
2019-09-20 09:57:26 -06:00
|
|
|
|
2019-12-04 16:39:16 -07:00
|
|
|
final class Options(env: Env) extends LilaController(env) {
|
2019-09-20 09:57:26 -06:00
|
|
|
|
|
|
|
val root = all("")
|
|
|
|
|
2020-05-05 22:11:15 -06:00
|
|
|
def all(@nowarn("cat=unused") url: String) =
|
|
|
|
Action { req =>
|
|
|
|
if (isApiOrApp(req)) apiHeaders
|
|
|
|
else NotFound
|
|
|
|
}
|
2020-04-30 09:19:34 -06:00
|
|
|
|
|
|
|
private val apiHeaders = NoContent.withHeaders(
|
|
|
|
"Allow" -> allowMethods,
|
|
|
|
"Access-Control-Max-Age" -> "1728000"
|
|
|
|
)
|
2019-09-20 09:57:26 -06:00
|
|
|
}
|