@@ -15,7 +15,7 @@ object Export extends LilaController {
15
15
private def env = Env .game
16
16
17
17
def pgn (id : String ) = Open { implicit ctx =>
18
- NotForBots {
18
+ OnlyHumans {
19
19
OptionFuResult (GameRepo game id) { game =>
20
20
(game.pgnImport.ifTrue(~ get(" as" ) == " imported" ) match {
21
21
case Some (i) => fuccess(i.pgn)
@@ -34,7 +34,7 @@ object Export extends LilaController {
34
34
}
35
35
36
36
def pdf (id : String ) = Open { implicit ctx =>
37
- NotForBots {
37
+ OnlyHumans {
38
38
OptionResult (GameRepo game id) { game =>
39
39
Ok .chunked(Enumerator .outputStream(env.pdfExport(game.id))).withHeaders(
40
40
CONTENT_TYPE -> " application/pdf" ,
@@ -44,7 +44,7 @@ object Export extends LilaController {
44
44
}
45
45
46
46
def png (id : String ) = Open { implicit ctx =>
47
- NotForBots {
47
+ OnlyHumansAndFacebook {
48
48
OptionResult (GameRepo game id) { game =>
49
49
Ok .chunked(Enumerator .outputStream(env.pngExport(game))).withHeaders(
50
50
CONTENT_TYPE -> " image/png" ,
@@ -53,10 +53,15 @@ object Export extends LilaController {
53
53
}
54
54
}
55
55
56
- private def NotForBots (result : => Fu [Result ])(implicit ctx : lila.api.Context ) =
56
+ private def OnlyHumans (result : => Fu [Result ])(implicit ctx : lila.api.Context ) =
57
57
if (HTTPRequest isBot ctx.req) fuccess(NotFound )
58
58
else result
59
59
60
+ private def OnlyHumansAndFacebook (result : => Fu [Result ])(implicit ctx : lila.api.Context ) =
61
+ if (HTTPRequest isFacebookBot ctx.req) result
62
+ else if (HTTPRequest isBot ctx.req) fuccess(NotFound )
63
+ else result
64
+
60
65
private def gameOpening (game : GameModel ) =
61
66
if (game.fromPosition || game.variant.exotic) none
62
67
else chess.OpeningExplorer openingOf game.pgnMoves
0 commit comments