From 6b865130af1e6ef8d212434e1e1293dfe1b4a8fd Mon Sep 17 00:00:00 2001
From: Thibault Duplessis
Date: Wed, 9 Nov 2016 16:22:54 +0100
Subject: [PATCH] remove PDF export. Could be done by an external service using
lichess PGN export
---
.gitmodules | 3 ---
app/controllers/Export.scala | 19 -------------------
app/views/analyse/replay.scala.html | 3 ---
app/views/analyse/replayBot.scala.html | 2 --
conf/base.conf | 1 -
conf/routes | 1 -
modules/game/src/main/Env.scala | 3 ---
modules/game/src/main/PdfExport.scala | 14 --------------
submodules/pdfexporter | 1 -
9 files changed, 47 deletions(-)
delete mode 100644 modules/game/src/main/PdfExport.scala
delete mode 160000 submodules/pdfexporter
diff --git a/.gitmodules b/.gitmodules
index c2b11ee511..51d2845012 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,9 +4,6 @@
[submodule "public/vendor/tagmanager"]
path = public/vendor/tagmanager
url = https://github.com/max-favilli/tagmanager
-[submodule "submodules/pdfexporter"]
- path = submodules/pdfexporter
- url = https://github.com/ornicar/lichessPDFExporter
[submodule "ui/chessli"]
path = ui/chessli
url = https://github.com/ornicar/chess.js
diff --git a/app/controllers/Export.scala b/app/controllers/Export.scala
index 66c79091c5..76a9820de3 100644
--- a/app/controllers/Export.scala
+++ b/app/controllers/Export.scala
@@ -43,25 +43,6 @@ object Export extends LilaController {
})
}
- private val PdfRateLimitGlobal = new lila.memo.RateLimit(
- credits = 20,
- duration = 1 minute,
- name = "export PDF global",
- key = "export.pdf.global")
-
- def pdf(id: String) = Open { implicit ctx =>
- OnlyHumans {
- PdfRateLimitGlobal("-", msg = HTTPRequest lastRemoteAddress ctx.req) {
- lila.mon.export.pdf()
- OptionResult(GameRepo game id) { game =>
- Ok.chunked(Enumerator.outputStream(env.pdfExport(game.id))).withHeaders(
- CONTENT_TYPE -> "application/pdf",
- CACHE_CONTROL -> "max-age=7200")
- }
- }
- }
- }
-
private val PngRateLimitGlobal = new lila.memo.RateLimit(
credits = 60,
duration = 1 minute,
diff --git a/app/views/analyse/replay.scala.html b/app/views/analyse/replay.scala.html
index 75b102502d..37d04b31c1 100644
--- a/app/views/analyse/replay.scala.html
+++ b/app/views/analyse/replay.scala.html
@@ -73,9 +73,6 @@ atom = atom.some) {
@if(game.isPgnImport) {
@trans.downloadImported()
}
- @if(false) {
- @trans.printFriendlyPDF()
- }
@if(false && lila.game.Game.visualisableVariants(game.variant)) {
Generate images
}
diff --git a/app/views/analyse/replayBot.scala.html b/app/views/analyse/replayBot.scala.html
index ae22764d2a..db72e7a488 100644
--- a/app/views/analyse/replayBot.scala.html
+++ b/app/views/analyse/replayBot.scala.html
@@ -84,8 +84,6 @@ chessground = true) {
/
@trans.downloadImported()
}
- /
- @trans.printFriendlyPDF()
@Html(nl2br(escapeHtml(pgn)))
diff --git a/conf/base.conf b/conf/base.conf
index fbc132758e..342517b76a 100644
--- a/conf/base.conf
+++ b/conf/base.conf
@@ -386,7 +386,6 @@ game {
}
net.base_url = ${net.base_url}
uci_memo.ttl = 2 minutes
- pdf.exec_path = "submodules/pdfexporter"
png {
url = "http://homer.lichess.org:8080/board.png"
size = 512
diff --git a/conf/routes b/conf/routes
index 84d5485ba3..e6ef90e06f 100644
--- a/conf/routes
+++ b/conf/routes
@@ -262,7 +262,6 @@ POST /team/:id/close controllers.Team.close(id: String)
POST /$gameId<\w{8}>/request-analysis controllers.Analyse.requestAnalysis(gameId: String)
GET /game/export/$gameId<\w{8}>.pgn controllers.Export.pgn(gameId: String)
-GET /game/export/pdf/$gameId<\w{8}>.pdf controllers.Export.pdf(gameId: String)
GET /game/export/png/$gameId<\w{8}>.png controllers.Export.png(gameId: String)
GET /game/visualizer/$gameId<\w{8}> controllers.Export.visualizer(gameId: String)
diff --git a/modules/game/src/main/Env.scala b/modules/game/src/main/Env.scala
index 8608746837..bd321bbeb8 100644
--- a/modules/game/src/main/Env.scala
+++ b/modules/game/src/main/Env.scala
@@ -29,7 +29,6 @@ final class Env(
val JsPathCompiled = config getString "js_path.compiled"
val UciMemoTtl = config duration "uci_memo.ttl"
val netBaseUrl = config getString "net.base_url"
- val PdfExecPath = config getString "pdf.exec_path"
val PngUrl = config getString "png.url"
val PngSize = config getInt "png.size"
}
@@ -39,8 +38,6 @@ final class Env(
lazy val playTime = new PlayTime(gameColl)
- lazy val pdfExport = PdfExport(PdfExecPath) _
-
lazy val pngExport = new PngExport(PngUrl, PngSize)
lazy val divider = new Divider
diff --git a/modules/game/src/main/PdfExport.scala b/modules/game/src/main/PdfExport.scala
deleted file mode 100644
index 3b208b0aab..0000000000
--- a/modules/game/src/main/PdfExport.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-package lila.game
-
-import java.io.{ File, OutputStream }
-import scala.sys.process._
-
-object PdfExport {
-
- private val logger = ProcessLogger(_ => (), _ => ())
-
- def apply(execPath: String)(id: String)(out: OutputStream) {
- val exec = Process(Seq("php", "main.php", id), new File(execPath))
- exec #> out ! logger
- }
-}
diff --git a/submodules/pdfexporter b/submodules/pdfexporter
deleted file mode 160000
index e8de1dddd5..0000000000
--- a/submodules/pdfexporter
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e8de1dddd5ba0371cd6310d22f9c80a7574ec161